<!--

//POPUP
function popup(url, breedte, hoogte, scrolling) {
	day = new Date();
	id = day.getTime();
	deHoogte = hoogte;//screen.height - 100;
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=" + scrolling + ",location=0,statusbar=1,menubar=0,resizable=0,top=0,left=0,width=" + breedte + ",height=" + deHoogte + "');");
}

//SWITCH CLASS
function SwitchMe(obj,classNaam) {
	obj.className=classNaam;
}

//SELECT CHOICE
function MoveMe(url, val) {
	if (val != '') {	
		document.location = url + val;
	}
}

//KEYPRESS
function submitenter(myForm, e) {
	var keycode;
	
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13) {
		//myForm.form.submit();
		checkLogin('', 1);
		return false;
	} else return true;
}


//CHECK FORMS
function checkWaarden(fouttext) {
	var form = document.forms["formulier"];
	var fouten = false;
	var color = "#E16569";
	
	
	if (jsRequired != '') {
		requireds = jsRequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].disabled == "") {
				if(form[requireds[x]].value.length != ""){
					form[requireds[x]].style.backgroundColor = "";
				} else {
					fouten = true;
					form[requireds[x]].style.backgroundColor = color;
				}
			}
		}
	}
	if (jsNRequired != '') {
		requireds = jsNRequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].disabled == "") {
				if(form[requireds[x]].value.length != ""  && IsNumeric(form[requireds[x]].value)){
					form[requireds[x]].style.backgroundColor = "";
				} else {
					fouten = true;
					form[requireds[x]].style.backgroundColor = color;
				}
			}
		}
	}
	if (jsERequired != '') {
		requireds = jsERequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].disabled == "") {
				if(form[requireds[x]].value.length != ""  && echeck(form[requireds[x]].value)){
					form[requireds[x]].style.backgroundColor = "";
				} else {
					fouten = true;
					form[requireds[x]].style.backgroundColor = color;
					fouttext += "<br>- Vul een geldig e-mailadres in";
				}
			}
		}
	}
	if (jsDRequired != '') {
		requireds = jsDRequired.split(";");
		for (x=0; x<requireds.length ;x++) {
			if(form[requireds[x]].disabled == "") {
				foutje = isDate(form[requireds[x]].value);
				if(form[requireds[x]].value.length != ""  && foutje==true) {
					form[requireds[x]].style.backgroundColor = "";
				} else {
					fouten = true;
					form[requireds[x]].style.backgroundColor = color;
					//fouttext += foutje;
					fouttext += "<br>- Vul een geldige datum in (dd/mm/yyyy)";
				}
			}
		}
	}

	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
		//return false;
	}else{
		form.submit();
		//return true;
	}
}

//CHECK EMAIL

function checkEmail(fouttext) {
	var form = document.forms["news"];
	var fouten = false;
	var color = "#E16569";
	
	if(form.mail.value.length != ""  && echeck(form.mail.value)) {
		form.mail.style.backgroundColor = "";
	} else {
		fouten = true;
		form.mail.style.backgroundColor = color;
	}
	
	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		//document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	}else{
		form.submit();
	}
}

//CHECK LOGIN

function checkLogin(fouttext, id) {
	var form = document.forms["login" + id];
	var fouten = false;
	var color = "#E16569";
	
	if(id == 2) {
		if(form.isklant[0].checked == true) {
			if(form["slogin"].value.length != ""  && echeck(form["slogin"].value)) {
				form["slogin"].style.backgroundColor = "";
			} else {
				fouten = true;
				form["slogin"].style.backgroundColor = color;
			}
			if(fouten) { }
			else { parent.location = 'form.asp?Fid=8&pnav=;34;&F19=' + form["slogin"].value + '&winkel=1';	}
			
		} else {
			if(form["slogin"].value.length != ""  && echeck(form["slogin"].value)) {
				form["slogin"].style.backgroundColor = "";
			} else {
				fouten = true;
				form["slogin"].style.backgroundColor = color;
			}
			
			if(form["pasw"].value.length != "") {
				form["pasw"].style.backgroundColor = "";
			} else {
				fouten = true;
				form["pasw"].style.backgroundColor = color;
			}
			if(fouten) { }
			else { form.submit(); }
			
		}
	} else { //LINKS
		if(form["slogin"].value.length != ""  && echeck(form["slogin"].value)) {
			form["slogin"].style.backgroundColor = "";
		} else {
			fouten = true;
			form["slogin"].style.backgroundColor = color;
		}
		
		if(form["pasw"].value.length != "") {
			form["pasw"].style.backgroundColor = "";
		} else {
			fouten = true;
			form["pasw"].style.backgroundColor = color;
		}
		
		// is controle goed --> verdergaan, niet goed --> terug
		if(fouten) { }
		else { form.submit(); }
	}
}

