var bFormChanged = 0; var bIgnoreEnter = 0; var aFormImg = new Array(); function SetBtnPressed(sFormName,iButton) { try { var oFld = document.forms[sFormName].elements["iBtnPressed"]; oFld.value = iButton; } catch (e) {} } function SetKeyHeld(sFormName) { iKeys = 0; try { // Can fail if no event object is available! (no problem) iKeys = (event.shiftKey ? 1 : 0) | (event.ctrlKey ? 2 : 0) | (event.altKey ? 4 : 0) ; var oFld = document.forms[sFormName].elements['iKeyHeld']; oFld.value = iKeys; } catch (e) { } } function SubmitForm2(sFormName, bSkipChecks) { SetKeyHeld(sFormName); if(sFormName == '') sFormName = 'DefaultForm'; if (typeof(bSkipChecks) == "undefined") bSkipChecks = false; eval('SubmitForm_'+sFormName+'(' + bSkipChecks + ');'); } function FakeSubmitForm2(sFormName) { SetKeyHeld(sFormName); if(sFormName == '') { sFormName = 'DefaultForm'; } var url = document.forms[sFormName].action; var num = document.forms[sFormName].elements.length; try {document.forms[sFormName].elements["iSearch"].value = 1;} catch(e) {} if (url.indexOf('#')==-1) { urlBeforeAnchor = url; urlAnchor = ''; } else { urlBeforeAnchor = url.slice(0, url.indexOf('#')); urlAnchor = url.slice(url.indexOf('#'), url.length); } for(var i=0; i= 0) { sRest = sRest.substring(iPos, sRest.length); } else { sRest = ''; } urlBeforeAnchor = sLeft + sRest; } urlBeforeAnchor += (urlBeforeAnchor.indexOf('?')==-1) ? '?' : '&'; urlBeforeAnchor += sName + '=' + sValue; } } } url = urlBeforeAnchor + urlAnchor; window.document.location = url; } function AutoCheckInput2(sFormName) { eval("var missing=((typeof(AutoCheckMissing_"+sFormName+")=='undefined') ? '' : AutoCheckMissing_"+sFormName+"());"); eval("var invalid=((typeof(AutoCheckInvalid_"+sFormName+")=='undefined') ? '' : AutoCheckInvalid_"+sFormName+"());"); var error = new Array(2); error[0] = missing; error[1] = invalid; return(error); }; function AutoConvertInput2(sFormName) { var error = ''; eval("try {if (typeof(AutoConvertInput_"+sFormName+")!='undefined') error=AutoConvertInput_"+sFormName+"();} catch(e) {error='error in AutoConvertInput()';}"); return(error); } function SubmitOnEnter2(sForm) { try { if(event.keyCode == 13) { event.keyCode=0; eval('DefaultButton_' + sForm + '();'); } } catch (e) {} } function DecimalPoint() { try { if(event.keyCode == 44) // , event.keyCode = 46; // . } catch (e) {} } function CharAllowed(sChar, sAllowed) { return(sAllowed.indexOf(sChar) >= 0); } function PrintItem2(sFormName, iBtn, value) { if(value == null) value = 1; document.forms[sFormName].action += '&PrintItem=' + value; SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName); } function CopyItem2(sFormName, iBtn, bSkipChecks) { document.forms[sFormName].action += '&CopyItem=1'; document.forms[sFormName].elements['ID'].value='new'; SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName,bSkipChecks); } function DeleteItem2(sFormName, iBtn) { if (confirm('Weet u zeker dat u dit item wilt verwijderen?')) { SetBtnPressed(sFormName,iBtn); with(document.forms[sFormName]) { action += '&DeleteItem=1'; submit(); } } } function ArchiveItem2(sFormName,iBtn) { if (confirm('Weet u zeker dat u dit item naar het archief wilt verplaatsen?\\nVeranderingen die niet zijn opgeslagen zullen verloren gaan.')) { SetBtnPressed(sFormName,iBtn); with(document.forms[sFormName]) { action += '&ArchiveItem=1'; submit(); } } } function Search2(sFormName, iBtn, bSkipChecks) { try {document.forms[sFormName].elements["iSearch"].value = 1;} catch(e) {} SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName,bSkipChecks); } function CloseForm2(bParentRefresh) { var allowClose=true; try { allowClose = AllowClose(); } catch(e) {} if(allowClose) { if (typeof(bParentRefresh)!='undefined' && bParentRefresh) parentRefresh(); self.close(); // Child window is automatically closed. } } function DoneForm2() { var allowDone=true; try {allowDone=AllowDone();} catch(e) {} if(allowDone) window.history.go(-1); } function CancelForm2() { if(window.opener == null) window.history.go(-1); else windowClose(); } function mailPassword2(sFormName,iBtn) { var sep = ((document.forms[sFormName].action.search(/\?/) == -1) ? "?" : "&"); document.forms[sFormName].action += sep + "mailPwd=1"; SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName); } function MailInfo2(sFormName,iBtn) { var sep = ((document.forms[sFormName].action.search(/\?/) == -1) ? "?" : "&"); document.forms[sFormName].action += sep + "mailInfo=1"; SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName); } function login2(sFormName,iBtn) { var sep = ((document.forms[sFormName].action.search(/\?/) == -1) ? "?" : "&"); document.forms[sFormName].action += sep + "login=1"; SetBtnPressed(sFormName,iBtn); SubmitForm2(sFormName); } function datePopup(sObjectID, bShowTime) { sURL = '/calendar/calendar.html?sObjectID=' + sObjectID; sURL += '&selectedDate=' + escape((document.getElementById(sObjectID)).value); iHeight = 184; if(bShowTime) { sURL += '&bShowTime=1'; iHeight += 25; } calendarwindow = windowOpen(sURL, 'datePopup', 'height=' + iHeight + ', width=208, left=400, top=300', true); return; } function returnDate(sControlID, sFullDate) { oDateField = document.getElementById(sControlID); if (sFullDate == -1) { // do nothing... 'cancel' pressed } else if (sFullDate == -2) { // Use no date oDateField.value = ''; } else { // fill text field with the selected date oDateField.value = sFullDate; } // Call the correct OnBlur event, if it exists. try { this.eval(sControlID + '_OnBlur()'); } catch(e) {} // Call the correct OnChange event, if it exists. try { this.eval(sControlID + '_OnChange()'); } catch(e) {} return; } function RemoveFile(FileID, Title) { if (confirm('Weet u zeker dat u dit bestand wilt verwijderen?\\n\\n' + Title)) { with(document.forms['DefaultForm']) { action += '&RemoveID=' + FileID + '&RemoveTitle=' + Title; submit(); } } } function AddFile(FileID, Title) { if (confirm('Weet u zeker dat u dit bestand wilt toevoegen?\\n\\n' + Title)) { with(document.forms['DefaultForm']) { action += '&AddID=' + FileID + '&AddTitle=' + Title; submit(); } } } function OnKeyPress2(sForm, iAction, sExtra) { if(iAction & 2 ) DecimalPoint(); if(bIgnoreEnter) bIgnoreEnter = false; else if(iAction & 1 ) SubmitOnEnter2(sForm); if(iAction & 4 ) { try { sChar = String.fromCharCode(event.keyCode); if(!CharAllowed(sChar, sExtra)) event.keyCode = 0; } catch (e) {} } } function DblSelectMove(sForm,sFrom,sTo) { eval("var oFrom=document.forms[sForm].elements[\""+sFrom+"\"];"); eval("var oTo=document.forms[sForm].elements[\""+sTo+"\"];"); for(nFrom=(oFrom.options.length-1);nFrom>=0;nFrom--) { if (oFrom.options[nFrom].selected) { var oOpt=oFrom.options[nFrom]; oFrom.options[nFrom] = null; oTo.options[oTo.options.length]=oOpt; } } } function GetSelection(sForm, sSelect) { var oOpt = document.forms[sForm].elements[sSelect].options; var aRes = new Array(); for(var i=0; i0); break; case 4: bRes = true; for (var i=0; i 1) { if(aElms[1].length > 0) sTime = aElms[1]; } var aTimes = sTime.split(':'); oElm.value += ' ' + aTimes[0] + ':' + aTimes[1]; if (iType == 3) oElm.value += ':' + aTimes[2]; } break; case 4: if (oElm.value != '') { var aDates = oElm.value.split('-'); oElm.value = aDates[2] + '-' + aDates[1] + '-' + aDates[0]; } break; case 5: if (oElm.value.length == 6) oElm.value = oElm.value.substr(0, 4) + ' ' + oElm.value.substr(4, 2); break; } } catch (e) {} return ''; } function Combo_onkeydown(sName) { eval('Combo_KeyCode_' + sName + '=' + event.keyCode); Combo_BoxVis = eval('Combo_BoxVis_' + sName); if(Combo_BoxVis) { switch(event.keyCode) { case 13: // Enter bIgnoreEnter = true; break; case 27: // Esc event.keyCode = 0; break; } } } function Combo_onkeyup(sName, bShowAll) { var Combo_KeyCode = eval('Combo_KeyCode_' + sName); var Combo_Captions = eval('Combo_Captions_' + sName); var Combo_IDs = eval('Combo_IDs_' + sName); var Combo_Text = eval('Combo_Text_' + sName); var Combo_SelectID = eval('Combo_SelectID_' + sName); var Combo_BoxVis = eval('Combo_BoxVis_' + sName); oCombo = document.getElementById(sName + '_combo'); oTxt = document.getElementById(sName + '_Text'); oBox = document.getElementById(sName + '_box'); oID = document.getElementById(sName); if(Combo_KeyCode == 0) return; var iMatch = -1; var iHilite = 'x'; var aMatches = []; if(Combo_KeyCode == 27 && Combo_BoxVis) oTxt.value = Combo_Text; else if(Combo_Text != oTxt.value) { oID.value = ''; eval('Combo_Text_' + sName + '=\'' + AddSlashes(oTxt.value) + '\''); } oBox.style.width = '' + (oCombo.offsetWidth) + 'px'; oBox.style.marginTop = '' + (oCombo.offsetHeight + 3) + 'px'; oBox.style.display='inline'; var sSearch = oTxt.value; sSearch = sSearch.toUpperCase(); iLen = sSearch.length; for(i=0; i < Combo_Captions.length; i++) { sItem = Combo_Captions[i].substring(0, iLen); sItem = sItem.toUpperCase(); if(bShowAll || sItem == sSearch) { if(Combo_IDs[i] == Combo_SelectID) { iMatch = i; iHilite = aMatches.length; } aMatches.push(i); } } switch(Combo_KeyCode) { case 13: // Enter if(Combo_BoxVis && iMatch >= 0) { Combo_select(sName, Combo_IDs[iMatch]); aMatches = []; iMatch = -1; } break; case 27: // Esc aMatches = []; iMatch = -1; break; case 38: // up if(iHilite != 'x') iHilite--; break; case 40: // down if(iHilite != 'x') iHilite++; break; default: Combo_SelectID = ''; } var sList=""; if(aMatches.length > 0) { if(iHilite == "x") iHilite = 0; else if(iHilite < 0) iHilite = aMatches.length - 1; else if(iHilite >= aMatches.length) iHilite = 0; sList += ''; for(i=0; i < aMatches.length; i++) { sTrClass = "stClickable"; sID = "trCombo_"+ sName +"_"+ i; if(i == iHilite) { Combo_SelectID = Combo_IDs[aMatches[i]]; sTrClass += " stHighLight"; sID_HiLited = sID; } sList += ''; } } eval("Combo_SelectID_"+ sName +"='" + Combo_SelectID + "';"); if(sList != '' && (!(oTxt.value == '' && Combo_BoxVis == 0) || Combo_KeyCode == -1 || Combo_KeyCode == 40)) { sList += '
' + Combo_Captions[aMatches[i]] + ' 
'; oBox.style.height = ((aMatches.length > 15) ? '300px' : ''); oBox.innerHTML = sList; Combo_visible(sName, 1); } else Combo_visible(sName, 0); } function Combo_onblur(sName) { Combo_KeyCode = eval('Combo_KeyCode_' + sName); if(Combo_KeyCode == 9) // Tab key { Combo_BoxVis = eval('Combo_BoxVis_' + sName); if(Combo_BoxVis ) { Combo_select(sName, eval('Combo_SelectID_' + sName)); } else { Combo_disable(sName, true); } } eval('Combo_KeyCode_' + sName + '=' + 0); } function Combo_visible(sName, iVisible) { oBox = document.getElementById(sName + '_box'); if(iVisible) oBox.style.visibility='visible'; else oBox.style.visibility='hidden'; eval('Combo_BoxVis_' + sName + '=' + iVisible); } function Combo_onDropDown(sName) { eval('Combo_KeyCode_' + sName + '=' + -1); Combo_BoxVis = eval('Combo_BoxVis_' + sName); if(Combo_BoxVis) Combo_visible(sName, 0); else Combo_onkeyup(sName, 1); } function Combo_select(sName, ID, bFocus) { var Combo_Captions = eval('Combo_Captions_' + sName); var Combo_IDs = eval('Combo_IDs_' + sName); var iIdx = -1; for(var i=0; i= 0) { oTxt = document.getElementById(sName + '_Text'); oBox = document.getElementById(sName + '_box'); oID = document.getElementById(sName); oTxt.value = Html2Asc(Combo_Captions[iIdx]); oID.value = Combo_IDs[iIdx]; eval("Combo_SelectID_"+ sName + "=oID.value;"); eval('Combo_Text_' + sName + '=\'' + AddSlashes(oTxt.value) + '\''); Combo_visible(sName, 0); try { eval('Combo_' + sName + '_onSelect(' + oID.value +', \''+ AddSlashes(oTxt.value) +'\');'); } catch(e) {} // generate onselect event Combo_disable(sName, false); if(bFocus) oTxt.focus(); } else { Combo_disable(sName, true); } } function Combo_disable(sName, bDisabled) { var oImg = document.getElementById(sName+"_adic"); oImg.src = "/images/form/" + (bDisabled ? "admin_tiny_dis.gif" : "admin_tiny.gif"); } function ComboEnabled(sName) { var oImg = document.getElementById(sName+"_adic"); return (oImg.src.match("admin_tiny.gif")!=null); } function UpdateComboBoxValue(cmbID, valID, newVal) { var oSel = document.getElementById(cmbID); if ( oSel.value == valID) { var oTxt = document.getElementById(cmbID+"_Text"); oTxt.value = newVal; eval("Combo_Text_" + cmbID + "=newVal;"); } eval("var aIDs = Combo_IDs_" + cmbID + ";"); for (var i=0; i 1) sTime = (aElms[1].length > 0) ? aElms[1] : '' // '' was $sDefaultTime else sTime = ''; // '' was $sDefaultTime var aTimes = sTime.split(':'); if (aDates.length<3 || aTimes.length < 2) return 'Er is geen geldige datum ingevuld.'; else { var oDate = new Date(aDates[2].valueOf(),aDates[1].valueOf()-1, aDates[0].valueOf(), aTimes[0].valueOf(), aTimes[1].valueOf()); if(oDate.getDate()!=aDates[0] || (oDate.getMonth()+1)!=aDates[1] || oDate.getFullYear()!=aDates[2] || oDate.getHours()!=aTimes[0] || oDate.getMinutes()!=aTimes[1]) return 'De ingevoerde datum bestaat niet.'; } } break; case 3: if (oElm.value.replace(/[\d \-:]/g, '') != '') return 'Het datum veld is niet juist ingevoerd.'; else if (value != '') { var aElms = oElm.value.split(' '); var aDates = aElms[0].split('-'); if(aElms.length > 1) sTime = (aElms[1].length > 0) ? aElms[1] : '' // '' was $sDefaultTime else sTime = ''; // '' was $sDefaultTime var aTimes = sTime.split(':'); if (aDates.length<3 || aTimes.length < 2) return 'Er is geen geldige datum ingevuld.'; else { var oDate = new Date(aDates[2].valueOf(),aDates[1].valueOf()-1, aDates[0].valueOf(), aTimes[0].valueOf(), aTimes[1].valueOf(), aTimes[2].valueOf()); if(oDate.getDate()!=aDates[0] || (oDate.getMonth()+1)!=aDates[1] || oDate.getFullYear()!=aDates[2] || oDate.getHours()!=aTimes[0] || oDate.getMinutes()!=aTimes[1] || oDate.getSeconds()!=aTimes[2]) return 'De ingevoerde datum bestaat niet.'; } } break; case 4: if (value.replace(/[\d:]/g, '') != '') return 'Een tijd veld bestaat uit nummers, gescheiden door het : teken.'; else if (value != '') { var aDates = value.split(':'); if (aDates.length < 3) return 'Er is geen geldige tijd ingevuld.'; else { var oDate = new Date(0,0,0,aDates[0].valueOf(),aDates[1].valueOf(),aDates[2].valueOf()); if(oDate.getSeconds()!=aDates[2] || (oDate.getMinutes())!=aDates[1] || oDate.getHours()!=aDates[0]) return 'De ingevoerde tijd bestaat niet.'; } } break; case 5: if (oElm.value == '') return ''; m = (oElm.value).match(/^[ ]*[0-9]{4}[ ]?[A-Za-z]{2}[ ]*$/); if (m == null || oElm.value != m[0]) return 'Er is geen geldige postcode ingevuld.'; break; case 6: if(oElm.value.match(/^[ ]*[\+\&\.\-\w]+@[\.\-\w]+\.\w{2,4}[ ]*$/)==null && oElm.value!='') { return 'Er is geen geldig email-adres ingevuld.'; } break; case 7: var sCountryName = sFieldName+'_Country'; var sAreaName = sFieldName+'_Area'; var sPhoneName = sFieldName+'_Number'; var sArea = ''; var sNumber = ''; var sInvalidChar = ''; sInvalidChar += sCountryName.value.replace(/[\d\(\) ]/g, ''); sInvalidChar += sAreaName.value.replace(/[\d\(\) ]/g, ''); sInvalidChar += sPhoneName.value.replace(/[\d\(\) ]/g, ''); if (sInvalidChar != '') return 'Er zijn ongeldige tekens ingevoerd: ' + sInvalidChar; if (sCountryName.value.search(/\-/) != -1) return 'Het landnummer mag alleen nummers bevatten.'; else if ( isNaN(sCountryName.value) ) return 'Het landnummer mag alleen nummers bevatten.'; sArea = sAreaName.value.replace(/\(/, ''); sArea = sArea.replace(/\)/, ''); if ( sArea.search(/\-/) != -1) return 'Het netnummer mag alleen nummers en ronde haakjes bevatten.'; else if ( isNaN(sArea) ) return 'Het netnummer mag alleen nummers en ronde haakjes bevatten.'; sNumber = sPhoneName.value.replace(/ /g, ''); if ( sNumber.search(/\-/) != -1) return 'Het abboneenummer mag alleen nummers en spaties bevatten.'; else if ( isNaN(sNumber) ) return 'Het abboneenummer mag alleen nummers en spaties bevatten.'; if (sCountryName.value!='' && (sArea=='' || sNumber=='')) return 'Als u een landnummer invult, moet u ook een net- en abbonneenummer invullen.'; break; } } catch (e) {} return ''; } function ShowFile2(filename) { window.open(filename); } function ShowImg2(id, width, height) { width += 10; height += 30; windowOpen("/documentviewer.html?sDocName=pageImage&variant=popup&ID="+id, "prodimg", "toolbar=0,resizable=1,width="+width+",height="+height); } function DelFile2(sFormName, id) { var oDelFile = document.forms[sFormName].elements["iDelFile"]; oDelFile.value = id; SubmitForm2(sFormName); }