//IIDj Summer Academy 2003, as 2003 05////----------------------------------------------------------------------// basic settingsfunction INITIALIZE() {window.onerror=null;if (!document.getElementById) {if (document.all) {document.getElementById = IEgetElementByID;}else {if (navigator.userAgent.indexOf('Mac',1)>0) {self.location="noAccess_M.html";}else if (navigator.userAgent.indexOf('Win',1)>0) {self.location="noAccess_W.html";}else {self.location="noAccess.html";}}}visible = 'visible';hidden = 'hidden';theUnitTag = "px";}function IEgetElementByID(ID) {return document.all[ID];}//----------------------------------------------------------------------// functions for scrolling objectsfunction makeScrollObject(theScrollObjectList) {if (window.pageYOffset > - 1) {this.VScrollProp = "window.pageYOffset";}else if (document.documentElement.scrollTop > - 1) {this.VScrollProp = "document.documentElement.scrollTop";}else {this.VScrollProp = "document.body.scrollTop";}this.Speed = 5;this.Snap = 6;this.VScroll = eval(this.VScrollProp);this.ScrollFlag = false;this.Length = theScrollObjectList.length;this.ScrollObjectList = new Array ();this.checkScroll = checkScroll;this.getCurrentScroll = getVScroll;this.setScroll = setScroll;this.scrollObjects = scrollObjects;for (theScrollObject in theScrollObjectList) {theScrollObject = document.getElementById(theScrollObjectList[theScrollObject]);theScrollObject.LayerStyle = theScrollObject.style;theScrollObject.origY = parseInt(theScrollObject.LayerStyle.top);theScrollObject.CurrentScroll = theScrollObject.origY;theScrollObject.targetY = theScrollObject.CurrentScroll;theScrollObject.deltaY = 0;//this.ScrollObjectList.push(theScrollObject);// to include IE prior 5.5this.ScrollObjectList[this.ScrollObjectList.length] =theScrollObject;}return this;}function checkScroll() {if (this.getCurrentScroll() != this.VScroll) {this.VScroll = this.getCurrentScroll();this.ScrollFlag = true;}else if (this.ScrollFlag) {this.setScroll();}setTimeout("this.checkScroll();",100);}function getVScroll() {return eval(this.VScrollProp);}function setScroll() {//flag menu to disable selectionMainMenu.enabled = false;//correct position of fixed objectthis.ScrollFlag = false;//get TARGET scroll, scroll DELTAfor (theScrollObject in this.ScrollObjectList) {with (this.ScrollObjectList[theScrollObject]) {CurrentScroll = parseInt(LayerStyle.top);targetY = (origY+this.VScroll);deltaY = (targetY - CurrentScroll)/this.Speed;}}this.scrollObjects();}function scrollObjects() {if (Math.abs(this.ScrollObjectList[0].targetY - this.ScrollObjectList[0].CurrentScroll) > this.Snap) {for (theScrollObject in this.ScrollObjectList) {with (this.ScrollObjectList[theScrollObject]) {CurrentScroll = CurrentScroll + deltaY;LayerStyle.top = CurrentScroll + theUnitTag;theNewDeltaY = Math.round((targetY - CurrentScroll)/this.Speed);if (Math.abs(theNewDeltaY) >= 1) {deltaY = theNewDeltaY;}}}}else {for (theScrollObject in this.ScrollObjectList) {theScrollObject = this.ScrollObjectList[theScrollObject];theScrollObject.LayerStyle.top = theScrollObject.targetY + theUnitTag;}MainMenu.enabled = true;return true;}setTimeout("this.scrollObjects();",15);}//----------------------------------------------------------------------// rollover image menu// make sure that the roll over image filename is in the following form: RO_theImageFilename, where theImageFilename is the name of the original/default imagefilefunction makeImageMenu (theMenuName,theMenuLeft,theMenuTop,theZindex,theMenuImageParentUrl,theMenuImageFileNameList,theLinkList) {this.MenuName = theMenuName;this.MenuLength = theMenuImageFileNameList.length;this.MenuImageFileNameList = theMenuImageFileNameList;this.LinkList = theLinkList;this.MenuImageList = new Array(this.MenuLength);this.MenuImageParentUrl = theMenuImageParentUrl;this.switchMenuImage = switchMenuImage;this.enabled = true;this.MenuText = "<DIV ID=\"DIV" +this.MenuName + "\" STYLE=\"position:absolute;left:" + theMenuLeft + "px;top:" + theMenuTop + "px;z-index:" + theZindex + ";visibility:hidden;\">"for (var theMenuItemCounter = 0;theMenuItemCounter <this.MenuLength;theMenuItemCounter++) {if (this.LinkList[theMenuItemCounter] != "") {this.MenuText = this.MenuText + "<A HREF=\"" + this.LinkList[theMenuItemCounter] + "\" onMouseOver=\"javascript:" +this.MenuName +".switchMenuImage(" + theMenuItemCounter + ",false);\" onMouseOut=\"javascript:" +this.MenuName +".switchMenuImage(" + theMenuItemCounter + ",true);\"><IMAGE NAME=\"MenuItem" + theMenuItemCounter + "\" SRC=\"" + this.MenuImageParentUrl + this.MenuImageFileNameList[theMenuItemCounter] + "\" BORDER=0>"this.MenuText = this.MenuText + "</A>"}else {this.MenuText = this.MenuText + "<IMAGE NAME=\"MenuItem" + theMenuItemCounter + "\" SRC=\"" + this.MenuImageParentUrl + this.MenuImageFileNameList[theMenuItemCounter] + "\">"}this.MenuText = this.MenuText + "<BR>";}this.MenuText = this.MenuText + "</DIV>"// write menu textdocument.open();document.write(this.MenuText);document.close();for (var theMenuItemCounter = 0;theMenuItemCounter <this.MenuLength;theMenuItemCounter++) {theMenuImage=document["MenuItem" + theMenuItemCounter];this.MenuImageList[theMenuItemCounter] = new RolloverImage(theMenuImage,this.MenuImageParentUrl,this.MenuImageFileNameList[theMenuItemCounter]);}// show Menuthis.Layer = document.getElementById("DIV" + this.MenuName);this.LayerStyle = this.Layer.style;return this;}//----------------------------------------------------------------------// functions for rolloversfunction RolloverImage(theRolloverImage,theRolloverImageParentUrl,theRolloverImageFileName) {this.Image = theRolloverImage;this.RoImage=new Image();this.RoImage.src = theRolloverImageParentUrl + "RO" + theRolloverImageFileName.substring(2,theRolloverImageFileName.length);this.OffImage=new Image();this.OffImage.src = theRolloverImageParentUrl + theRolloverImageFileName;this.switchRolloverImage = switchRolloverImage;}function switchMenuImage(theMenuImageId,theOnFlag) {if (this.enabled){this.MenuImageList[theMenuImageId].switchRolloverImage(theOnFlag);}}function switchRolloverImage(theOnFlag) {if (theOnFlag) {this.Image.src = this.OffImage.src;}else {this.Image.src = this.RoImage.src;}}//----------------------------------------------------------------------// functions for layersfunction writeLayer(theLayer,theLayerText) {if (!theLayer.innerHTML) { theLayer.document.open(); theLayer.document.write(theLayerText); theLayer.document.close();}else { theLayer.innerHTML=theLayerText;}}function showLayers(theLayerList) {var theLayerCount = theLayerList.length;for (var theLayerCounter = 0; theLayerCounter <theLayerCount; theLayerCounter++) {theLayerList[theLayerCounter].style.visibility = visible;}}function showImages(theImageList) {var theImageCount = theImageList.length;for (var theImageCounter = 0; theImageCounter <theImageCount; theImageCounter++) {theImageList[theImageCounter].style.visibility = visible;}}//----------------------------------------------------------------------// functions for PopUpsfunction makePopUp(theMenuID,theMenuItems,theOptions,theDefaultIndex) {var thePopUpText = '<select id="' + theMenuID + '">';for (var theItem in theMenuItems) {thePopUpText += '<option value="' + theOptions[theItem] + '" label="' + theMenuItems[theItem] + '"';if (theItem == theDefaultIndex) {thePopUpText += ' selected="selected"';}thePopUpText += '>' + theMenuItems[theItem] + '</option>';}thePopUpText += '</select>';return thePopUpText;}//----------------------------------------------------------------------// functions for external windowsfunction displayEXTERNAL(theURL,theWindowName,theWindowProperties) {externalWINDOW=window.open(theURL,theWindowName,theWindowProperties);externalWINDOW.focus();}//----------------------------------------------------------------------// cookiesfunction testCookie() {var theDate = new Date();theDate = theDate.getTime();setCookie(theDate,"true",1);theCookieFlag = eval(getCookie(theDate));}function setCookie(theTag,theValue,theValidDays) {if (this.location.host.indexOf(".") < 0) {document.cookie = ("|" + theTag + "|=" + escape(theValue) + ";expires=" + getGMTDate(theValidDays) + ";path=/;");}else {document.cookie = ("|" + theTag + "|=" + escape(theValue) + ";expires=" + getGMTDate(theValidDays) + ";path=/;domain=" + this.location.host + ";");}}function resetCookie(theTag) {document.cookie = ("|" + theTag + "|=;expires=" + getGMTDate(-1));}function getCookie(theTag) {if (document.cookie.indexOf("|" + theTag + "|") > -1) {return unescape(document.cookie.split("|"+theTag+"|=")[1].split(";")[0]);}else {return "";}}function getGMTDate(theDays) {var theCookieExpirationDate = new Date();theCookieExpirationDate = new Date(theCookieExpirationDate.getTime() + theDays * 24*60*60*1000);return theCookieExpirationDate.toGMTString();}//----------------------------------------------------------------------// cookies & formsfunction writeFormElementToCookie(theFormElement) {setCookie(theFormElement.name,theFormElement.value,30)}function fillFormFromCookie(theForm) {if (theCookieFlag) {var theElementCount = theForm.elements.length;for (theElementCounter = 0;theElementCounter < theElementCount; theElementCounter++) {var theFormField = theForm.elements[theElementCounter];getCookieForFormField(theFormField,theFormField.name);}}}function fillFormFieldsFromCookie(theForm,theFieldList) {if (theCookieFlag) {var theElementCount = theFieldList.length;for (theElementCounter = 0;theElementCounter < theElementCount; theElementCounter++) {var theFormField = theForm[theFieldList[theElementCounter]];getCookieForFormField(theFormField,theFormField.name);}}}function getCookieForFormField(theFormField,theFormFieldName) {var theFieldValue = getCookie(theFormFieldName);if (theFieldValue != "") {theFormField.value = theFieldValue;theFormField.select();theFormField.blur();}}//----------------------------------------------------------------------// form functionsfunction setDefaultAnswer(theFormElement) {if(!theFormElement.DefaultAnswer) {theFormElement.DefaultAnswer = theFormElement.value;}}function setDefaultAnswers(theForm,theCheckedFlag) {var theFieldCount = theForm.elements.length;for (var theFieldCounter = 0; theFieldCounter <theFieldCount; theFieldCounter++) {if (theForm[theFieldCounter].name.substring(0,2) != "xx") {setDefaultAnswer(theForm[theFieldCounter])theForm[theFieldCounter].ChangedFlag = theCheckedFlag;}}}function checkEmptyField(theFormElement) {if (getCoreString(theFormElement.value) == "") {theFormElement.value = theFormElement.DefaultAnswer;theFormElement.ChangedFlag = false;}else if (getCoreString(theFormElement.value) != getCoreString(theFormElement.DefaultAnswer) && getCoreString(theFormElement.value).length > 1) {theFormElement.ChangedFlag = true;}}// check out functionsfunction CheckInput(theForm,spentTimeField) {var theFieldCount = theRequiredFieldsList.length;for (var theFieldCounter = 0; theFieldCounter <theFieldCount; theFieldCounter++) {var theRequiredFieldName = theRequiredFieldsList[theFieldCounter];var theFormElement = theForm[theRequiredFieldName];var theAnswer = getCoreString(theFormElement.value);if (theAnswer == "") {alert("Please check your input for the selected field!");theFormElement.focus();theFormElement.select();return false;}}return CheckOut(spentTimeField);}function CheckRegFormInput(theForm,theOutputField) {var theRequiredFieldNamesString = (" " + theRequiredFieldsList.join(" ") + " ");var theFieldCount = theForm.elements.length;var theOutputString = "";for (var theFieldCounter = 0; theFieldCounter <theFieldCount; theFieldCounter++) {var theAnswer = "";var theFormElement = theForm.elements[theFieldCounter];var theFieldName = theFormElement.name;if (theFieldName.substring(0,3) == "che") {if (theFormElement.checked) {theAnswer = theFormElement.value;}else {theAnswer = "-";}}else {theAnswer = theFormElement.value;}if (theRequiredFieldNamesString.indexOf(" " + theFieldName + " ") > -1) {if (getCoreString(theAnswer) == "") {alert("Please complete your input for the selected field!");theFormElement.focus();if (theFormElement.name.indexOf("check") < 0) {theFormElement.select();}return false;}else if (theFieldName.toLowerCase().indexOf("mail")> -1) {// check eMail formattingtheAnswer = getEmailFromString(theFormElement.value.toLowerCase());if (!theAnswer) {alert("Please check Your eMail Address input!");theFormElement.focus();theFormElement.select();return false;}}}theOutputString = (theOutputString + "|||" + theAnswer);}theOutputField.value = theOutputString;theOutputField.form.submit();return false;}function CheckOut(spentTimeField) {// time unit is 1/1000secondtheSpentTimeInMinutes = checkTimer()/1000/60;if (theSpentTimeInMinutes <0.4 && spentTimeField.value == "") {startDate = (startDate - 1000*60*60*24);alert("Hey- that did go quite fast ;-) If you want to send your account anyway, just press the Submit button once again!");return false;}else {if (theSpentTimeInMinutes> 3 && theSpentTimeInMinutes <100) {spentTimeField.value = Math.round(theSpentTimeInMinutes);}//showWait();return true;}}function checkEmailSubmission(theEmailAddress) {if (getEmailFromString(theEmailAddress.toLowerCase()) != "") {return true;}alert("Please check Your eMail Address input!");return false;}//----------------------------------------------------------------------// string functionsfunction replaceString(theTextItemsList,theSearchItemsList,theReplaceString) {if (typeof theTextItemsList == "string") {theTextItemsList = new Array(theTextItemsList);}if (typeof theSearchItemsList == "string") {theSearchItemsList = new Array(theSearchItemsList);}var theTextItemsCount = theTextItemsList.length;var theSearchItemsCount = theSearchItemsList.length;for (var theTextItemsCounter = 0; theTextItemsCounter <theTextItemsCount; theTextItemsCounter++) {theTextItem = theTextItemsList[theTextItemsCounter].split(theSearchItemsList[0]);for (var theSearchItemsCounter = 1; theSearchItemsCounter <theSearchItemsCount; theSearchItemsCounter++) {var theItemsCount = theTextItem.length;theSplitList = new Array();for (var theItemsCounter = 0; theItemsCounter <theItemsCount; theItemsCounter++) {theSplitList = theSplitList.concat(theTextItem[theItemsCounter].split(theSearchItemsList[theSearchItemsCounter]));}theTextItem = theSplitList;}theTextItemsList[theTextItemsCounter] = theTextItem.join(theReplaceString);}if (theTextItemsList.length = 1) {return theTextItemsList[0];}else {return theTextItemsList;}}function getCoreString(theTextItem) {theTextItem = theTextItem.toLowerCase();return replaceString([theTextItem],[" "],"");}function getEmailFromString(theString) {var theEmailRegEx = /([0-9a-z]+[0-9a-z\._\+={}\-]*)+@([0-9a-z]+([_\-][0-9a-z]+)*\.)+[a-z][a-z]+/;var theMatch = theEmailRegEx.exec(theString);if (!theMatch) {return "";}else {return theEmailRegEx.exec(theString)[0];}}//----------------------------------------------------------------------// timer functionsfunction initTimer() {startDate = new Date();}function checkTimer() {NOW = new Date();return (NOW - startDate);}//----------------------------------------------------------------------// auxiliariesfunction centerWindow() {if (document.body.clientWidth==0){window.moveTo(Math.round((screen.availWidth-window.outerWidth)/2),Math.round((screen.availHeight-window.outerHeight)/2));}else {window.moveTo(Math.round((screen.availWidth-document.body.clientWidth)/2),Math.round((screen.availHeight-document.body.clientHeight)/2));}window.focus();}function showWait() {displayEXTERNAL('wait.html','WAIT','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=397,height=200');}function getDeadline() {theDeadline = new Date(2003,6,1);ToDay = new Date();theLeftDays = (Math.round((theDeadline-ToDay)/1000/60/60/24));return 'The <B>Information Design Summer Academy</B> is now under way<BR>we can not accept any more applications...'}