function addToCart(id, opties) {
	if (opties !== "") {
		var optiestring = "";
		var optiestringvalues = "";
		opties = opties.split(",");
		for (i = 0; i < opties.length; i ++) {
			var name = "optie_" + id + "_" + opties[i];
			var optie_id 		= opties[i];
			var optie_value 	= document.getElementById(name).value;
			optiestring += "&" + optie_id + "=" + optie_value;
			optiestringvalues += optie_id + "|" + optie_value;
			if (i < opties.length - 1) {
				optiestringvalues += "||";
			}
		}
		optiestring += "&optiestring=" + opties;
		optiestring += "&optiestringvalues=" + optiestringvalues;
	}
	url = "/ajax.php?ajax=toevoegenAanWinkelwagentje&product_id=" + id;
	if (optiestring) {
		url += optiestring;
	}
	ajax (url, "herladen('add')")
}

function verwijder (id) {
	url = "/ajax.php?ajax=verwijderenUitWinkelwagentje&product_id=" + id;
	ajax (url, "herladen()");
}

function herladen(action) {
	if (xmlHttp.responseText == "1") {
		var url = location.href;
		url = url.replace('?add=1', '');
		if (action) {
			url = url + '?'  + action + '=1';
		}
		location.href = url;
	} else {
		alert("Er is een fout opgetreden. Probeer het nogmaals");
	}
}

function open_aanbieding (id) {
	var url = "http://www.linnenplaza.nl/?aanbieding=" + id;
	location.href = url;
}

function afrekenen () {
	location.href = "http://www.linnenplaza.nl/besteloverzicht/";
}

function bevestigen () {
	location.href = "http://www.linnenplaza.nl/naw/";
}

function update (item, value) {
	if (value == "0" || value == "") {
		verwijder(item);
	} else {
		url = "/ajax.php?ajax=aantalUpdate&product_id=" + item + "&aantal=" + value;
		ajax (url, "herladen()");
	} 
}