//CHECK VOORWAARDEN

function checkVoorwaarden(fouttext) {
	var form = document.forms["voorwaarden"];
	var fouten = true;
	var color = "#E16569";

	if(form.voorwaarde.checked == true) {
		fouten = false;
	}
	if(fouten) { document.getElementById("verror").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>"; }
	else { form.submit(); }
}

//CHECK SEARCH

function checkSearch(id) {
	var form = document.forms["search" + id];
	var fouten = false;
	var color = "#E16569";
	
	if(form.searchw.value.length != "") {
		form.searchw.style.backgroundColor = "";
	} else {
		fouten = true;
		form.searchw.style.backgroundColor = color;
	}
	
	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		//document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	}else{
		form.submit();
	}
}
function checkSearch2(id) {
	var form = document.forms["search" + id];
	var fouten = false;
	var color = "#E16569";
	
	if(form.searchw.value.length != "") {
		form.searchw.style.backgroundColor = "";
	} else {
		if (form.thema.value == '0' && form.leeftijd.value == '0') {
			fouten = true;
			form.searchw.style.backgroundColor = color;
		}
	}
	
	// is controle goed --> verdergaan, niet goed --> terug
	if(fouten){
		//document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	}else{
		form.submit();
	}
}

function IsNumeric(string) {
    if (!string) return false; // als de string leeg is
    var Chars = "0123456789/-."; // mogelijke karakters in de string
    for (var i = 0; i < string.length; i++) { // alle karakters overlopen van de string
       if (Chars.indexOf(string.charAt(i)) == -1) // als het zoveelste karakter in de string NIET in char voorkomt
          return false;
    }
    return true;
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(at,(lat+1))!=-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
		//alert("Invalid E-mail ID")

        return false
	}

	if (str.indexOf(dot,(lat+2))==-1) {
		//alert("Invalid E-mail ID")

        return false
	}

    if (str.indexOf(" ")!=-1) {
		//alert("Invalid E-mail ID")
		
		return false
	}

	return true                                                       
}

//CHECK DATE
function isDate(dtStr) {
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;
	
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	//var strMonth=dtStr.substring(0,pos1);
	//var strDay=dtStr.substring(pos1+1,pos2);
	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){
		fouttext += "<br>- De datum moet in volgend stramien: mm/dd/yyyy";
		//alert("The date format should be : mm/dd/yyyy");
		return false;//fouttext;
	}
	if (strMonth.length<1 || month<1 || month>12){
		fouttext = "<br>- Vul een geldige maand in";
		//alert("Please enter a valid month");
		return false;//fouttext;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		fouttext = "<br>- Vul een geldige dag in";
		//alert("Please enter a valid day");
		return false;//fouttext;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		fouttext = "<br>- Vul een geldig jaar in tussen "+minYear+" en "+maxYear;
		//alert("Please enter a valid 4 digit year between  and );
		return false;//fouttext;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		fouttext = "<br>- Vul een geldige datum in";
		return false;//fouttext;
	}
	return true;
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "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
}

//SET ACTION
function setAction(action, id) {
	var form = document.forms["order" + id];
	
	form["action" + id].value = action;
	
	form.submit();
}

//CHECK VRAAG (voor wedstrijden)
function checkVraag(fouttext) {
	var form = document.forms["vraag"];
	var fout1 = true;
	var fout2 = false;
	var fout3 = false;
	var color = "#990000";

	if (form.antwoord1) {
		for (i=0; i<form.antwoord1.length; i++) {
			if (form.antwoord1[i].checked) {
				fout1 = false;
			}
		}
	} else {
		fout1 = false;
	}

	if (form.antwoord2) {
		if (form.antwoord2.value == "") {
			fout2 = true;
		}
	}

	if (form.antwoord3) {
		if (form.antwoord3.value == "") {
			fout3 = true;
		}
	}

	if (fout1 || fout2 || fout3) {
		document.getElementById("error").innerHTML = "<FONT color='" + color + "'>" + fouttext + "</FONT>";
	} else {
		form.submit();
	}
}

//PREVIEW IMAGES

var offsetfrommouse=[0,0]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 1;	// maximum image size.
var defaultimagewidth = 1;	// maximum image size.

var timer;

function gettrailobj() {
	if (document.getElementById) return document.getElementById("preview_div").style
}

function gettrailobjnostyle() {
	if (document.getElementById) return document.getElementById("preview_div")
}

