//<!--
/* <![CDATA[ */

	/*
		Copyright (c) Driessen Multimedia Productions
			
		Driessen Multimedia Productions
		http://www.driessenmultimedia.nl
	*/
	
	function addToCart(id, aantal){
		xmlHttp = false;
		
		xmlHttp = GetXmlHttpObject();
		
		if(!xmlHttp){
			alert('Er is een fout opgetreden.');
			return false;
		}
		
		var queryString = "_addtocart.php?prodid=" + id + '&aantal=' + aantal;
		
		xmlHttp.open("GET",queryString,true);
		xmlHttp.onreadystatechange = addstateChanged;
		xmlHttp.send(null);
	}
	
	function updateCart(id, aantal){
		xmlHttp = false;
		
		xmlHttp = GetXmlHttpObject();
		
		if(!xmlHttp){
			alert('Er is een fout opgetreden.');
			return false;
		}
		
		var queryString = "_updatecart.php?prodid=" + id + '&aantal=' + aantal;
		
		xmlHttp.open("GET",queryString,true);
		xmlHttp.onreadystatechange = updatestateChanged;
		xmlHttp.send(null);
		
		window.location.reload(true);
	}
	
	function deleteFromCart(id){
		xmlHttp = false;
		
		xmlHttp = GetXmlHttpObject();
		
		if(!xmlHttp){
			alert('Er is een fout opgetreden.');
			return false;
		}
		
		var queryString = "_deletefromcart.php?prodid=" + id;
		
		xmlHttp.open("GET",queryString,true);
		xmlHttp.onreadystatechange = deletestateChanged;
		xmlHttp.send(null);
		
		window.location.reload(true);
	}
	
	function GetXmlHttpObject(){
		var xmlHttp=null;
		
		try{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e){
			// Internet Explorer
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e){
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}

	function addstateChanged(){
		if(xmlHttp.readyState == 4){
			alert('Product toegevoegd aan Winkelwagen!');
			return true;
		}
	}
	
	function deletestateChanged(){
		if(xmlHttp.readyState == 4){
			//alert('Winkelwagen is gewijzigd!');
			return true;
		}
	}
	
	function updatestateChanged(){
		if(xmlHttp.readyState == 4){
			//alert('Winkelwagen is gewijzigd!');
			return true;
		}
	}


/* ]]> */
//-->
