Cufon.replace('h1');
Cufon.replace('h2');

var ie=document.all;
var nn6=document.getElementById&&!document.all;

var buttonspathname = "/imgt/";
var img1 = new Image(); img1.src = buttonspathname + "btn_demo_aanvragen_grey.jpg";
var img2 = new Image(); img2.src = buttonspathname + "btn_index_bestellen_grey.jpg";
var img3 = new Image(); img3.src = buttonspathname + "btn_index_meer_info_grey.jpg";
var img4 = new Image(); img4.src = buttonspathname + "btn_index_welkom_op_meer_info_grey.jpg";

var img5 = new Image(); img5.src = buttonspathname + "btn_home_active.jpg";
var img6 = new Image(); img6.src = buttonspathname + "btn_overons_active.jpg";
var img7 = new Image(); img7.src = buttonspathname + "btn_pakketten_active.jpg";
var img8 = new Image(); img8.src = buttonspathname + "btn_bestellen_active.jpg";
var img9 = new Image(); img9.src = buttonspathname + "btn_demoaanvragen_active.jpg";
var img10 = new Image(); img10.src = buttonspathname + "btn_testimonials_active.jpg";
var img11 = new Image(); img11.src = buttonspathname + "btn_contact_active.jpg";

function createXMLHttpRequest() // Zorgt dat AJAX werkt met explorer of andere browsers
{
	if(window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
		xmlHttp = new XMLHttpRequest();
	}
}

function changemenuItem(act, val)
{
	if(act == "in")
	{
		document.getElementById("menu_item_" + val).src =  "/imgt/menu_item_" + val + "_light.png";	
	}
	else
	{
		document.getElementById("menu_item_" + val).src =  "/imgt/menu_item_" + val + "_dark.png";	
	}
}

function changeSrc(val,nme,act)
{
	if(act == "in")
	{
		document.getElementById(val).src = "/imgt/" + nme + "_grey.jpg";	
	}
	else
	{
		document.getElementById(val).src = "/imgt/" + nme + ".jpg";
	}
}

function changepakketSrc(val,act)
{	
	if(act == "in")
	{
		document.getElementById(val).src = "/imgt/" + val + ".jpg";	
	}
	else
	{
		document.getElementById(val).src = "/imgt/" + val + "_grey.jpg";
	}
}

function changemenuSrc(val,act)
{
	if(act == "in")
	{
		document.getElementById("btn_menu_" + val).src = "/imgt/btn_" + val + "_active.jpg";	
	}
	else
	{
		document.getElementById("btn_menu_" + val).src = "/imgt/btn_" + val + ".jpg";
	}
}

function openFAQ(val)
{
	var aantal_vragen = parseInt(document.getElementById("aantal_vragen").value);
	
	for(i=0; i<aantal_vragen; i++)
	{
		document.getElementById("faq_categorie_" + i).className = "meest_gestelde_vragen_gesloten";
		document.getElementById("faq_arrow_" + i).className = "purple_arrow_right";
		document.getElementById("faq_vragen_" + i).style.display = "none";
	}
	
	document.getElementById("faq_categorie_" + val).className = "meest_gestelde_vragen_open";
	document.getElementById("faq_arrow_" + val).className = "purple_arrow_down";
	document.getElementById("faq_vragen_" + val).style.display = "block";
	
}

function checkForm_contact()
{	
	var array_checkForm = new Array();
	array_checkForm[0] = "naam";
	array_checkForm[1] = "bericht";
	array_checkForm[2] = "email";
	
	var aantal_checkForm = 3;
	var aantal_correct = 0;
	
	var email_regexp = /^[\w\-][\w\-\.]+@[\w\-][\w\-\.]+\.[a-zA-Z]{2,4}\s*$/;
	
	for(i=0;i<aantal_checkForm;i++)
	{		
		var id = array_checkForm[i];
		
		if(document.getElementById(id).value == "")
		{
			document.getElementById(id).className = "inputfield_wrong";
		}
		else
		{
			document.getElementById(id).className = "inputfield";
			aantal_correct++;
		}			
	}
	
	if(!email_regexp.test(document.getElementById("email").value))
	{
		aantal_correct = aantal_correct - 1;
		document.getElementById("email").className = "inputfield_wrong";
	}
	
	if(aantal_correct == aantal_checkForm)
	{
		//if(parseInt(document.getElementById("getal_3").value) != (parseInt(document.getElementById("getal_1").value) + parseInt(document.getElementById("getal_2").value)))
		//{
			//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
			//document.getElementById("getal_3").className = "inputfield_wrong";
			//return false;
		//}
		//else
		//{
			//return true;
		//}
		return true;
	}
	else
	{
		//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
		document.getElementById("form_foutmelding").style.display = "block";
		return false;			
	}	

}

