function checkvoorraad(id, size, aantal){
	$.post("/_php/_requests/checkvoorraad.php", { id: id, maat: size, aantal: aantal},
	function(data){
		if(data == "true"){
			alert('Enkele van de door u geselecteerde artikelen zijn jammer genoeg verkocht. Uw bestelling word aangepast.');
		}
	});
}
function buildUrl(field, data){
	document.location.href = "/_php/_requests/redirect.php?"+field+"="+data;
}
function voorraadvanmaatenid(id, size){
	$('.price').addClass("hidden");
	$('#price'+size).removeClass("hidden");
	$.post("/_php/_requests/voorraadvanmaatenid.php", { id: id, maat: size },
	function(data){
		if(data == "\nuitverkocht"){
			$("select#aantal").html('<option value="0">uitverkocht</option>');
			$("#toevoegen").attr("disabled", "true");
		} else {
			$("select#aantal").html(data);
		}
	});
}

function settotaalprijs(){
	var totaal = 0;
	$('.totaalprijs').each(function (i) {
		if(!$(this).hasClass('hidden')){
			totaal = totaal+($('.voorprijs', this).html()*100);
		}
	});
	
	$('#totaalprijs').html('&euro; '+((totaal/100).toFixed(2)));
}

function voorraadvanmaatenidset(id, size){
	$('.price_'+id).addClass("hidden");
	$('#price_'+id+'_'+size).removeClass("hidden");
	$.post("/_php/_requests/voorraadvanmaatenid.php", { id: id, maat: size },
	function(data){
		if(data == "\nuitverkocht"){
			$("select#aantal").html('<option value="0">uitverkocht</option>');
			$("#toevoegen").attr("disabled", "true");
		} else {
			$("select#aantal").html(data);
		}
	});
	settotaalprijs();
}


function showC4vTip(id) {
	if (document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display= 'none';
	} else {
		document.getElementById(id).style.display= 'block';
	} 

}


function inpakker(id){


}