function show_cart(id)
{
kadabra('cart_overlay');
if (window.XMLHttpRequest){
  xmlhttp=new XMLHttpRequest();
  }else{
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("cart_overlay").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","/show_cart.php?id="+id,true);
xmlhttp.send();
}


function show_foto(id)
{
	kadabra('foto_overlay');
if (window.XMLHttpRequest){
  xmlhttp=new XMLHttpRequest();
  }else{
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("foto_overlay").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","/show_foto.php?id="+id,true);
xmlhttp.send();
}

function hide_cart(){
document.getElementById("cart_overlay").innerHTML= "<span style=\"position:absolute;left:50%;top:50%;margin:-23px 0 0 -65px;\">Loading<br><img src=\"/images/loading_black.gif\" width=\"129\" height=\"24\" alt=\"\"></span>";
kadabra('cart_overlay');
}

function hide_foto(){
document.getElementById("foto_overlay").innerHTML= "<span style=\"position:absolute;left:50%;top:50%;margin:-23px 0 0 -65px;\">Loading<br><img src=\"/images/loading_black.gif\" width=\"129\" height=\"24\" alt=\"\"></span>";
kadabra('foto_overlay');
}

function show_paper(){
	document.getElementById("show_afmeting").innerHTML= "<img src=\"/images/loading_black.gif\" width=\"129\" height=\"24\" alt=\"\">"
	var choice = document.bestel.product_choice.value
	var ratio = document.bestel.ratio.value
	var fotostyle = document.bestel.fotostyle.value
	if (choice == 'foto') {
		document.bestel.papier.style.display = 'block';
	} else {
		document.bestel.papier.style.display = 'none';
	}
	if (choice == 'fotobehang') {
		document.bestel.papier_2.style.display = 'block';
	} else {
		document.bestel.papier_2.style.display = 'none';
	}
	
	
	if (window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("show_afmeting").innerHTML=xmlhttp.responseText;
    }
	}
xmlhttp.open("GET","/show_price.php?product="+choice+"&ratio="+ratio+"&fotostyle="+fotostyle,true);
xmlhttp.send();
	
	
}


function check_form() {
	if ((!(document.bestel.product_choice.value == "")) && (!(document.bestel.afmeting.value == "")) && ((!(document.bestel.product_choice.value == "foto")) || ((!(document.bestel.product_choice.value == ""))))) {
		
		//       OR ((!(document.bestel.product_choice.value == "")) && (!(document.bestel.papier.value == "")))))
		if(document.bestel["submit"].disabled==true) {
			document.bestel["submit"].disabled=false;
			document.bestel["submit"].style.cursor='pointer';
			}
    	} else {
	 	document.bestel["submit"].disabled=true;
	 	document.bestel["submit"].style.cursor='no-drop';
	 	//no-drop
    	}

}

function check_adres_form() {
	if ((!(document.verzenden.naam.value == "")) && (!(document.verzenden.adres.value == ""))&& (!(document.verzenden.postcode.value == ""))&& (!(document.verzenden.plaats.value == "")) && (!(document.verzenden.mailadres.value == ""))&& (!(document.verzenden.voorwaarden.checked == false))){
		if(document.verzenden["submit"].disabled==true) {
		document.verzenden["submit"].disabled=false;
		document.verzenden["submit"].style.cursor='pointer';
		}
    } else {
	 document.verzenden["submit"].disabled=true;
	 document.verzenden["submit"].style.cursor='no-drop';
	 //no-drop
    }

}

function loading() {
document.getElementById("cart_overlay").innerHTML= "<span style=\"position:absolute;left:50%;top:50%;margin:-23px 0 0 -65px;\">Loading<br><img src=\"/images/loading_black.gif\" width=\"129\" height=\"24\" alt=\"\"></span>";	
}

function order() {
	var soort = document.bestel.product_choice.value
	var papier = document.bestel.papier.value
	var papier_2 = document.bestel.papier_2.value
	var afmeting = document.bestel.afmeting.value
	var fotonr = document.bestel.fotonr.value
	var aantal = document.bestel.aantal.value
	loading();
	if (window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
	{
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("cart_overlay").innerHTML=xmlhttp.responseText;
    }
  	}
	xmlhttp.open("GET","/show_cart.php?soort="+soort+"&papier="+papier+"&papier_2="+papier_2+"&afmeting="+afmeting+"&fotonr="+fotonr+"&aantal="+aantal,true);
	xmlhttp.send();
}

function submit_order() {
	var naam = document.verzenden.naam.value
	var adres = document.verzenden.adres.value
	var plaats = document.verzenden.plaats.value
	var postcode = document.verzenden.postcode.value
	var telefoon = document.verzenden.telefoon.value
	var mailadres = document.verzenden.mailadres.value
	var toevoeging = document.verzenden.toevoeging.value
	var voorwaarden = document.verzenden.voorwaarden.value
	loading();
	if (window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
	{
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("cart_overlay").innerHTML=xmlhttp.responseText;
    }
  	}
  
	xmlhttp.open("GET","/show_cart.php?submit=order&naam="+naam+"&adres="+adres+"&plaats="+plaats+"&postcode="+postcode+"&telefoon="+telefoon+"&mailadres="+mailadres+"&voorwaarden="+voorwaarden+"&toevoeging="+toevoeging,true);
	xmlhttp.send();
}

function update_status() {
	var new_status = document.setstatus.new_status.value
	var tnt_code = document.setstatus.tnt_code.value
	var bestel_ID = document.setstatus.bestel_ID.value
	loading();
	if (window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
	{
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("cart_overlay").innerHTML=xmlhttp.responseText;
    }
  	}
	xmlhttp.open("GET","/show_cart.php?submit=update_status&new_status="+new_status+"&tnt_code="+tnt_code+"&bestel_ID="+bestel_ID,true);
	xmlhttp.send();
}

function delete_cart(id) {
	loading();
	if (window.XMLHttpRequest){
	xmlhttp=new XMLHttpRequest();
	}else{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
	{
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
    document.getElementById("cart_overlay").innerHTML=xmlhttp.responseText;
    }
  	}
	xmlhttp.open("GET","/show_cart.php?delete="+id,true);
	xmlhttp.send();
}