function checkForm_demoaanvraag()
{	
	var array_checkForm = new Array();
	array_checkForm[0] = "naam";
	array_checkForm[1] = "telefoonnummer";
	array_checkForm[2] = "email";
	
	var aantal_checkForm = 3;
	var aantal_correct = 0;
	
	var email_regexp = /^[\w\-][\w\-\.]+@[\w\-][\w\-\.]+\.[a-zA-Z]{2,4}\s*$/;
	
	for(i=0;i<aantal_checkForm;i++)
	{		
		var id = array_checkForm[i];
		
		if(document.getElementById(id).value == "")
		{
			document.getElementById(id).className = "inputfield_demoaanvragen_wrong";
		}
		else
		{
			document.getElementById(id).className = "inputfield_demoaanvragen";
			aantal_correct++;
		}			
	}
	
	if(!email_regexp.test(document.getElementById("email").value))
	{
		aantal_correct = aantal_correct - 1;
		document.getElementById("email").className = "inputfield_demoaanvragen_wrong";
	}
	
	if(document.getElementById("voorwaarden").checked == false)
	{
		document.getElementById("voorwaarden_label").style.color = "#FF0033";
		aantal_correct = aantal_correct - 1;
	}
	else
	{
		document.getElementById("voorwaarden_label").style.color = "";
	}
	
	if(aantal_correct == aantal_checkForm)
	{
		//if(parseInt(document.getElementById("getal_3").value) != (parseInt(document.getElementById("getal_1").value) + parseInt(document.getElementById("getal_2").value)))
		//{
			//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
			//document.getElementById("getal_3").className = "inputfield_wrong";
			//return false;
		//}
		//else
		//{
			//return true;
		//}
		return true;
	}
	else
	{
		//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
		document.getElementById("form_foutmelding").style.display = "block";
		return false;			
	}	

}

function checkForm_bestellen()
{	
	var array_checkForm = new Array();
	array_checkForm[0] = "naam";
	array_checkForm[1] = "straat";
	array_checkForm[2] = "huisnummer";
	array_checkForm[3] = "postcode";
	array_checkForm[4] = "plaats";
	array_checkForm[5] = "telefoonnummer";
	array_checkForm[6] = "email";
	
	var aantal_checkForm = 7;
	var aantal_correct = 0;
	
	var email_regexp = /^[\w\-][\w\-\.]+@[\w\-][\w\-\.]+\.[a-zA-Z]{2,4}\s*$/;
	
	for(i=0;i<aantal_checkForm;i++)
	{		
		var id = array_checkForm[i];
		
		if(document.getElementById(id).value == "")
		{
			document.getElementById(id).className = "inputfield_demoaanvragen_wrong";
		}
		else
		{
			document.getElementById(id).className = "inputfield_demoaanvragen";
			aantal_correct++;
		}			
	}
	
	if(!email_regexp.test(document.getElementById("email").value))
	{
		aantal_correct = aantal_correct - 1;
		document.getElementById("email").className = "inputfield_demoaanvragen_wrong";
	}
	
	if(document.getElementById("voorwaarden").checked == false)
	{
		document.getElementById("voorwaarden_label").style.color = "#FF0033";
		aantal_correct = aantal_correct - 1;
	}
	else
	{
		document.getElementById("voorwaarden_label").style.color = "";
	}
	
	if(aantal_correct == aantal_checkForm)
	{
		//if(parseInt(document.getElementById("getal_3").value) != (parseInt(document.getElementById("getal_1").value) + parseInt(document.getElementById("getal_2").value)))
		//{
			//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
			//document.getElementById("getal_3").className = "inputfield_wrong";
			//return false;
		//}
		//else
		//{
			//return true;
		//}
		return true;
	}
	else
	{
		//document.getElementById("form_foutmelding").innerHTML = "De rode velden zijn verkeerd ingevuld!";
		document.getElementById("form_foutmelding").style.display = "block";
		return false;			
	}	

}

