ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function mapAction()
	{
	document.frmZoekMap.submit();
	}
	
function topmenuAction()
	{
	document.frmZoek.submit();
	}

function Bewaren()
	{
	document.frmContent.submit();
	}

function Bewaren2()
	{
	document.frmContent2.submit();
	}
	
function OpenInfoblad()
	{	window.open('popup_infoblad.asp?',null,'width=600, height=400,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}

function OpenOndernemer()
	{	window.open('popup_ondernemers.asp?',null,'width=600, height=450,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}

function OpenKerst()
	{	window.open('popup_nieuws_kerst.asp?',null,'width=800, height=550,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}

function OpenBestuurFoto(type)
	{	window.open('popup_bestuur_foto.asp?type='+type,null,'width=600, height=400,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}
	
function OpenBestuurZitting()
	{	window.open('popup_bestuur_zitting.asp?',null,'width=600, height=400,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}

function OpenOcmwZitting()
	{	window.open('popup_bestuur_zitting.asp?dienst=2',null,'width=600, height=400,status=yes,menubar=no,toolbar=no,location=no,resizable=yes,scrollbars=yes');
	}

function OpenBestuurAanvraagGR()
	{	window.open('popup_bestuur_aanvraag_gr.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=yes');
	}

function OpenPlanZoom(plan)
	{	window.open('plan_zoom.asp?plan='+plan,null,'width=600, height=620,status=yes,menubar=no,toolbar=no,location=no,resizable=no');
	}	

function OpenMelding()
	{	window.open('popup_melding.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=yes');
	}	

function OpenVakantie()
	{	window.open('popup_vakantie.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=yes');
	}	
	
function OpenReserv()
	{	window.open('popup_reserv.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=yes');
	}	
	
function OpenJobStudent()
	{	window.open('popup_job.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=yes');
	}	
	
function OpenMonitor()
	{	window.open('popup_monitor.asp',null,'width=600, height=510,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=yes');
	}	
	
function ExpandCollapse(strObj)
	{
	if (document.getElementById('DIV'+strObj).style.display == "none")
		{
		showObject(document.getElementById("DIV"+strObj).style);
		document.getElementById("IMG"+strObj).src="images/tree/f1.gif";
		document.getElementById("SGN"+strObj).src="images/tree/udrm.gif";
		}
	else 
		{
		hideObject(document.getElementById('DIV'+strObj).style);
		document.getElementById("IMG"+strObj).src="images/tree/f0.gif";
		document.getElementById("SGN"+strObj).src="images/tree/udrp.gif";
		}
	}

function ExpandCollapse2(strObj)
	{
	if (document.getElementById("DIV"+strObj).style.display == "none")
		{
		showObject(document.getElementById("DIV"+strObj).style);
		}
	else 
		{
		hideObject(document.getElementById("DIV"+strObj).style);
		}
	}

function showObject(obj)
	{
	if (ns4) obj.visibility = "show"		
	else obj.display="block"
	}

function hideObject(obj)
	{
	if (ns4) obj.visibility = "hide"
	else obj.display="none"
	}


function isLowRes() {
   /*
   ** Check if the browser is running in a low-resolution environment
   ** try to use the screen object (in N4 or e4). If not available, try to use Java.
   ** If not available, assume low-res.
   ** returns true if in a low-resolution environment (width < 800 pixels)
   */
   if (self.screen) 
     return (screen.width < 800);
   else 
     if (navigator.javaEnabled && navigator.javaEnabled())
       return (java.awt.Toolkit.getDefaultToolkit().getScreenSize().width < 800);
     else
       return true;
   }
   
var current;
current=1;
function volgend()
	{	if(current<10)	
			current=current+1;
		else
			current=1;
		document.slide.src="images/toerisme/" + current + ".jpg";
	}
function vorig()
	{	if(current>1)	
			current=current-1;
		else
			current=10;
		document.slide.src="images/toerisme/" + current + ".jpg";
	}
	
function OpenParent(url)
	{	top.document.location.href=url;
	}
	
	
	
function CheckAndForward(url)
	{	
	if (confirm('Bent u zeker?'))
		{
		document.location = url;
		}
	else 
		{
		}
	}

function save()
	{	document.frmAct.submit();
	}
	
function saveActKal()
	{	document.frmContent.submit();
	}
	
function reserveren()
	{	
	//alert('aard:'+document.frmMelding.txtAard.value);
    var naam=document.getElementById("txtNaam").value;	
    var straat=document.getElementById("txtStraat").value;	
    var nummer=document.getElementById("txtNummer").value;	
    var gemeente=document.getElementById("txtGemeente").value;	
    var GebJaar=document.getElementById("txtGebJaar").value;	
    var tel=document.getElementById("txtTel").value;	
    var email=document.getElementById("txtEmail").value;	
    		
	if (naam=='' || straat=='' || nummer=='' || gemeente=='' || GebJaar=='' || tel=='' || email=='')
	    {	alert('Alle velden met * invullen aub');
			return;
		}
	else
	    {   document.frmReserv.submit();
	    }
	
	//parent.window.close();
	}	

function docAction()
	{
	document.frmZoekDoc.submit();
	}
	
function zoek()
    {
    //alert(document.frmZoek.txtZoek.value + 'xxx');
    parent.frames[2].location = 'iframe.asp?wp=93&a=1&txtZoek=' + document.frmZoek.txtZoek.value;
    parent.frames[1].location = 'nav_ot.asp?txtZoek=' + document.frmZoek.txtZoek.value;
    }

function delConfirm(nieuwsid)
	{
	if (confirm('ben je zeker dat je dit bericht wil verwijderen?'))
		{	document.location='admin.asp?wp=5&a=1&n='+nieuwsid;
		}
	else
		{	
		}
	}

function aanvragen_gr()
	{	
//	alert('test');
//	document.frmAanvraagGR.pmAction.value = action;
//	document.frmAanvraagGR.pmID.value = pm_id;
//	document.frmAanvraagGR.pmoID.value = pmo_id;
	if (document.frmAanvraagGR.txtNaam.value=='' || document.frmAanvraagGR.txtStraat.value=='' || document.frmAanvraagGR.txtNummer.value=='' || document.frmAanvraagGR.txtEmail.value=='')
	{	alert('Alle velden invullen aub (behalve bus)');
		return;
	}
	document.frmAanvraagGR.submit();
	//parent.window.close();
	}	

function annuleren_gr()
	{
	parent.window.close();
	}

function checkWens()
	{	var naam=document.getElementById("txtName").value;
		var tekst=document.getElementById("txtCommentaar").value;
		//alert(naam + ' ' + tekst);
		if (naam=='' || tekst=='') {
			alert('Alle velden invullen aub!');
			return;
			}
		else {
			//alert(document.frmGB.action);
			document.frmGB.submit();
			}
	}


function checkGrofVuil()
	{	var naam=document.getElementById("txtName").value;
		var tekst=document.getElementById("txtStraatNr").value;
		var email=document.getElementById("txtEmail").value;
		//alert(naam + ' ' + tekst);
		if (naam=='' || tekst=='' || email=='') {
			alert('Alle velden invullen aub!');
			return;
			}
		else {
			//alert(document.frmGB.action);
			document.frmGB.submit();
			}
	}


function check150()
	{	var naam=document.getElementById("txtName").value;
		var tekst=document.getElementById("txtStraatNr").value;
		var tel=document.getElementById("txtTel").value;
		var email=document.getElementById("txtEmail").value;
		var vnaam=document.getElementById("txtNameVereniging").value;
		//alert(naam + ' ' + tekst);
		if ((naam=='' && vnaam=='') || tekst=='' || email=='' || tel=='') {
			alert('Alle velden invullen aub!');
			return;
			}
		else {
			//alert(document.frmGB.action);
			document.frmGB.submit();
			}
	}	
	
function checkEvocatie()
	{	var naam=document.getElementById("txtEvocNaam").value;
		var straat=document.getElementById("txtEvocStraat").value;
		var nr=document.getElementById("txtEvocNr").value;
		var pcode=document.getElementById("txtEvocPCode").value;
		var gemeente=document.getElementById("txtEvocGemeente").value;
		var tel=document.getElementById("txtEvocTelnr").value;
		var email=document.getElementById("txtEvocEmail").value;
		var betaling=document.getElementById("chkEvocBetaling").value;
		var datum=document.getElementById("chkEvocDag").value;
		var plaats=document.getElementById("chkEvocPlaats").value;
		var aantal=document.getElementById("txtEvocAantal").value;
		//alert(naam + ' ' + tekst);
		if ((naam=='') || straat=='' || nr=='' || pcode=='' || gemeente=='' || email=='' || tel=='' || datum=='' || plaats=='' || betaling=='' || aantal=='') {
			alert('Alle velden invullen aub!');
			return;
			}
		else {
		    //alert (checkValid(document.getElementById("txtEvocEmail")));
		    if (checkValid(document.getElementById("txtEvocEmail")) == true) {
			    document.frmEvocatie.submit();		        
		        }
		    else {
			    alert('Gelieve een geldig e-mailadres in te geven!');
			    return;	    
		        }
			}
	}	

function checkActKal()
	{	var organ=document.getElementById("txtOrganisator").value;
		var tel=document.getElementById("txtTel").value;
		var email=document.getElementById("txtEmail").value;
		var titel=document.getElementById("txtTitel").value;
		var datum=document.getElementById("txtDatum").value;
		var uur=document.getElementById("txtUur").value;
		var plaats=document.getElementById("txtPlaats").value;
		var oms=document.getElementById("txtOms").value;
		
		var vooraf=document.getElementById("radVooraf").checked;
		var rnaam=document.getElementById("txtReservNaam").value;
		var rstraat=document.getElementById("txtReservStraatNr").value;
		var rpostcode=document.getElementById("txtReservPostcode").value;
		var rgemeente=document.getElementById("txtReservGemeente").value;
		var rtel=document.getElementById("txtReservTel").value;
		var remail=document.getElementById("txtReservEmail").value;
		
		var voorwaarden=document.getElementById("chkVoorwaarden").checked;
		//alert(vooraf);
		//alert(organ + ' ' + titel);
		
		if (organ=='' || titel=='' || email=='' || datum=='' || plaats=='' || oms=='') {
			alert('Alle velden met * invullen aub!');
			return;
			}
		else {
			if (vooraf==false && (rnaam=='' && rstraat=='' && rpostcode=='' && rgemeente=='' && rtel=='' && remail=='')) {
				alert('Minstens 1 veld bij "VOORAF RESERVEREN" invullen aub!');
				return;
				}	
			else {
				if (voorwaarden==false) {
					alert('Als organisator moet u de akkoord gaan met de voorwaarden!');
					}
				else {
					if (checkValid(document.getElementById("txtEmail"))==false) {
						//alert('e-mailadres is ongeldig!');
						}
					else {
					//	if (dateValid(document.getElementById("txtDatum"))==false) {
					//		alert('datum is ongeldig!');
					//		}
					//	else {
							document.frmContent.submit();
					//		}
						}
					}
				}
			}
	}

function actKalVooraf(vooraf) {
	var aDisabled=""
	if (vooraf==0) {
		aDisabled="disabled"
		}
	//alert('x' + aDisabled);
	document.getElementById("txtReservNaam").disabled=aDisabled;
	document.getElementById("txtReservStraatNr").disabled=aDisabled;
	document.getElementById("txtReservPostcode").disabled=aDisabled;
	document.getElementById("txtReservGemeente").disabled=aDisabled;
	document.getElementById("txtReservTel").disabled=aDisabled;
	document.getElementById("txtReservEmail").disabled=aDisabled;
	document.getElementById("txtReservURL").disabled=aDisabled;
	}
	
function actKalPrijs(gratis) {
	var aDisabled=""
	if (gratis==1) {
		aDisabled="disabled"
		}
	document.getElementById("txtVVK").disabled=aDisabled;
	document.getElementById("txtPrijs").disabled=aDisabled;
	}
	
function opencalendar(datum,veld) 	
    {	window.open('calendar.asp?datum='+datum+'&veld='+veld,null,'width=200, height=200,status=yes,menubar=no,toolbar=no,location=no,resizable=no,scrollbars=no');
	}	
	
function plakDatum(datum,veld)
    {   window.opener.document.getElementById(veld).value=datum;
	    window.opener.document.getElementById(veld+'hidden').value=datum;
	    window.close();
    }

function wisImage(imgfile,img)
	{	if (confirm('ben je zeker dat je deze afbeelding wil verwijderen?'))
		{	document.getElementById(imgfile).value='';
			document.getElementById(img).src='';
			document.frmContent.submit();
		}
		else
		{
		}
	}


//E-MAIL CHECK FUNCTIONS
function checkValid (formField) {
    if ( checkValidation ( formField ) == true ) {
        //alert ( 'E-Mail Address Validates OK' );
        return ( true );
    }
    else {
        return ( false );
    }
}

function checkValidation(formInput) {

//    if (typeof(formInput) != "object") {
//        alert("Validation not supported on this browser.");
//        return(false);
//    }

    var message;

    if (stringEmpty(formInput.value)) {
        message = "Error! There is no input value entered.";
        alert(message);
    } else if (noAtSign( formInput.value )) {
        message = "Fout! Emailadres \"" + formInput.value + "\" bevat geen '@' karakter.";
        alert(message);
    } else if (nothingBeforeAt(formInput.value)) {
        message = "Fout! Emailadres \"" + formInput.value;
        message += "\" moet minstens 1 karakter bevatten voor het '@' karakter";
        alert(message);
    } else if (noValidPeriod(formInput.value)) {
        message = "Fout! Emailadres \"" + formInput.value + "\" moet een punt ('.') bevatten.";
        alert(message);
    } else if (noValidSuffix(formInput.value)) {
        message = "Fout! Emailadres \"" + formInput.value;
        message += "\" moet een suffix van 2, 3 of 4 karakters bevatten.";
        alert(message);
    } else {
        message = "Success! The email address \"" + formInput.value + "\" validates OK.";
        //alert(message);
        return (true);
    }

//    var objType = typeof(formInput.focus);
//    if (objType == "object" || objType == "function") {
//         formInput.focus();
//    }

    return (false);
}


function stringEmpty (formField) {
    // CHECK THAT THE STRING IS NOT EMPTY
    if ( formField.length < 1 ) {
        return ( true );
    } else {
        return ( false );
    }
}

function noAtSign (formField) {
    // CHECK THAT THERE IS AN '@' CHARACTER IN THE STRING
    if (formField.indexOf ('@', 0) == -1) {
        return ( true )
    } else {
        return ( false );
    }
}

function nothingBeforeAt (formField) {
    // CHECK THERE IS AT LEAST ONE CHARACTER BEFORE THE '@' CHARACTER
    if ( formField.indexOf ( '@', 0 ) < 1 ) {
        return ( true )
    } else {
        return ( false );
    }
}

function noLeftBracket (formField) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR LEFT BRACKET
    if ( formField.indexOf ( '[', 0 ) == -1 && formField.charAt (formField.length - 1) == ']') {
        return ( true )
    } else {
        return ( false );
    }
}

function noRightBracket (formField) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN CHECK FOR RIGHT BRACKET
    if (formField.indexOf ( '[', 0 ) > -1 && formField.charAt (formField.length - 1) != ']') {
        return ( true );
    } else {
        return ( false );
    }
}

function noValidPeriod (formField) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if (formField.indexOf ( '@', 0 ) > 1 && formField.charAt (formField.length - 1 ) == ']')
        return ( false );

    // CHECK THAT THERE IS AT LEAST ONE PERIOD IN THE STRING
    if (formField.indexOf ( '.', 0 ) == -1)
        return ( true );

    return ( false );
}

function noValidSuffix(formField) {
    // IF EMAIL ADDRESS IN FORM 'user@[255,255,255,0]', THEN WE ARE NOT INTERESTED
    if (formField.indexOf('@', 0) > 1 && formField.charAt(formField.length - 1) == ']') {
        return ( false );
    }

    // CHECK THAT THERE IS A TWO OR THREE CHARACTER SUFFIX AFTER THE LAST PERIOD
    var len = formField.length;
    var pos = formField.lastIndexOf ( '.', len - 1 ) + 1;
    if ( ( len - pos ) < 2 || ( len - pos ) > 4 ) {
        return ( true );
    } else {
        return ( false );
    }
}

//END E-MAIL CHECK FUNCTIONS


//Date check function

function dateValid(objName) {
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("-"," ","/",".");
	var intElementNr;
	// var err = 0;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	//strDate = datefield.value;
	strDate = objName;
	if (strDate.length < 1) {
		return true;
		}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) {
				err = 1;
				return false;
				}
			else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
				}
			booFound = true;
		   }
		}
	if (booFound == false) {
		if (strDate.length>5) {
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
		   }
		}
	//Adjustment for short years entered
	if (strYear.length == 2) {
		strYear = '20' + strYear;
		}
	strTemp = strDay;
	strDay = strMonth;
	strMonth = strTemp;
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
		err = 2;
		return false;
		}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
				}
			}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
		   }
		}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
		err = 4;
		return false;
		}
	if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
		}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
		}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
		}
	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
			}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
				}
			}
		else {
			if (intday > 28) {
				err = 10;
				return false;
				}
			}
		}
	return true;
	}

	function LeapYear(intYear) {
		if (intYear % 100 == 0) {
			if (intYear % 400 == 0) { return true; }
			}
		else {
			if ((intYear % 4) == 0) { return true; }
			}
		return false;
		}
//  End -->


//End Date check function
