//===================================================================== // submit the form function submitForm(lang,site){ if(validateForm(lang,site)){ document.forms[0].submit(); } } //===================================================================== // validate the form var alertText = ""; var hardReturn = "\r\n"; function validateForm(lang,site) { alertText = ""; validateGegevens(lang,site); if(alertText != "") { if (lang!='en' ){ alert ("Velden zijn niet of niet correct ingevuld:"+hardReturn+hardReturn+alertText); } else { alert ("Some input is not complete or incorrect:"+hardReturn+hardReturn+alertText); } return false; } return true; } //===================================================================== // validate date function validateGegevens(lang,site) { if (document.forms[0].elements[numberOfFileUpload(document.forms[0])].value=="") alertText+= "Foto" + hardReturn; if (document.forms[0].stuVoornaam.value=="") if(lang=='nl') alertText+= "Voornaam" + hardReturn; else alertText+= "First name" + hardReturn; if (document.forms[0].stuInitialen.value=="") if(lang=='nl') alertText+= "Initialen" + hardReturn; else alertText+= "Initials" + hardReturn; if (document.forms[0].stuAchternaam.value=="") if(lang=='nl') alertText+= "Achternaam" + hardReturn; else alertText+= "Last name" + hardReturn; if (document.forms[0].stuAdres.value=="") if(lang=='nl') alertText+= "Straat" + hardReturn; else alertText+= "Adres" + hardReturn; if (document.forms[0].stuHuisnummer.value=="") if(lang=='nl') alertText+= "Huisnummer" + hardReturn; else alertText+= "House number" + hardReturn; if (document.forms[0].stuPostcode.value=="") if(lang=='nl') alertText+= "Postcode" + hardReturn; else alertText+= "House number" + hardReturn; if (document.forms[0].stuWoonPlaats.value=="") if(lang=='nl') alertText+= "Woonplaats" + hardReturn; else alertText+= "Place of residence" + hardReturn; if (document.forms[0].stuTelefoon.value=="") if(lang=='nl') alertText+= "Telefoon" + hardReturn; else alertText+= "Telephone" + hardReturn; if (document.forms[0].stuMobiel.value=="") if(lang=='nl') alertText+= "Mobiele xxx telefoon" + hardReturn; else alertText+= "Mobile phone" + hardReturn; if (!isValidEmailAddress(document.forms[0].stuEmail.value)) if(lang=='nl') alertText+= "E-mail" + hardReturn; else alertText+= "E-mail" + hardReturn; if (document.forms[0].stuNationaliteit.value=="") if(lang=='nl') alertText+= "Nationaliteit" + hardReturn; else alertText+= "Nationality" + hardReturn; if ( getSelectedRadio(document.forms[0].stuGeslacht)==-1) if(lang=='nl') alertText+= "Geslacht" + hardReturn; else alertText+= "Sex" + hardReturn; if (!isDate(document.forms[0].stuGeboorteDatum.value)) if(lang=='nl') alertText+= "Geboortedatum" + dateMsg + hardReturn; else alertText+= "Date of birth" + dateMsgEn + hardReturn; if ( getSelectedCheckbox(document.forms[0].stuVoorwaarden).length ==0) if(lang=='nl') alertText+= hardReturn + hardReturn + "Accoord met de voorwaarden" + hardReturn; else alertText+= "Accept the conditions" + hardReturn; } //===================================================================== // find upload controls function numberOfFileUpload( f ) { for(var i = 0; i < f.elements.length; i ++) { if( f.elements[i].type=='file' ){ return i; } } } //===================================================================== // find radio buttons function getSelectedRadio(buttonGroup) { // returns the array number of the selected radio button or -1 if no button is selected if (buttonGroup[0]) { // if the button group is an array (one button is not an array) for (var i=0; i "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr){ var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strDay=dtStr.substring(0,pos1) var strMonth=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ dateMsg=" (Gebruik het volgende datumformaat: dd-mm-jjjj)"; dateMsgEn=" (Use this format: dd-mm-yyyy)"; return false } if (strMonth.length<1 || month<1 || month>12){ dateMsg="(Voer een geldige maand in)"; dateMsgEn="(Use a valid month)"; return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ dateMsg="(Voer een geldige dag in)"; dateMsgEn="(Use a valid day)"; return false } if (strYear.length != 4 || year==0 || yearmaxYear){ dateMsg="(Voer een geldige jaar in tussen " +minYear+" en "+maxYear+ ")"; dateMsgEn="(Enter a year between " +minYear+" and "+maxYear+ ")"; return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ dateMsg=" (Gebruik het volgende datumformaat: dd-mm-jjjj)"; dateMsgEn=" (Use this format: dd-mm-jjjj)"; return false } return true } function returnFalse(s){ //guess the field if not supplied s = (s == null) ? document.forms[0].Query : s; //if you want to do the search, use this line //doSearch(s); //if you want to alert the user, use this line //alert('Please use the \'Go!!\' button to do a search'); //this line should always be here!! return false; } function windowOpener(url, name, args) { if (typeof(popupWin) != "object"){ popupWin = window.open(url,name,args); } else { if (!popupWin.closed){ popupWin.location.href = url; } else { popupWin = window.open(url, name,args); } } popupWin.focus(); } function isValidEmailAddress( str ) { var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid return true; } return false; } function openDbRelativeURL( url, target ){ //Check we have a target window; alert ('test'); target = (target == null ) ? window : target; //Work out the path of the database; path = location.pathname.split('.nsf')[0] + '.nsf/'; target.location.href = path + url; } function doSearch ( s ,site) { var regExp1 = /\bfield\b/; var regExp2 = /[(,),<,>,\[,\]]/; var str = s.value; if ( str == "" ){ alert("A.u.b. zoektermen invoeren."); s.focus(); } else { if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing if ( regExp1.test( str ) || regExp2.test( str ) ){ var alrt = "Fout:"; alrt += "\n\nHet woord 'field'\nen de karakters [, ], (, ), < or >"; alrt += "\n\nkunnen niet gebruikt worden!\n\n"; s.focus(); return alert( alrt ); } //openDbRelativeURL("All?SearchView' + site + '&Query=" + escape( str ) + "&start=1&count=10",'mainwin'); open('searchview' + site + '?searchview&Query=' + escape( str ) + '&SearchFuzzy=True&site=' + site + '&page=zoeken','mainwin'); } } function getSelectedCheckbox(buttonGroup) { // Go through all the check boxes. return an array of all the ones // that are selected (their position numbers). if no boxes were checked, // returned array will be empty (length will be zero) var retArr = new Array(); var lastElement = 0; if (buttonGroup[0]) { // if the button group is an array (one check box is not an array) for (var i=0; i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i