var o = nn6 ? 0.3 : 30;

function openPopup()
{	
	
	document.getElementById("div_popup_background").style.display = "block";	
	document.getElementById("div_popup_background").style.height = document.getElementById("body").clientHeight + "px";
	document.getElementById("div_popup_background").style.width = (parseInt(document.getElementById("body").clientWidth) + 1) + "px";
	
	//alert(document.getElementById("div_popup_background").style.width);
	
	var browser = nn6 ? "ff" : "ie";	
		
	if(browser == "ff")
	{
		if(o == 0.3)
		{	
			document.getElementById("div_popup_background").style.display = "block";
		}
		
		if(o < 0.9) 
		{		
			document.getElementById("div_popup_background").style.opacity = o;
			o = (Math.round(o * 10) / 10) + 0.1;			
			setTimeout("openPopup()", 5);
		}		
		
	}
	else if (browser == "ie")
	{
		if(o == 30)
		{	
			document.getElementById("div_popup_background").style.display = "block";	
		}
		
		if(o < 90) 
		{		
			document.getElementById("div_popup_background").style.filter = "alpha(opacity=" + o + ")";
			o = o + 10;
			setTimeout("openPopup()", 5);
		}		
	}
	
	document.getElementById("div_popup").style.display = "block";
}

function closePopup()
{
	document.getElementById("div_popup_background").style.display = "none";
	document.getElementById("div_popup").style.display = "none";
	o = nn6 ? 0.8 : 80;	
}

function handleStateChange_fillPopup() // controleert de dataoverdracht is dit ok, dan wordt de opdracht opgehaald
{	
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
			//alert(xmlHttp.responseText);
			document.getElementById("div_popup").innerHTML = xmlHttp.responseText;
			window.location.hash = "top_popup";
		}
	}
}

function fillPopup(act)
{	
	openPopup();
	
	if(act == "voorwaarden")
	{	
		var url_to_open = "/voorwaarden.php";
	}
	else
	{
		var url_to_open = "/privacy_voorwaarden.php";	
	}
	
	//alert(url_to_open);
	
	var queryString = "";		
	
	createXMLHttpRequest();	
	xmlHttp.open("POST", url_to_open, true);
	xmlHttp.onreadystatechange = handleStateChange_fillPopup;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
	xmlHttp.send(queryString);
	
}

function handleStateChange_openScreenshot() // controleert de dataoverdracht is dit ok, dan wordt de opdracht opgehaald
{	
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
			//alert(xmlHttp.responseText);
			document.getElementById("div_popup").innerHTML = xmlHttp.responseText;
			window.location.hash = "top_popup";
		}
	}
}

function openScreenshot(act)
{	
	openPopup();
	
	document.getElementById("div_popup").innerHTML = "<a name=\"top_popup\"></a><div id=\"closeFAQ\" class=\"purple_rain\" style=\"float: right; margin: 20px; cursor: pointer;\" onclick=\"closePopup();\">Sluiten</div><div style=\"margin-left: 20px; margin-top: 10px;\"><h1>Screenshot</h1></div><img src=\"/img/screenshots/" + act + ".jpg\" style=\"border: 1px solid #CCCCCC; margin: 0px 10px 10px 10px;\" />";
	
	/*

	var url_to_open = "/openScreen.php";	
	
	//alert(url_to_open);
	
	var queryString = "";		
	
	createXMLHttpRequest();	
	xmlHttp.open("POST", url_to_open, true);
	xmlHttp.onreadystatechange = handleStateChange_openScreenshot;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
	xmlHttp.send(queryString);
	
	*/
	
}

var opentab = 1;

function openTab(val)
{
	document.getElementById("pakket_tekst_" + opentab).style.display = "none";	
	document.getElementById("pakket_tekst_" + val).style.display = "block";	
	
	document.getElementById("tab_" + opentab).className = "tab";	
	document.getElementById("tab_" + val).className = "tab_active";	
	
	opentab = val;
}