//recursive function to close all menu's
function CloseMenus(n,nId) {
	var children = n.childNodes;                
	for(var i=0; i < children.length; i++) {    
			if (children[i].className == 'open')
			{
				children[i].className = 'closed';
			}
			//color the selected item different when it is a LI
			if (children[i].id == "li_" + nId){
				document.getElementById("li_" + nId).firstChild.style.color = "#ff6600";
				document.getElementById("li_" + nId).firstChild.style.fontWeight = "bold";
				//children[i].firstChild.style.color = '#ff6600';
				//children[i].firstChild.style.fontWeight = 'bold';
			}
		CloseMenus(children[i], nId);
	}
}

//function to toggle menu items
function toggle(id){
if (id != ''){
	CloseMenus(document.getElementById('menuContainer').childNodes[0], id);
	//ul
	
	allIDs = id.split(',');
	
	for (var i=allIDs.length-1; i>=0; i--)
	{	
		id = allIDs[i];
		ul = "ul_" + id;
		ulElement = document.getElementById(ul);
		if (ulElement){
			if (ulElement.className == 'closed'){
				ulElement.className = "open";
			}else{
					ulElement.className = "closed";
				}
			}
		}

		//li
		li = "li_" + id;
		liElement = document.getElementById(li);
		if (liElement){
			if (liElement.parentNode.className == 'closed'){
				liElement.parentNode.className = "open";
			}
			else{
				liElement.parentNode.className = "closed";
			}
		}
	}

	try
	{
		document.getElementById("LectricLogo").height = (document.body.children[0].offsetHeight - document.getElementById("menuContainer").offsetHeight - 200)  ;
	}
	catch(dummyCatch){}
}

//Display the tr with the answer
function showFaq(oObject){
	if (oObject.parentNode.nextSibling.firstChild.style.display == 'none'){
		oObject.parentNode.nextSibling.firstChild.style.display = 'block';
	}
	else{
		oObject.parentNode.nextSibling.firstChild.style.display = 'none';
	}
}

	function uncheck(name1, name2) {
	 if(name1.checked) {
	  name2.checked = false;
	 } else {
	  name2.checked = true;
	 }
	}
	
	function checkbox_toggle(chbx, hiddenfield, aan_value, uit_value) {
	 //hiddenfield = "document.Form1."+hidden_name;
	 //window.alert(hiddenfield);
	 
	 if (chbx.checked) {
	  hiddenfield.value = aan_value;
	 } else {
	  hiddenfield.value= uit_value;
	 }
	}
	
	function CheckNumber(checkString) {
		newString = "";
		count = 0;
		
		for (i = 0; i < checkString.length; i++) {
			ch = checkString.substring(i, i+1);
			if ((ch >= "0" && ch <= "9") || (ch == ".") || (ch == ",")) {
				newString += ch;
			}
		}
		if (checkString != newString) {
			res = false; 
		} else {
			res = true;
		}
		
		if (checkString.length ==0) {
			res = false; 
		}
	return res
	}

  function CheckEmail(address) {
    return address.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.int)|(\.gov)|(\.org)|(\.biz)|(\.info)|(\..{2,2}))$)\b/gi);
  }

  function daysInFebruary(year) {
		return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
  }

  function CheckDate(name) {
    var daysInMonth = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);

    el_month = eval("document.Form1."+name+"Month")
    el_day = eval("document.Form1."+name+"Day")
    el_year = eval("document.Form1."+name+"Year")
		
		if (el_day.value == '-1') return false;
		if (el_month.value == '-1') return false;
		if (el_year.value == '-1') return false;    
    
    month = el_month.options[el_month.selectedIndex].value;
    day = el_day.options[el_day.selectedIndex].value;
    year = el_year.options[el_year.selectedIndex].value;

    // Explicitly change type to integer to make code work in both
    // JavaScript 1.1 and JavaScript 1.2.
    var intYear = parseInt(year);
    var intMonth = parseInt(month);
    var intDay = parseInt(day);

    // catch invalid days, except for February
    if ((intMonth != 2) && (intDay > daysInMonth[intMonth])) return false;

    if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;

    return true;
  }

  function CheckForm(theForm) {
    result=true;

    if (theForm.email.value == "") {
      window.alert("U dient een e-mail adres in te vullen");
      theForm.email.focus();
      result=false;
    } else if (theForm.email.value!="" && !CheckEmail(theForm.email.value)) {
      window.alert("Dit e-mail adres is niet geldig!");
      theForm.email.focus();
      result=false;
    }  
	    			   else if (theForm.geslacht[0].checked == false && theForm.geslacht[1].checked == false ) {
	    				   window.alert("U moet hier een keuze maken: 'geslacht'");
	    				   result=false;
	    			   }
				     
				   else if (theForm.voornaam.value=="") {
					 	window.alert("Dit veld mag niet leeg zijn: 'Voornaam'");
					 	theForm.voornaam.focus();
					 	result=false;
				   }
				   
				   else if (theForm.achternaam.value=="") {
					 	window.alert("Dit veld mag niet leeg zijn: 'Achternaam'");
					 	theForm.achternaam.focus();
					 	result=false;
				   }
				   
				   else if (theForm.email.value=="") {
					 	window.alert("Dit veld mag niet leeg zijn: 'email'");
					 	theForm.email.focus();
					 	result=false;
				   }
				   
		if(result) {
			theForm.submit();
		}
  }