function truebody() {
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail() {
	gettrailobj().display="none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename, title, width, height) {
	i = imagename
	t = title
	w = width
	h = height
	
	timer = setTimeout("show('"+i+"', t ,w, h);", 200);
}

function show(imagename, title, width, height) {
 
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';
			
		width+=0
		height+=0
		defaultimageheight = height
		defaultimagewidth = width
	
		document.onmousemove=followmouse;

		newHTML = '<div class="border_preview" style="width:'+width+'px;height:'+ height+'px;">';
			//newHTML = newHTML + '<h2 class="title_h2">' + ' '+title + '</h2>'
    		newHTML = newHTML + '<div class="preview_temp_load" ><img src="'+imagename+'" border=0></div></div>';
    	newHTML = newHTML + '</div>';
		
		/*if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'"></iframe>';
		}*/		

		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
	}
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
}


//ADMIN

//Switch items from one listbox to another
//========================================

// Add the selected items from the source to destination list
function addSrcToDestList(list1, list2, form) {
/*	eval('destList = window.document.' + form + '.' + list2);
	eval('srcList = window.document.' + form + '.' + list1);
	var len = destList.options.length;
	for(var i = srcList.length; i >= 0; i--) {
		if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
			//Check if this value already exist in the destList or not
			//if not then add it otherwise do not add it.
			var found = false;
			for(var count = 0; count < len; count++) {
				if (destList.options[count] != null) {
					if (srcList.options[i].value == destList.options[count].value) {
						found = true;
						break;
					}
				}
			}
			if (found != true) {
				destList.options[len] = new Option(srcList.options[i].text, srcList.options[i].value);
				len++;
				srcList.options[i] = null;
			}
      }
   }*/
}

// Marks all the items as selected for the submit button.  
function selectList(list, form) {
	eval('sourceList = window.document.' + form + '.' + list);
	for(var i = 0; i < sourceList.options.length; i++) {
		if (sourceList.options[i] != null)
			sourceList.options[i].selected = true;
			//alert(sourceList.options[i].text + " / " + sourceList.options[i].value);
	}
	return true;
}


function kiesBetaling(bolLink) {
	if (document.forms.betalingsmethode.betaling[3].checked) { window.open(bolLink); }
	document.betalingsmethode.submit();
}


function hideGroup(GroupId, frm) {
	var form = document.forms[frm];
	var groupItems = eval("group_" + GroupId);
	document.getElementById("space_"+GroupId).style.display = "none";
	document.getElementById("space_"+GroupId).visibility = "collapse";
	
	if (groupItems != '') {
		items = groupItems.split(";");
		for (x=0; x<items.length ;x++) {
			document.getElementById("space_F"+items[x]).style.display = "none";
			document.getElementById("space_F"+items[x]).visibility = "collapse";
			document.getElementById("item_"+items[x]).style.display = "none";
			document.getElementById("item_"+items[x]).visibility = "collapse";
		}
	}
	
	if (groupItems != '') {
		items = groupItems.split(";");
		for (x=0; x<items.length ;x++) {
			form['F'+items[x]].disabled = "disabled";
		}
	}
}

function showGroup(GroupId, frm) {
	var form = document.forms[frm];
	var groupItems = eval("group_" + GroupId);
	
	//document.getElementById("space_"+GroupId).style.display = "";
	if (groupItems != '') {
		items = groupItems.split(";");
		for (x=0; x<items.length ;x++) {
			document.getElementById("item_"+items[x]).style.display = "";
			document.getElementById("space_F"+items[x]).style.display = "";
		}
	}
	
	if (groupItems != '') {
		items = groupItems.split(";");
		for (x=0; x<items.length ;x++) {
			form['F'+items[x]].disabled = "";
		}
	}
}

function showLeveringAdres(frm) {  //form = betalingsmethode
	var form = document.forms[frm];
	
	document.getElementById("leveringAdres1").style.display = "";
	document.getElementById("leveringAdres2").style.display = "";
	document.getElementById("leveringAdres3").style.display = "";

	form['leveringAdres4'].disabled = "";
}

function hideLeveringAdres(frm) {  //form = betalingsmethode
	var form = document.forms[frm];
	
	document.getElementById("leveringAdres1").style.display = "none";
	document.getElementById("leveringAdres1").visibility = "collapse";
	document.getElementById("leveringAdres2").style.display = "none";
	document.getElementById("leveringAdres2").visibility = "collapse";
	document.getElementById("leveringAdres3").style.display = "none";
	document.getElementById("leveringAdres3").visibility = "collapse";

	form['leveringAdres4'].disabled = "disabled";
}

function changeFormUrl(frm,link) {
	document.forms[frm].action = link;
}
//-->
