


	//<![CDATA[
	var bOverMiniCart = false;
	var strSessionId = 'aap3vof9o1i8bi9aecgrtl71g3';
	
	function AddToCart(articleno, priceno, lang, articlename, aantal, prijs, articlealias, prijsincl, vat){
		var keeper = new sack();

		if (aantal == null || aantal == 0){
			aantal = document.getElementById("qty" + articleno + "_" + priceno).value;
		}

		if (prijs == 0 && articlealias != ""){
			prijs = document.getElementById("article_prijs_" + articlealias).value;
		}

		var oPrijsIncl = document.getElementById("article_prijs_incl_" + articlealias);				
		if (oPrijsIncl != null)
		{
			prijsincl = oPrijsIncl.value;
		}
		else
		{
			prijsincl = 0;
		}
		
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_add.php?lang="+lang+"&articleno="+articleno+"&priceno="+priceno + "&aantal="+aantal + "&prijs="+prijs + "&prijsincl="+prijsincl;
		keeper.onCompletion = function()
		{
			Modalbox.show("Mijn order", "http://www.abyz.be/shoppingcart/cartmini.php?articleno="+articleno+"&amount="+aantal+"&lang="+lang+"&articlename="+articlename+"&prijs="+prijs + "&prijsincl="+prijsincl, {width: 390, height:268, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
		};
		keeper.runAJAX();
	}

	function AddToCartHistoriek(articleno, priceno, lang, articlename, aantal, prijs, articlealias, prijsincl, vat, teller){
		var keeper = new sack();

		if (aantal == null || aantal == 0){
			aantal = document.getElementById("qty" + articleno + "_" + priceno + "_" + teller).value;
		}

		if (prijs == 0 && articlealias != ""){
			prijs = document.getElementById("article_prijs_" + articlealias + "_" + teller).value;
		}
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_add.php?lang="+lang+"&articleno="+articleno+"&priceno="+priceno + "&aantal="+aantal + "&prijs="+prijs;
		keeper.onCompletion = function()
		{
			Modalbox.show("Mijn order", "http://www.abyz.be/shoppingcart/cartmini.php?articleno="+articleno+"&amount="+aantal+"&lang="+lang+"&articlename="+articlename+"&prijs="+prijs, {width: 390, height:268, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
		};
		keeper.runAJAX();
	}

	function add2cart(o, e, var1, var2, var3, var4, var5, var6, var7, var8) {
		if (!e) var e = window.event;

		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;

		if (var6 == 1 && var7 != ""){
			var6 = document.getElementById("article_prijs_" + var7).value;
		}

		if (keycode == 13) {
			checkMinimumQty('qty' + var1 + "_" + var2, var8);
			AddToCart(var1, var2, var3, var4, var5, var6, var7);
		}
	}

	function add2carthistoriek(o, e, var1, var2, var3, var4, var5, var6, var7, var8, teller) {
		if (!e) var e = window.event;

		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;

		if (var6 == 0 && var7 != ""){
			var6 = document.getElementById("article_prijs_" + var7 + "_" + teller).value;
		}

		if (keycode == 13) {
			checkMinimumQty('qty' + var1 + "_" + var2 + "_" + teller, var8);
			AddToCartHistoriek(var1, var2, var3, var4, var5, var6, var7, var8, 21, teller);
		}
	}

	/*function AddToCartWithoutModalbox(articleno, priceno, lang, articlename, aantal, prijs, articlealias){
		var keeper = new sack();

		if (aantal == null || aantal == 0){
			aantal = document.getElementById("qty" + articleno + "_" + priceno).value;
		}

		if (prijs == 0 && articlealias != ""){
			prijs = document.getElementById("article_prijs_" + articlealias).value;
		}
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_add.php?lang="+lang+"&articleno="+articleno+"&priceno="+priceno + "&aantal="+aantal + "&prijs="+prijs;
		keeper.onCompletion = function()
		{


		};
		keeper.runAJAX();
	}*/

	function CatchOnEnterSubmitForm(e){
		if (!e) var e = window.event;

		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;

		if (keycode == 13) {
			return false;
		}
	}

	function SetFocusRefreshOnEnterBasket(e){
		if (!e) var e = window.event;

		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;

		if (keycode == 13) {
			document.getElementById("refreshhidden").focus();
			return false;
		}
	}

	function AddToCartSavedOrder(salesorderno, lang)
	{
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_addsavedorder.php?lang="+lang+"&salesorderno="+salesorderno;

		var amountarticles = document.getElementById("amountarticles_" + salesorderno).value;
		for (i = 0; i < amountarticles; i++)
		{
			var articlealias = document.getElementById("articlealias_" + salesorderno + "["+i+"]").value;
			var articleprice = document.getElementById("article_prijs_" + articlealias + "_" + salesorderno).value;

			keeper.setVar("price"+articlealias, articleprice);
		}

		keeper.onCompletion = function()
		{
			/*var out = eval ('(' + keeper.response + ')');
			var arrArticlenos = out[0].output.articleno.split(";");
			var arrPricenos = out[0].output.priceno.split(";");
			var arrArticlenames = out[0].output.name.split(";");
			var arrQuantities = out[0].output.quantity.split(";");
			var arrPrices = out[0].output.price.split(";");

			for (i = 0; i < arrArticlenos.length; i++){
				var articleno = arrArticlenos[i];
				var priceno = arrPricenos[i];
				var articlename = arrArticlenames[i].replace(" ", "_");
				var quantity = arrQuantities[i];
				var price = arrPrices[i];
				var last = "no";

				AddToCartWithoutModalbox(articleno, priceno, lang, "'"+articlename+"'", quantity, price, '');
			}*/

			document.location = "http://www.abyz.be/shoppingcart/cart.php";

		};
		keeper.runAJAX();
	}

	function ShowModalBoxWithAantal(articleno, priceno, lang, prijs, aantal, articlealias){
		if (aantal == null || aantal == 0){
			var aantal = document.getElementById("qty" + articleno + "_" + priceno).value;
		}

		if (prijs == 0 && articlealias != ""){
			prijs = document.getElementById("article_prijs_" + articlealias).value;
		}

		Modalbox.show('Mijn order', "http://www.abyz.be/shoppingcart/category_shopcar.php?lang=" + lang + "&articleno=" + articleno + "&aantal="+aantal + "&prijs="+prijs, {width: 610, height: 400,loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
	}

	function ShowModalBoxLower()
	{
		Modalbox2.show('Mijn order', 'http://www.abyz.be/shoppingcart/shopcartbox.php?lang=NL', {width: 600, height:550, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
	}

	function RemoveFromCart(articleno,priceno, lang){
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_remove.php?lang="+lang+"&articleno="+articleno+"&priceno="+priceno;
		keeper.onCompletion = function()
		{
			document.location.reload();
		};
		keeper.runAJAX();
	}

	function RemoveFromCartModalbox(articleno,priceno, lang){
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_remove.php?lang="+lang+"&articleno="+articleno+"&priceno="+priceno;
		keeper.onCompletion = function()
		{
			//document.location.reload();
			ShowModalBoxLower()
		};
		keeper.runAJAX();
	}

	function getArticlesExtra(){
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/articles_extra.php";
		keeper.onCompletion = function()
		{

		};
		keeper.runAJAX();
	}

	function HideModalbox(amount, amounttxt){
		Modalbox.hide();
		if ($('headshopcaramount') != null) $('headshopcaramount').innerHTML="bevat  <span id=\"amount\">" + amount + '<\/span> '+amounttxt;
		if ($('cart_aantal') != null){
			if (amount == 1){
				$('cart_aantal').innerHTML= amount + " artikel";
			}else{
				$('cart_aantal').innerHTML= amount + " artikels";
			}
		}
	}
	
	function HideModalbox2(){
		Modalbox2.hide();
	}
/*Nieuwe functies*16/03/2009*************************************************************************************************************/

	function HideModalbox3(amount, amounttxt){
		Modalbox.hide();
		if ($('headshopcaramount') != null) $('headshopcaramount').innerHTML="bevat <span id=\"amount\">" + amount + '<\/span> '+amounttxt;

	}

	function laatste_toegevoegd(articledesc) {
		if ($('laatste_toegevoegd_produkt') != null) $('laatste_toegevoegd_produkt').innerHTML="Laatst toegevoegde product:&nbsp;<span style=\"color:#000000;\">"+articledesc+"<\/span>";
	}
	function getMandjeHTML(){
		var obj = document.getElementById("mandje_html");
		
		if (obj != null)
		{
			var vorige_html = document.getElementById("mandje_html").innerHTML;
			$('mandje_html').innerHTML="<div>"+vorige_html+"<\div>";
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getmandjehtml.php";
			keeper.onCompletion = function(){
				$('mandje_html').innerHTML=html_entity_decode(keeper.response);
	
			};
			keeper.runAJAX();
		}
	}
	function getPagMandje(lang){
		document.location.href="http://www.abyz.be/shoppingcart/cart.php?lang="+lang;
	}
/************************************************************************************/
	function HideModalboxOverride(){
		aantal = "";
		amounttxt = "artikels";

		$('headshopcaramount').innerHTML="bevat  <span id=\"amount\">" + aantal + '<\/span> '+amounttxt;

	}

	function checkheight(outer,box,page){
		//alert (outer);
		//alert (document.getElementById(outer).offsetHeight);

		if(navigator.appName == "Microsoft Internet Explorer")
		{
			var height = document.getElementById(outer).offsetHeight;
			if(page == 'cart')
			{
				if (height < 234)
				{
					document.getElementById(outer).style.height = 234+'px';
				}
				else
				{
					if (document.getElementById(outer).offsetHeight > document.getElementById(outer).style.height)
						document.getElementById(outer).style.height = height;
				}
			}
			else if(page == 'checkoutleft')
			{
				if (height < 359)
				{
					document.getElementById(outer).style.height = 359+'px';
				}
				else
				{
					if (document.getElementById(outer).offsetHeight > document.getElementById(outer).style.height)
						document.getElementById(outer).style.height = height;
				}
			}
			else if(page == 'checkoutright')
			{
				if (height < 359)
				{
					document.getElementById(outer).style.height = 359+'px';
				}
				else
				{
					if (document.getElementById(outer).offsetHeight > document.getElementById(outer).style.height)
						document.getElementById(outer).style.height = height;
				}
			}
			else if(page == 'product')
			{
				if (height < 218)
				{
					document.getElementById(outer).style.height = 218+'px';
				}
				else
				{
					if (document.getElementById(outer).offsetHeight > document.getElementById(outer).style.height)
						document.getElementById(outer).style.height = height;
				}
			}
			else
			{
				if (height < 168)
				{
					document.getElementById(outer).style.height = 168+'px';
				}
				else
				{
					if (document.getElementById(outer).offsetHeight > document.getElementById(outer).style.height)
						document.getElementById(outer).style.height = height;
				}
			}
			//alert(document.getElementById(outer).offsetHeight);
			document.getElementById(box).style.height = document.getElementById(outer).offsetHeight;
			document.getElementById(outer).style.zIndex = 200;
			document.getElementById(outer).style.position = "relative";

		}
		else
		{
			document.getElementById(box).style.height = document.getElementById(outer).offsetHeight +"px;";
		}
	}

	function changedlevcountry(lang){
		var keeper = new sack();
		var country = document.getElementById('lev_country').value;

		keeper.requestFile = "http://www.abyz.be/shoppingcart/changelevcountry.php?lang=NL&levcountry="+country;

		keeper.onCompletion = function()
		{
			fctCheckout('recalculate', 0, lang);
		};
		keeper.runAJAX();
	}

	function CalculateTransport(totalweight, lang)
	{
		var keeper = new sack();
		if($('lev_country'))
		{
			keeper.requestFile = "http://www.abyz.be/shoppingcart/calculatetransport.php?totalweight="+totalweight+"&checkcountry="+ $('lev_country').value +"&lang="+lang;
		}
		else
		{
						keeper.requestFile = "http://www.abyz.be/shoppingcart/calculatetransport.php?totalweight="+totalweight+"&checkcountry=BE&lang="+lang;
		}
		keeper.setVar("totalvalue",($("totalvalue").value));
		keeper.onCompletion = function()
		{
			eval("var response = "+ keeper.response);
			// transport kosten aanpassen
			transport_cost = response.transport_cost;
			$('cartshipping').innerHTML = '&euro; '+transport_cost;
			if($('transportcost'))
			{
				if (transport_cost == 0 || transport_cost == '0,00')
					$('transportcost').innerHTML = 'GRATIS';
				else
					$('transportcost').innerHTML = '&euro; '+transport_cost;
			}
			calculateTotals2(transport_cost);
		};
		keeper.runAJAX();
	}

	function calculateTotals2(transport_cost)
	{
		var transportfee = parseFloat(0);
		var customstransportfee = parseFloat(0);
		var transportarticlecode = parseFloat(0);
		var totaltransportfee = parseFloat(0);
		
		var type_scenario = 2;
			
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_totalsajax.php?lang=NL";
		keeper.setVar("transport_cost",transport_cost);
		keeper.onCompletion = function()
		{
			var out = eval ('(' + keeper.response + ')');
			$('tot_carttotal').innerHTML = '&euro; '+ out[0].output.total;
			$('tot_cartsubtotal').innerHTML = '&euro; '+ out[0].output.subtotal;
			$('tot_cartvat').innerHTML = '&euro; '+ out[0].output.vat;
			if($('btm_carttotal'))
			{
				$('btm_carttotal').innerHTML = '&euro; '+ out[0].output.total;
			}
			
			if($('cart_totaal'))
			{
				$('cart_totaal').innerHTML = '&euro; '+ out[0].output.subtotal;
			}

			if($('btm_carttotalmini'))
			{
				$('btm_carttotalmini').innerHTML = '&euro; '+ out[0].output.total;
			}

			if(out[0].output.total >= 100)
			{
				$('cartshipping').innerHTML = '&euro; 0';

			}
			
			switch(type_scenario)
			{
				case 1:
					//Scenario waar er gekeken wordt naar het minimum bedrag. Eenmaal dat het totaal excl BTW lager is kan de bestelling niet verder plaats vinden
					if (parseFloat(out[0].output.subtotal.replace(".","")) < transportfee)
					{
						//Niet genoeg aangekocht=> Button "naar de kassa wijzigen"
						document.getElementById("naarkassa").innerHTML = "<span style=\"color: red;\">&nbsp;Een minimum bedrag van € 0 is vereist om de bestelling af te ronden.<\span>";
						document.getElementById("naarkassa").style.textAlign = "right";
					}else{
						var container = document.getElementById("naarkassa");
		
						if (container != null){
							container.innerHTML = "";
		
							var checkout = document.createElement('div');
							var checkoutbuttontxt = document.createElement('div');
							
							if (parseFloat(getInternetExplorerVersion()) >= 8.0 )
							{
								checkout.setAttribute("class", "checkoutbutton");
								checkoutbuttontxt.setAttribute("class", "checkoutbuttontxt");
							}
							else
							{
								checkout.setAttribute((document.all ? "className" : "class"), "checkoutbutton");
								checkoutbuttontxt.setAttribute((document.all ? "className" : "class"), "checkoutbuttontxt");							
							}
							
							//checkout.onclick = function() {document.location='order.php?lang=NL';};
							checkout.onclick = function() { saveRemark('NL')};
							checkoutbuttontxt.innerHTML = "Naar de kassa";
		
							checkout.appendChild(checkoutbuttontxt);
							container.appendChild(checkout);
						}
					}
					break;
					
				case 2:
					//Scenario waar er gekeken wordt naar het minimum bedrag. Eenmaal dat het totaal excl BTW lager is kan de bestelling doorgaan maar met een surplus dat automatisch bijgerekend wordt
					
					var container = document.getElementById("naarkassa");
					var container2 = document.getElementById("shopcarmessage");
					
					if (container != null){
						container.innerHTML = "";
						container2.innerHTML = "";
	
						var checkout = document.createElement('div');
						var checkoutbuttontxt = document.createElement('div');
						
						if (parseFloat(getInternetExplorerVersion()) >= 8.0 )
						{
							checkout.setAttribute("class", "checkoutbutton");
							checkoutbuttontxt.setAttribute("class", "checkoutbuttontxt");							
						}
						else
						{
							checkout.setAttribute((document.all ? "className" : "class"), "checkoutbutton");
							checkoutbuttontxt.setAttribute((document.all ? "className" : "class"), "checkoutbuttontxt");
						}
						//checkout.onclick = function() {document.location='order.php?lang=NL';};
						
						checkoutbuttontxt.innerHTML = "Naar de kassa";
	
						checkout.appendChild(checkoutbuttontxt);
						container.appendChild(checkout);
						
						if (parseFloat(out[0].output.subtotal.replace(".","")) < transportfee)
						{
							container2.innerHTML += "<br/>Een minimum bedrag van € 0 is vereist om de bestelling af te ronden.";
							container2.innerHTML += "<br/>Een transport- & administratiekost van &euro;0 wordt bij het verder bestellen aangerekend.";
							container2.style.textAlign = "right";
							container2.style.color = "red";
							
							checkout.onclick = function() {addAdminTransKost();};
						}else{
							container2.innerHTML = "";
							
							checkout.onclick = function() {saveRemark('NL');};
						}
					}
						
					break;
			}
		};
		keeper.runAJAX();
	}

	function addAdminTransKost(){
		var keeper = new sack();
		
		keeper.requestFile = "http://www.abyz.be/shoppingcart/addwebservicetranscost.php";

		keeper.onCompletion = function()
		{
			saveRemark('NL');
		};
		keeper.runAJAX();
	}
	
	function fctCheckout(action, totalweight, lang)
	{
		if($('promocode'))
		{
			if($('promocode').value != "")
			{
				promocode = $('promocode').value
				var keeper1 = new sack();
				keeper1.requestFile = "http://www.abyz.be/shoppingcart/cart_setpromo.php?lang="+lang+"&promocode="+promocode;
				keeper1.onCompletion = function()
				{
					eval("var response1 = "+ keeper1.response);
					if (response1.promovalue != "0,00")
					{
						$('cartdiscount').innerHTML = "- &euro; "+response1.promovalue;
						$('discountcontainer').style.display = 'block';
						$('discounterror').innerHTML = html_entity_decode(response1.promodesc);
						$('discounterror').style.color = 'green';
					}
					else
					{
						$('discounterror').style.color = 'red';
						$('discounterror').innerHTML = html_entity_decode(response1.promoerror);
						$('promocode').value = '';
					}
				};
				keeper1.runAJAX();
			}
			else
			{
				var keeper1 = new sack();
				keeper1.requestFile = "http://www.abyz.be/shoppingcart/cart_resetpromo.php";
				keeper1.onCompletion = function()
				{
					$('cartdiscount').innerHTML = "";
					$('discountcontainer').style.display = 'none';
				};
				keeper1.runAJAX();
			}
		}
		CalculateTransport(totalweight, lang);
	}

	function fctConfirmation(totalweight, lang, promocode)
	{
		if(promocode > "")
		{
			var keeper1 = new sack();
			keeper1.requestFile = "http://www.abyz.be/shoppingcart/cart_setpromo.php?lang="+lang+"&promocode="+promocode;
			keeper1.onCompletion = function()
			{
				eval("var response1 = "+ keeper1.response);
				$('cartdiscount').innerHTML = "- &euro; "+response1.promovalue;
				$('discountcontainer').style.display = 'block';
			};
			keeper1.runAJAX();
		}
		CalculateTransport(totalweight, lang);
	}

	function calculatetotprice(elem,wrap)
	{	//alert(elem+" "+wrap);
		var obj = document.getElementById('qty'+elem);
		var objvalue = parseInt(obj.value);
		var totalfield = "articletotal"+elem+"";
		var packedfield = "packed"+elem+"";
		if (document.getElementById(packedfield).checked)
			packed = "Y";
		else
			packed = "N";

		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/shoppingcart/calculateprice.php?article="+elem+"&qty="+objvalue+"&packed="+packed+"&wrapid="+wrap;
		keeper.onCompletion = function()
		{
			var out = eval ('(' + keeper.response + ')');

			document.getElementById(totalfield).innerHTML = '&euro; '+ out[0].output.totalprice;
		};
		keeper.runAJAX();

		return true;
	}

	function raiseValue(elem, weight, totalval, manual, verkoopsverpakking)
	{
		//alert(document.getElementById('qty'+elem).value);
		var obj = document.getElementById('qty'+elem);
		var objvalue = parseInt(obj.value);

		if (isNaN(objvalue))
		{
			obj.value = '1';
		}
		else
		{
			//console.log('Stap 1');

			if (verkoopsverpakking > 1)
			{
				var modulo = objvalue % verkoopsverpakking;

				if (modulo == 0)
				{
					if (manual == true)
					{
						var objnewvalue = objvalue;
					}
					else
					{
						var objnewvalue = objvalue + verkoopsverpakking;
					}

					//console.log('Stap 2 - ' + objnewvalue);
				}
				else
				{
					//Dichtsbijzijnd veelvoud zoeken
					if (objvalue < verkoopsverpakking)
					{
						var objnewvalue = verkoopsverpakking;
					}
					else
					{
						var eenheid = Math.floor(objvalue / verkoopsverpakking);
						var objnewvalue = (eenheid * verkoopsverpakking) + verkoopsverpakking;
					}

					//console.log('Stap 3 - ' + objnewvalue);
				}
			}
			else
			{
				if (manual == true)
				{
					var objnewvalue = objvalue;
				}
				else
				{
					var objnewvalue = objvalue + parseInt(verkoopsverpakking);
				}

				//console.log('Stap 4 - ' + objnewvalue);
			}

			obj.value = objnewvalue + '';

			//console.log('Stap 5 - ' + obj.value);
		}

		wrap = document.getElementById('packed'+elem+'').value;
		//alert(wrap);
		calculatetotprice(elem,wrap);
		//calculateTotals()
		var totalweight = parseFloat($('totalweight').value);
		var totalvalue = parseFloat($('totalvalue').value);
		$('totalweight').value = totalweight + parseFloat(weight);
		$('totalvalue').value = totalvalue + parseFloat(totalval);
		//alert("step"+parseFloat(totalval));
		//alert($('totalweight').value);
		//CalculateTransport($('totalweight').value,'NL');
		saveQty(elem,obj.value);
		fctCheckout('recalculate',$('totalweight').value,'NL');
	}

	function raiseValueNormal(elem, verkoopsverpakking)
	{
		var obj = document.getElementById(elem);
		var objvalue = parseInt(obj.value);

		if(isNaN(objvalue))
		{
			obj.value = '1';
		}
		else
		{
			var modulo = objvalue % verkoopsverpakking;

			if (modulo == 0){
				var objnewvalue = objvalue + verkoopsverpakking;
			}else{
				//Dichtsbijzijnd veelvoud zoeken
				if (objvalue < verkoopsverpakking){
					var objnewvalue = verkoopsverpakking;
				}else{
					var eenheid = Math.floor(objvalue / verkoopsverpakking);
					var objnewvalue = (eenheid * verkoopsverpakking) + verkoopsverpakking;
				}
			}

			obj.value = objnewvalue + '';
		}
	}

	function decreaseValueNormal(elem, verkoopsverpakking)
	{
		var obj = document.getElementById(elem);
		var objvalue = parseInt(obj.value);
		if(objvalue > verkoopsverpakking)
		{
			var modulo = objvalue % verkoopsverpakking;

			if (modulo == 0){
				var objnewvalue = objvalue - verkoopsverpakking;
			}else{
				//Dichtsbijzijnd veelvoud zoeken
				if (objvalue < verkoopsverpakking){
					var objnewvalue = verkoopsverpakking;
				}else{
					var eenheid = Math.floor(objvalue / verkoopsverpakking);
					var objnewvalue = (eenheid * verkoopsverpakking);
				}
			}

			obj.value = objnewvalue + '';
		}
		else
		{
			obj.value=verkoopsverpakking;
		}
	}

	function checkMinimumQty(elem, verkoopsverpakking){
		//Controleren ofdat de ingevoerde hoeveelheid een veelvoud is van de verkoopsverpakking
		var obj = document.getElementById(elem);
		var objvalue = obj.value;

		//Controleren ofdat de invoer numeriek is
		if (IsNumericNonDecimal(objvalue) == false){
			obj.value = verkoopsverpakking;
		}else{
			var modulo = objvalue % verkoopsverpakking;

			if (modulo != 0){
				//Geen veelvoud
				//Dichtsbijzijnd veelvoud zoeken
				if (objvalue < verkoopsverpakking){
					var objnewvalue = verkoopsverpakking;
				}else{
					var eenheid = Math.floor(objvalue / verkoopsverpakking);
					if (modulo > (verkoopsverpakking/2))
					{
						var objnewvalue = ((eenheid + 1) * verkoopsverpakking);
					}
					else
					{
						var objnewvalue = (eenheid * verkoopsverpakking);
					}
				}

				obj.value = objnewvalue;
			}
		}
	}

	function decreaseValue(elem, weight, totalval, verkoopsverpakking)
	{
		var obj = document.getElementById('qty'+elem);
		var objvalue = parseInt(obj.value);

		if(isNaN(objvalue))
		{
			obj.value = '1';
		}
		else
		{
			if(objvalue > verkoopsverpakking)
			{
				var modulo = objvalue % verkoopsverpakking;

				if (modulo == 0){
					var objnewvalue = objvalue - verkoopsverpakking;
				}else{
					//Dichtsbijzijnd veelvoud zoeken
					if (objvalue < verkoopsverpakking){
						var objnewvalue = verkoopsverpakking;
					}else{
						var eenheid = Math.floor(objvalue / verkoopsverpakking);
						var objnewvalue = (eenheid * verkoopsverpakking);
					}
				}

				obj.value = objnewvalue + '';
			}
			else
			{
				obj.value= verkoopsverpakking;
			}
		}

		wrap = document.getElementById('packed'+elem+'').value;
		calculatetotprice(elem,wrap);
		//calculateTotals()
		var totalweight = parseFloat($('totalweight').value);
		var totalvalue = parseFloat($('totalvalue').value);
		$('totalweight').value = totalweight - parseFloat(weight);
		$('totalvalue').value = totalvalue - parseFloat(totalval);
		//alert($('totalweight').value);
		//CalculateTransport($('totalweight').value,'NL');
		saveQty(elem,obj.value);
		fctCheckout('recalculate',$('totalweight').value,'NL');
	}

	function saveQty(elem,qty)
	{
		var split = elem.split("_");
		var articleno = split[0];
		var priceno = split[1];
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_updqtyajax.php?lang=NL&articleno="+articleno+"&priceno="+priceno+"&qty="+qty;
		keeper.onCompletion = function(){EditRightAmount();};
		keeper.runAJAX();
	}

	function choosepaper(elem)
	{
		var packedfield = "packed"+elem+"";
		var choosepaperfield = "choosepaper"+elem+"";
		var wrappricefield = "wrapprice"+elem+"";
		var split = elem.split("_");
		var prod = split[0];
		var price = split[1];
		var wrapid = document.getElementById(packedfield).value;
		if (document.getElementById(packedfield).checked)
		{
			document.getElementById(packedfield).checked = false;
			Modalbox.show('Kies Verpakpapier', 'http://www.abyz.be/shoppingcart/choosepaper.php?lang=NL&sel='+wrapid+'&prod='+prod+'&price='+price, {width: 500, height: 360,loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
		}
		else
		{
			document.getElementById(choosepaperfield).innerHTML = "";
			document.getElementById(wrappricefield).innerHTML = "";
			document.getElementById(packedfield).value = 0;
			if(calculatetotprice(elem,0))
			{
				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_removewrap.php?lang=NL&articleno="+prod+"&priceno="+price;
				//keeper.onCompletion = function(){calculateTotals();};
				keeper.onCompletion = function(){CalculateTransport($('totalweight').value, 'NL')};
				keeper.runAJAX();
			}
		}
	}

	function textCounter(field, countfield, checkfield, maxlimit)
	{
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
		else
			countfield.value = maxlimit - field.value.length;

		if (field.value.length > 0)
			checkfield.checked = true;
		else
			checkfield.checked = false;
	}

	function checkSubmit(radioObj,elem, complete)
	{
		if(!radioObj)
			return;
		var radioLength = radioObj.length;
		var dosubmit = false;
		var wrap = 0;
		for(var i = 0; i < radioLength; i++)
		{
			if (radioObj[i].checked == true)
			{
				dosubmit = true;
				wrap = radioObj[i].value;
			}
		}
		if (dosubmit)
		{
			if(complete == "yes") // verpak complete bestelling
			{
				var articleno = "";
				var priceno = "";
				var wraptext = document.getElementById('text').value;
				var packedfield = "packedcomplete";
			}
			else // verpak 1 product
			{
				var split = elem.split("_");
				var articleno = split[0];
				var priceno = split[1];
				var wraptext = document.getElementById('text').value;
				var packedfield = "packed"+elem+"";
			}
			var atlproducts = 0;
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_addajax.php?lang=NL&complete="+complete+"&articleno="+articleno+"&priceno="+priceno+"&wrap="+wrap+"&wraptext="+wraptext;
			keeper.onCompletion = function()
			{
				var out = eval ('(' + keeper.response + ')');
				price = out[0].output.price;
				wrapid = out[0].output.priceno;
				var atlproducts = out[0].output.atlproducts;

				if(complete == "yes") // compleet verpakt
				{
					$('wrappricecomplete').innerHTML = '&nbsp;(&euro; '+price+')';
					$('choosepapercomplete').innerHTML = '<span style="cursor:pointer; text-decoration: underline;" onclick="Modalbox.show(\'Kies Verpakpapier\', \''+'http://www.abyz.be/shoppingcart/choosepaper.php?lang=NL&complete=yes&sel='+wrap+'&prod='+articleno+'&price='+priceno+'\', {width: 500, height: 360,loadingString:\'Initialiseren\', closeString:\'Sluiten\',overlayClose:true});">Wijzig papier<\/span>';
					$('packedcomplete').value = wrap;

					// de producten uit het winkelmandje aflopen
					for(var i=1;i<=atlproducts;i++)
					{
						// de checkboxen verpakking per product niet meer tonen
						$('productwrap'+i).style.display = 'none';
						//alert($('id'+i).value);
						// de totaal prijs per product opnieuw uitrekenen (als het product verpakt was, moet die prijs weer afgetrokken worden)
						calculatetotprice($('id'+i).value);
						// de wrapprijs die eventueel getoond werd per product leegmaken
						$('wrapprice'+$('id'+i).value).innerHTML = ""
					}
				}
				else
				{
					$('wrapprice'+elem+'').innerHTML = '&euro; '+price;
					$('choosepaper'+elem+'').innerHTML = '<span style="cursor:pointer; text-decoration: underline;" onclick="Modalbox.show(\'Kies Verpakpapier\', \''+'http://www.abyz.be/shoppingcart/choosepaper.php?lang=NL&sel='+wrap+'&prod='+articleno+'&price='+priceno+'\', {width: 500, height: 360,loadingString:\'Initialiseren\', closeString:\'Sluiten\',overlayClose:true});">Wijzig papier<\/span>';
					$('packed'+elem+'').value = wrap;
				}
			};
			keeper.runAJAX();
			document.getElementById(packedfield).checked = true;
			Modalbox.hide();
			if(complete == "yes")
			{

			}
			else
			{
				calculatetotprice(elem,wrap); // subtotalen per lijn (product) aanpassen
			}
			//calculateTotals()
			CalculateTransport($('totalweight').value, 'NL')
		}
		else
			alert("U moet een papiersoort kiezen !!!");
	}

	function choosepapercomplete()
	{
		var packedfield = "packedcomplete";
		var choosepaperfield = "choosepapercomplete";
		var wrappricefield = "wrappricecomplete";
		/*var split = elem.split("_");
		var prod = split[0];
		var price = split[1];*/
		var wrapid = document.getElementById(packedfield).value;
		if (document.getElementById(packedfield).checked)
		{
			document.getElementById(packedfield).checked = false;
			Modalbox.show('Kies Verpakpapier', 'http://www.abyz.be/shoppingcart/choosepaper.php?lang=NL&complete=yes&sel='+wrapid, {width: 500, height: 360,loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
		}
		else
		{
			document.getElementById(choosepaperfield).innerHTML = "";
			document.getElementById(wrappricefield).innerHTML = "";
			document.getElementById(packedfield).value = 0;
			//alert(document.getElementById(packedfield).checked);
			if(document.getElementById(packedfield).checked == false)
			{
				//alert('yes');
				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_removewrap.php?lang=NL&complete=yes&articleno=&priceno=";
				keeper.onCompletion = function(){
					var out = eval ('(' + keeper.response + ')');
					var atlproducts = out[0].output.atlproducts;
					// de checkboxen verpakking per product weer tonen
					for(var i=1;i<=atlproducts;i++)
					{
						$('productwrap'+i).style.display = 'block';
						calculatetotprice($('id'+i).value);
						// de wrapprijs die eventueel getoond werd terug tonen
						$('packed' + $('id' + i).value).checked = false;
						$('wrapprice'+$('id'+i).value).innerHTML = ""
						$('choosepaper'+$('id'+i).value).innerHTML = ""
					}
					CalculateTransport($('totalweight').value, 'NL')
				};
				keeper.runAJAX();
			}
			/*if(calculatetotprice('complete',0))
			{
				var keeper = new sack();
				keeper.requestFile="cart_removewrap.php?lang=NL&articleno="+prod+"&priceno="+price;
				//keeper.onCompletion = function(){calculateTotals();};
				keeper.onCompletion = function(){CalculateTransport($('totalweight').value, 'NL')};
				keeper.runAJAX();
			}*/
		}
	}

	function setCheckedValue(radioObj, newValue)
	{
		if(!radioObj)
			return;
		var radioLength = radioObj.length;
		if(radioLength == undefined)
		{
			radioObj.checked = (radioObj.value == newValue.toString());
			return;
		}
		for(var i = 0; i < radioLength; i++)
		{
			elem = i+1;
			radioObj[i].checked = false;
			if(radioObj[i].value == newValue.toString())
			{
				//alert(radioObj[i]);
				radioObj[i].checked = true;
				document.getElementById(radioObj[i].value).setAttribute("class","choosepaperimgselect")
				document.getElementById(radioObj[i].value).setAttribute("className","choosepaperimgselect")
			}
			else
			{
				//alert(radioObj[i]);
				document.getElementById(radioObj[i].value).setAttribute("class","choosepaperimg")
				document.getElementById(radioObj[i].value).setAttribute("className","choosepaperimg")
			}
		}
	}

	function SetFormVisibility(step,visibility)
	{
		var show;
		if(visibility=='hidden')
		{
			show='none';
		}
		else
		{
			show='block';
		}

		// dit kopieren

		$('guestcheckout').style.display = 'none';
		$('logincheckout').style.display = 'none';
		$('passforgottencheckout').style.display = 'none';
		$('btnnext1a').style.display = 'none';
		$('btnnext1b').style.display = 'none';
		$('btnnext1c').style.display = 'none';

		if(step == '1a')
		{
			$('guestcheckout').style.display = show;
			$('btnnext1a').style.display = show;
		}
		else if(step == '1b')
		{
			$('logincheckout').style.display = show;
			$('btnnext1b').style.display = show;
		}
		else if(step == '1c')
		{
			$('passforgottencheckout').style.display = show;
			$('btnnext1c').style.display = show;
		}
		else if(step == '1ae')
		{
			$('step1complete').innerHTML = '<div class="checkoutcompletetxt"><\/div><div class="floatleft"><\/div>';
			$('step1complete').className = 'checkoutnotcompleted';
			$('guestcheckout').style.display = show;
			$('btnnext1a').style.display = show;
		}
		else if(step == '1be')
		{
			$('step1complete').innerHTML = '<div class="checkoutcompletetxt"><\/div><div class="floatleft"><\/div>';
			$('step1complete').className = 'checkoutnotcompleted';
			$('logincheckout').style.display = show;
			$('btnnext1b').style.display = show;
		}
		else if(step == '1')
		{
			if(show == 'block')
			{
				$('checksignin').style.display = 'none';
				$('labelemail').className = '';
				$('inputemail').className = 'inputmedium3';
				$('step1complete').innerHTML = '<div class="checkoutcompletetxt">Volledig<\/div><div class="floatleft"><img src="'+'http://www.abyz.be/'+'images/complete.gif" alt="" title=""><\/div>';
				$('step1complete').className = 'checkoutcompleted';
				$('btnnext1b').style.display = 'none';
				$('checkfacturation').style.display = show;
			}
			else
			{
				$('labelemail').className = '';
				$('inputemail').className = 'inputmedium3';
				$('error-email').style.display = 'none';
				$('error-password').style.display = 'block';
				$('labelpassword').className = 'error';
				$('inputpassword').className = 'inputmedium5_error';
			}
		}
		else if(step == '2')
		{
			$('facturationsummary').style.display = show;
			$('step2complete').innerHTML = '<div class="checkoutcompletetxt">Volledig<\/div><div class="floatleft"><img src="'+'http://www.abyz.be/'+'images/complete.gif" alt="" title=""><\/div>';
			$('step2complete').className = 'checkoutcompleted';
			$('btnnext2').style.display = 'none';
			$('checkfacturation').style.display = 'none';
			$('checkshipping').style.display = show;
		}
		else if(step == '3a')
		{
			$('checklevdata').style.display = show;
		}
		else if(step == '3b')
		{
			$('shippingsummary').style.display = show;
			$('step3complete').innerHTML = '<div class="checkoutcompletetxt">Volledig<\/div><div class="floatleft"><img src="'+'http://www.abyz.be/'+'images/complete.gif" alt="" title=""><\/div>';
			$('step3complete').className = 'checkoutcompleted';
			$('btnnext3').style.display = 'none';
			$('checkshipping').style.display = 'none';
			$('checkpayment').style.display = show;
		}
		else
		{
			$('paymentsummary').style.display = show;
			$('step4complete').innerHTML = '<div class="checkoutcompletetxt">Volledig<\/div><div class="floatleft"><img src="'+'http://www.abyz.be/'+'images/complete.gif" alt="" title=""><\/div>';
			$('step4complete').className = 'checkoutcompleted';
			$('btnnext4').style.display = 'none';
			$('checkpayment').style.display = 'none';
			$('orderbtn').style.display =show;
		}
	}

	function CheckRadiobutton(radio)
	{
		if(document.getElementById(radio).checked)
		{
			document.getElementById(radio).checked=false;
		}
		else
		{
			document.getElementById(radio).checked=true;
		}
	}

	function ValidateForm()
	{
		var conderror = "false";
		if(show_algemenevoorwaarden == "Y")
		{
			//alert($('acceptcond').checked);
			// checken of de checkbox voor de voorwaarden op 'checked' staat
			if($('acceptcond').checked === false)
			{
				$('cond_error_empty').style.display = 'inline';
				conderror = "true";
			}
			else
			{
				$('cond_error_empty').style.display = 'none';
			}
		}

		if(conderror == "false")
		{

			var retval_lev = CheckFormValid('lev');
			var retval_fac = true;
			var levaddrr = '0';
			var salesorderno = '0';
			if (!$('fac_lev').checked)
			{
				retval_fac = CheckFormValid('fac');
				levaddrr = '1';
			}
			if(retval_fac && retval_lev)
			{
				document.documentElement.scrollTop = 0;
		//		$('ajax_update').hide();
		//		$('ajax_update_status').className = 'ajax-waiting';
				$('ajax_update').style.display = 'none';
				$('checkfacturation').style.display = 'none';
				$('ordercartcontainer').style.display = 'none';
				//$('levering-box').style.display = 'none';
				$('orderbtn').style.display = 'none';


				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/validateform.php";
				keeper.setVar("lev_country",$('lev_country').value);
				keeper.setVar("lev_titleno",$('lev_titleno').value);
				keeper.setVar("lev_firstname", $('lev_firstname').value);
				keeper.setVar("lev_lastname",$('lev_lastname').value);
				keeper.setVar("lev_address",$('lev_address').value);
				keeper.setVar("lev_city",$('lev_city').value);
				keeper.setVar("lev_zipcode",$('lev_zipcode').value);
				keeper.setVar("lev_diff",levaddrr);
				
				/*keeper.setVar("lev_deliveryyear",$('deliveryyear').value);
				keeper.setVar("lev_deliverymonth",$('deliverymonth').value);
				keeper.setVar("lev_deliveryday",$('deliveryday').value);*/
				
				keeper.setVar("fac_country",$('fac_country').value);
				keeper.setVar("fac_titleno",$('fac_titleno').value);
				keeper.setVar("fac_firstname",$('fac_firstname').value);
				keeper.setVar("fac_lastname",$('fac_lastname').value);
				keeper.setVar("fac_address",$('fac_address').value);
				keeper.setVar("fac_city",$('fac_city').value);
				keeper.setVar("fac_zipcode",$('fac_zipcode').value);
				keeper.setVar("fac_phone",$('fac_phone').value);
				keeper.setVar("fac_mobile",$('fac_mobile').value);
				keeper.setVar("fac_email2",$('fac_email2').value);
				keeper.setVar("fac_remarks",$('fac_remarks').value);
				keeper.setVar("fac_referentie",$('fac_referentie').value);
				keeper.setVar("email",$('fac_email').value);
				keeper.setVar("guestemail",$('guest_email').value);
				keeper.setVar("password",$('password_0').value);

				//keeper.setVar("paymentmethod",$('paymentmethod').value);

				for(var i=1;i<6;i++)
				{
					if($('pay'+i))
					{
						if($('pay'+i).checked)
						{
							keeper.setVar("paymentmethod",$('pay'+i).value);
						}
					}
				}

				keeper.onCompletion = function()
				{

		//			document.location = path+"sendorder.php?sales="+keeper.response+"&lang=NL";
					document.location = "http://www.abyz.be/shoppingcart/sendorder.php?lang=NL";
				};
				keeper.runAJAX();
			}
		}
	}

	function CheckFormValid(pref)
	{
		var arr = new Array();
		arr = ['firstname', 'lastname', 'address', 'city', 'zipcode'];
		var retval = true;
		for (var i = 0;i < arr.length;i++)
		{
			var fld = arr[i];
			//fld2 = fld;
			//if (pref == 'lev') fld2 += '2';
	/*
			if( i < arr.length - 1)
			{
				if (!CheckForEmpty($(pref + '_' + fld).value, $('fac_error_empty'), (pref + '_' + fld), 'medium')) retval = false;
			}
			else
			{
				if (!CheckForEmpty($(pref + '_' + fld).value, $('fac_error_empty'), (pref + '_' + fld), 'short')) retval = false;
			}
			*/
		}
		return retval;
	}

	function CheckForEmpty(valuestr, element, obj, length)
	{
		//alert(valuestr+"-"+element+"-"+obj+"-"+length);
		if(valuestr == "")
		{
			if(obj != "")
			{
				$('label'+obj).className = 'error';
				$('input'+obj).className = 'input'+length+'_error';
				$(element).style.display = 'inline';
			}
			return false;
		}
		else
		{
			//alert('no');
			if(obj != "")
			{
				$('label'+obj).className = '';
				$('input'+obj).className = 'input'+length;
				$(element).style.display = 'none';
			}
			return true;
		}
	}

	function CheckForEmptyTop(valuestr, element, obj, length)
	{
		//alert(valuestr+"-"+element+"-"+obj+"-"+length);
		if(valuestr == "")
		{
			if(obj != "")
			{
				$('label'+obj).className = 'error';
				$('input'+obj).className = 'input'+length+'_error';
				$(element).style.display = 'block';
			}
			return false;
		}
		else
		{
			if(obj != "")
			{
				$('label'+obj).className = '';
				$('input'+obj).className = 'input'+length;
				$(element).style.display = 'none';
			}
			return true;
		}
	}

	function CheckPasswordAccount(username, password, bIngelogd)
	{
		var empty = "no";

		if(!CheckForEmptyTop(username, $('emptyerror-email'), 'email', 'medium3'))
		{
			// hier is het veld e-mail leeg ( alles wordt gedaan in de functie checkforempty )
			empty = "yes";
		}


		if(!CheckForEmptyTop(password, $('emptyerror-password'), 'password', 'medium5'))
		{
			// hier is het veld e-mail leeg ( alles wordt gedaan in de functie checkforempty )
			empty = "yes";
		}

		//alert(empty);
		if(empty == "no")
		{
			/*if(!valid_email(email))
			{
				$('error-email').style.display = 'block';
				SetFormVisibility('1be','visible');
				//$('password-box').style.display = 'none';
				$('labelemail').className = 'error';
				$('inputemail').className = 'inputmedium3_error';
			}
			else
			{*/
				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/getclientdata.php";
				keeper.setVar("email",username);
				keeper.setVar("password",password);

				keeper.onCompletion = function()
				{
					eval("var response = "+ keeper.response);
					//alert(response.status);
					if(response.status)//password ok
					{
						$('labelpassword').className = '';
						$('inputpassword').className = 'inputmedium5';

						$('fac_country').value = response.fac_country;
						$('fac_firstname').value = response.fac_firstname;
						$('fac_lastname').value = response.fac_lastname;
						$('fac_address').value = response.fac_address;
						$('fac_city').value = response.fac_city;
						$('fac_zipcode').value = response.fac_zipcode;
						$('fac_titleno').value = response.fac_titleno;
						$('fac_phone').value = response.fac_phone;
						$('fac_mobile').value = response.fac_mobile;
						$('fac_email2').value = response.fac_email;

						$('signinsummary').style.display = 'block';
						$('guestsummary').style.display = 'none';
						SetFormVisibility('1','visible');
						$('error-password').style.display = 'none';
						$('signinsummary').innerHTML += "'"+username+"'.";

						//Onderstaand KAN voor andere shops anders zijn
						
						if (bIngelogd == "N"){
							$('ingelogdegebruiker').innerHTML = " <span>" + response.fac_username + " (<a href='http://www.abyz.be/profile.php?lang=NL'>Mijn profiel<\/a>)<\/span>";
						}

						if ($('login') != null) $('login').style.display = 'none';
						if ($('logout') != null) $('logout').style.display = 'block';
					}
					else//password not ok
					{
						$('error-email').style.display = 'none';
						$('error-password').style.display = 'block';
						$('labelpassword').className = 'error';
						$('inputpassword').className = 'inputmedium5_error';
						SetFormVisibility('1be','visible');
					}
				};
				keeper.runAJAX();
			//}

		}
	}

	function remindPassword(email)
	{
		var empty = "no";

		if(!CheckForEmpty(email, $('emptyerror-forgotemail'), 'forgotemail', 'medium4'))
		{
			// hier is het veld e-mail leeg ( alles wordt gedaan in de functie checkforempty )
			empty = "yes";
		}
		if(empty == "no")
		{
			if(!valid_email(email))
			{
				$('error-forgotemail').style.display = 'block';
				SetFormVisibility('1ce','visible');
				$('labelforgotemail').className = 'error';
				$('inputforgotemail').className = 'inputmedium4_error';
			}
			else
			{
				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/passwordremindercheckout.php?lang=NL";
				keeper.setVar("email",email);
				keeper.onCompletion = function()
				{
					//alert(keeper.response);
					if(keeper.response == "OK") //password sent
					{
						$('labelforgotemail').className = '';
						$('inputforgotemail').className = 'inputmedium4';
						$('success-forgotemail').style.display = 'block';
						$('signinsummary').style.display = 'none';
						$('guestsummary').style.display = 'none';
						$('error-forgotemail').style.display = 'none';
						$('error2-forgotemail').style.display = 'none';
					}
					else //password not sent
					{
						$('error-email').style.display = 'none';
						$('error2-forgotemail').style.display = 'block';
						$('labelforgotemail').className = 'error';
						$('inputforgotemail').className = 'inputmedium4_error';
						SetFormVisibility('1ce','visible');
					}
				};
				keeper.runAJAX();
			}

		}
	}

	function CheckAccount(email)
	{
		//alert("start");
		var empty = "no";

		if(!CheckForEmpty(email, $('emptyerror-guestemail'), 'guestemail', 'medium4'))
		{
			// hier is het veld e-mail leeg ( alles wordt gedaan in de functie checkforempty )
			empty = "yes";
		}
		//alert(empty);
		if(empty == "no")
		{
			if(!valid_email(email))
			{
				$('error-guestemail').style.display = 'block';
				SetFormVisibility('1ae','visible');
				$('labelguestemail').className = 'error';
				$('inputguestemail').className = 'inputmedium4_error';
			}
			else
			{
				$('labelguestemail').className = '';
				$('inputguestemail').className = 'inputmedium3';
				$('step1complete').innerHTML = '<div class="checkoutcompletetxt">Volledig<\/div><div class="floatleft"><img src="'+'http://www.abyz.be/'+'images/complete.gif" alt="" title=""><\/div>';
				$('step1complete').className = 'checkoutcompleted';
				$('guestcheckout').style.display = 'none';

				$('signinsummary').style.display = 'none';
				$('guestsummary').style.display = 'block';
				SetFormVisibility('1','visible');
				$('guestsummary').innerHTML += "'"+email+"'.";

			}

		}
	}

	function valid_email(email) {
	 	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
	 	return emailRe.test(email);
	}

	function CheckFacData(lang)
	{
		var empty = "no";
		
		if(!CheckForEmpty($('fac_lastname').value, $('fac_error_empty'), 'fac_lastname', 'medium'))
		{
			empty = "yes";
		}
		if(!CheckForEmpty($('fac_firstname').value, $('fac_error_empty'), 'fac_firstname', 'medium'))
		{
			empty = "yes";
		}
		if(!CheckForEmpty($('fac_address').value, $('fac_error_empty'), 'fac_address', 'medium'))
		{
			empty = "yes";
		}
		if(!CheckForEmpty($('fac_zipcode').value, $('fac_error_empty'), 'fac_zipcode', 'short'))
		{
			empty = "yes";
		}
		if(!CheckForEmpty($('fac_city').value, $('fac_error_empty'), 'fac_city', 'medium'))
		{
			empty = "yes";
		}

		if(!valid_email($('fac_email2').value))
		{
			$('inputfac_email').className = 'inputmedium_error';
									
			empty = "yes";
		}else{
			$('inputfac_email').className = 'inputmedium';
		}
		
		if(empty == "no")
		{
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getcountry.php?lang="+lang; // naam van land ophalen
			keeper.setVar("countrycode",$('fac_country').value);
			keeper.onCompletion = function()
			{
				eval("var response = "+ keeper.response);
				//alert(response.countryname);
				$('facturationsummary').innerHTML = $('fac_firstname').value+" "+$('fac_lastname').value+
				"<br>" + $('fac_address').value + "<br>" + $('fac_zipcode').value + " " + $('fac_city').value+
				"<br>" + response.countryname;
			};
			keeper.runAJAX();
		}

		if(empty == "yes")
		{
			$('fac_error_empty').style.display = '';
		}
		else
		{
			SetFormVisibility('2');
		}
	}

	function CheckFacturation(obj, email, guestemail, password)
	{
		if(obj.checked)
		{
			SetFormVisibility('3a','hidden');
		}
		else
		{
			//alert(email);
			//alert('test'+guestemail);
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getclientdata.php";
			if(email != "")
			{
				keeper.setVar("email",email);

				keeper.setVar("password",password);
				keeper.onCompletion = function()
				{
					eval("var response = "+ keeper.response);
					if(response.status)//password ok
					{
						/*$('fac_country').value = response.fac_country;
						$('fac_firstname').value = response.fac_firstname;
						$('fac_lastname').value = response.fac_lastname;
						$('fac_address').value = response.fac_address;
						$('fac_city').value = response.fac_city;
						$('fac_zipcode').value = response.fac_zipcode;
						$('fac_titleno').value = response.fac_titleno;*/


						$('lev_titleno').value = response.lev_titleno;
						$('lev_country').value = response.lev_country;
						$('lev_firstname').value = response.lev_firstname;
						$('lev_lastname').value = response.lev_lastname;
						$('lev_address').value = response.lev_address;
						$('lev_city').value = response.lev_city;
						$('lev_zipcode').value = response.lev_zipcode;

						/*if(response.lev_set)
						{
							$('fac_lev').checked=true;
							$('lev_country').value = response.lev_country;
							$('lev_firstname').value = response.lev_firstname;
							$('lev_lastname').value = response.lev_lastname;
							$('lev_address').value = response.lev_address;
							$('lev_city').value = response.lev_city;
							$('lev_zipcode').value = response.lev_zipcode;
							$('lev_phone').value = response.lev_phone;
						}*/
						SetFormVisibility('3a','visible');
						$('fac_email').disabled = true;
						$('error-password').style.display = 'none';
						//$('password-box').style['display'] = 'none';
						//$('button-confirm').style.display ='block';
					}

															changeLeveringAdres($('leveringadres').value);
													};
				keeper.runAJAX();
			}
			else
			{
				//keeper.setVar("email",guestemail);
				//keeper.setVar("nopassword","yes");

				SetFormVisibility('3a','visible');
				$('fac_email').disabled = true;
				$('error-password').style.display = 'none';
			}

		}
	}

	function CheckLevData(lang)
	{		
		var iLeveringAdres = 0;
		$('shippingsummary').innerHTML = "";
		
		if(document.getElementById('fac_lev').checked)
		{
			// facturatiegegevens zijn zelfde als transportgegevens

			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getcountry.php?lang="+lang; // naam van land ophalen
			keeper.setVar("countrycode",$('fac_country').value);
			keeper.onCompletion = function()
			{
				eval("var response = "+ keeper.response);
				//alert(response.countryname);
				$('shippingsummary').innerHTML = $('fac_firstname').value + " " + $('fac_lastname').value +
				"<br>" + $('fac_address').value + "<br>" + $('fac_zipcode').value + " " + $('fac_city').value+
				"<br>" + response.countryname;
			};
			keeper.runAJAX();

			if ($('leveringadres') != null && $('reltransid') != null){
				iLeveringAdres = $('reltransid').value;			
			}
		}
		else
		{
			if ($('leveringadres') != null){
				iLeveringAdres = $('leveringadres').value;
			}
			
			var empty = "no";

			if(!CheckForEmpty($('lev_lastname').value, $('lev_error_empty'), 'lev_lastname', 'medium'))
			{
				empty = "yes";
			}
			if(!CheckForEmpty($('lev_firstname').value, $('lev_error_empty'), 'lev_firstname', 'medium'))
			{
				empty = "yes";
			}
			if(!CheckForEmpty($('lev_address').value, $('lev_error_empty'), 'lev_address', 'medium'))
			{
				empty = "yes";
			}
			if(!CheckForEmpty($('lev_zipcode').value, $('lev_error_empty'), 'lev_zipcode', 'short'))
			{
				empty = "yes";
			}
			if(!CheckForEmpty($('lev_city').value, $('lev_error_empty'), 'lev_city', 'medium'))
			{
				empty = "yes";
			}

			if(empty == "yes")
			{
				$('lev_error_empty').style.display = 'inline';
			}
			else
			{
				var keeper = new sack();
				keeper.requestFile = "http://www.abyz.be/shoppingcart/getcountry.php?lang="+lang; // naam van land ophalen
				keeper.setVar("countrycode",$('lev_country').value);
				keeper.onCompletion = function()
				{
					eval("var response = "+ keeper.response);
					//alert(response.countryname);
					$('shippingsummary').innerHTML += $('lev_firstname').value+" "+$('lev_lastname').value+
					"<br>" + $('lev_address').value + "<br>" + $('lev_zipcode').value + " " + $('lev_city').value+
					"<br>" + response.countryname;
				};
				keeper.runAJAX();

				if ($('leveringadres') == null){
					SetFormVisibility('3b','visible');
				}
			}
		}

		//Controle van de transportkosten
		if ($('leveringadres') != null){
			AddTransCostDelivery(iLeveringAdres);			
		}else{
			if(empty == "yes")
			{
				$('lev_error_empty').style.display = 'inline';
			}
			else
			{
				SetFormVisibility('3b','visible');
			}
			
					}
	}

	function AddTransCostDelivery(transid)
	{
					SetFormVisibility('3b','visible');
			}
	
	function EditHeadAmount()
	{
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_itemcount.php";
		keeper.onCompletion = function(){
			var out = eval ('(' + keeper.response + ')');
			aantal = out[0].output.aantal;

			//alert(aantal);

			if (aantal < 0){
				aantal = 1;
			}

			if (aantal != 1){
				if ($('headshopcaramount') != null) $('headshopcaramount').innerHTML="bevat  <span id=\"amount\">" + aantal +'<\/span> '+'artikels';
			}else{
				if ($('headshopcaramount') != null) $('headshopcaramount').innerHTML="bevat  <span id=\"amount\">" + aantal + '<\/span> '+'artikel';
			}
		};
		keeper.runAJAX();
	}

	function EditRightAmount()
	{
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_itemcount.php";
		keeper.onCompletion = function(){
			var out = eval ('(' + keeper.response + ')');
			aantal = out[0].output.aantal;

		//	alert(aantal);

			if (aantal < 0){
				aantal = 1;
			}

			if ($('cart_aantal') != null){
				if (aantal == 1){
					$('cart_aantal').innerHTML= aantal + " artikel";
				}else{
					$('cart_aantal').innerHTML= aantal + " artikels";
				}
			}
		};
		keeper.runAJAX();
	}
	
	function EditSubTotal()
	{
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_subtotal.php";
		keeper.onCompletion = function(){
			var out = eval ('(' + keeper.response + ')');
			total = out[0].output.total;

			if ($('subtotaal') != null) $('subtotaal').innerHTML = "<strong>&euro; " + total + "<\/strong>";
			if ($('cart_totaal') != null) $('cart_totaal').innerHTML = "&euro; " + total;
		};
		keeper.runAJAX();
	}

	function EditRightShopcart()
	{
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/shoppingcart/cart_rightshopcart.php";
		keeper2.onCompletion = function(){
			//var out = eval ('(' + keeper.response + ')');
			//total = out[0].output.total;
			$('rightshopcar').className = "";
			$('rightshopcar').innerHTML = html_entity_decode(keeper2.response);
		};
		keeper2.runAJAX();

		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/cart_itemcount.php";
		keeper.onCompletion = function(){
			var out = eval ('(' + keeper.response + ')');
			aantal = out[0].output.aantal;

			var obj = document.getElementById("toonalles_lower");

			if (obj != null){
				if (aantal >= 10){
					document.getElementById("toonalles_lower").style.display = "block";
				}else{
					document.getElementById("toonalles_lower").style.display = "none";
				}
			}
		};
		keeper.runAJAX();
	}

	function getRollOverMiniCart(locatiephotolib){
		bOverMiniCart = true;

		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/getminicartrollover.php?locatiephotolib="+locatiephotolib;
		keeper.onCompletion = function(){
			//Controleren ofdat men nog altijd hoovert over de link
			if (bOverMiniCart === true){
				Tip(html_entity_decode(keeper.response),WIDTH, 500,TITLE,"Mijn order");
			}
		};
		keeper.runAJAX();
	}

	function getRollOverMiniCartWithoutTitle(locatiephotolib){
		bOverMiniCart = true;

		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/getminicartrollover.php?locatiephotolib="+locatiephotolib;
		keeper.onCompletion = function(){
			//Controleren ofdat men nog altijd hoovert over de link
			if (bOverMiniCart === true){
				Tip(html_entity_decode(keeper.response),WIDTH, 500, TITLE,'');
			}
		};
		keeper.runAJAX();
	}

	function getMiniCart(locatiephotolib, boxID){
		if (document.getElementById(boxID).style.display == "none"){
			/*var ajaxobj = document.getElementById("ajaxminicart");

			if (ajaxobj != null){
				var oImg = document.createElement('img');
				oImg.setAttribute("src", locatiephotolib + "ajax-loader.gif");
				oImg.setAttribute("style", "");
				oImg.style.overflow = "hidden";
				oImg.style.border = "0px";
				ajaxobj.appendChild(oImg);
			}*/

			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getminicart.php?locatiephotolib="+locatiephotolib + "&catno=0" + "&page=0" + "&view=list";
			keeper.onCompletion = function(){
				document.getElementById(boxID).innerHTML = html_entity_decode(keeper.response);
			};
			keeper.runAJAX();
		}
	}

	function ShowArticleAppendices(lang, articleno, appendices, articlename)
	{
		Modalbox.show("Bijlagen", "http://www.abyz.be/articleappendices.php?lang="+lang+"&articleno="+articleno+"&articlename="+articlename+"&appendices="+appendices, {width: 450, height:200, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
	}
	
	function ShowArticleAppendices2(lang, articleno, appendices, articlename)
	{
		Modalbox.show("Bijlagen", "http://www.abyz.be/articleappendices2.php?lang="+lang+"&articleno="+articleno+"&articlename="+articlename+"&appendices="+appendices, {width: 450, height:200, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
	}
	
	function ShowArticleSoftware(lang, articleno, software, articlename)
	{
		Modalbox.show("Software", "http://www.abyz.be/articlesoftware.php?lang="+lang+"&articleno="+articleno+"&articlename="+articlename+"&software="+software, {width: 450, height:200, loadingString:'Initialiseren', closeString:'Sluiten',overlayClose:true});
	}

	function setUserText(bFocus, obj){
		if (bFocus == true){
			if (obj.value == "login"){
				obj.value = "";
			}
		}else{
			if (obj.value == ""){
				obj.value = "login";
			}
		}
	}

	function setPassText(bFocus, obj){
		if (bFocus == true){
			if (obj.value == "paswoord"){
				obj.value = "";
			}
		}else{
			if (obj.value == ""){
				obj.value = "paswoord";
			}
		}
	}

	function setSearchText(bFocus, obj){
		if (bFocus == true){
			if (obj.value == "Zoek product ..."){
				obj.value = "";
			}
		}else{
			if (obj.value == ""){
				obj.value = "Zoek product ...";
			}
		}
	}

	function getWebservicePriceStockInfoTop(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
		
		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrStockArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');

				//alert("niet op voorraad");
				//alert("niet op voorraad");
				//alert (utf8_encode(arrResults[i]));
				switch (arrResults[i]){
					case "op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.onmouseover = function(){Tip('op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "error":
						oImg.setAttribute("src", "http://www.abyz.be/images/warning.gif");
						oImg.setAttribute("alt","");
						oImg.setAttribute("title","");
						oImg.onmouseover = function(){Tip('Probleem bij het ophalen van de stock. Probeer het later opnieuw.<br>Onze excuses voor het ongemak.', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				bFinishedStock = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper2.onFail = function(){
			alert("tst");
		};

		keeper2.runAJAX();
	}
	
	function getWebservicePriceStockInfo(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
			}
	
	function getWebservicePriceStockInfoDetail(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
			}

	function getWebservicePriceStockInfoWithAantal(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
		
		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfoWithAantal.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			//console.log(keeper2.response);
			var result = keeper2.response.replace("\n","");
			var arrResults = result.split("__");

			for (i = 0; i < arrResults.length; i++){
				var arrStockInfo = arrResults[i].split("_");
				var stockname = arrStockInfo[1];
				var stockaantal = intval(arrStockInfo[0]);
				var container = document.getElementById("stock_" + arrStockArticles[i]);
				var message = "";
				
				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');

				//alert("niet op voorraad");
				//alert("niet op voorraad");
				//alert (utf8_encode(arrResults[i]));

				if (stockaantal == 1){
					message = "artikel";	
				}else{
					message = "artikels";	
				}
				
				switch (stockname){
					case "op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.setAttribute("name","" + stockaantal);
						oImg.onmouseover = function(){Tip(this.name + ' ' + message + ' op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.setAttribute("name","" + stockaantal);
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.setAttribute("name","" + stockaantal);
						
						if (stockaantal > 0){
							oImg.onmouseover = function(){Tip(this.name + ' ' + message + ' op voorraad (in backorder)', TITLE,'');};
						}else{
							oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						}

						oImg.onmouseout = function(){UnTip();};
						
						container.appendChild(oImg);

						break;
					case "error":
						oImg.setAttribute("src", "http://www.abyz.be/images/warning.gif");
						oImg.setAttribute("alt","");
						oImg.setAttribute("title","");
						oImg.onmouseover = function(){Tip('Probleem bij het ophalen van de stock. Probeer het later opnieuw.<br>Onze excuses voor het ongemak.', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				bFinishedStock = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper2.onFail = function(){
			
		};

		keeper2.runAJAX();
	}
	
	function getWebservicePriceStockInfoMultiple(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
		
		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrStockArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');

				//alert("niet op voorraad");
				//alert("niet op voorraad");
				//alert (utf8_encode(arrResults[i]));
				switch (arrResults[i]){
					case "op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.onmouseover = function(){Tip('op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "http://www.abyz.be/images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "error":
						oImg.setAttribute("src", "http://www.abyz.be/images/warning.gif");
						oImg.setAttribute("alt","");
						oImg.setAttribute("title","");
						oImg.onmouseover = function(){Tip('Probleem bij het ophalen van de stock. Probeer het later opnieuw.<br>Onze excuses voor het ongemak.', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				bFinishedStock = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper2.onFail = function(){
			alert("tst");
		};

		keeper2.runAJAX();
	}

	function getWebservicePriceStockInfoHistorieken(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
		
		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrStockArticles[i] + "_" + i);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');

				switch (arrResults[i]){
					case "op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.onmouseover = function(){Tip('op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "./images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "error":
						oImg.setAttribute("src", "./images/warning.gif");
						oImg.setAttribute("alt","");
						oImg.setAttribute("title","");
						oImg.onmouseover = function(){Tip('Probleem bij het ophalen van de stock. Probeer het later opnieuw.<br>Onze excuses voor het ongemak.', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				bFinishedStock = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper2.runAJAX();
	}

	function getWebservicePriceStockInfoOnlyPrice(price_articles){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
			}

	function getWebserviceStockInfoPromo(stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedStock = false;

		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrStockArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');
				arrResults[i] = arrResults[i].replace("\n","");
				
				//alert("niet op voorraad");
				//alert("niet op voorraad");
				//alert (utf8_encode(arrResults[i]));
				switch (arrResults[i]){
					case "op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.onmouseover = function(){Tip('op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "./images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
			}
		};

		keeper2.runAJAX();
	}
	
	function getWebserviceStockInfoPromoWithAantal(stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedStock = false;

		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfoWithAantal.php?lang=NL&articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var arrStockInfo = arrResults[i].split("_");
				var stockname = arrStockInfo[1];
				var stockaantal = intval(arrStockInfo[0]);
				var container = document.getElementById("stock_" + arrStockArticles[i]);
				var message = "";
				
				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');
				arrResults[i] = arrResults[i].replace("\n","");
				
				if (stockaantal == 1){
					message = "artikel";	
				}else{
					message = "artikels";	
				}
				
				//alert("niet op voorraad");
				//alert("niet op voorraad");
				//alert (utf8_encode(arrResults[i]));
				switch (stockname){
					case "op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.setAttribute("name","" + stockaantal);
						oImg.onmouseover = function(){Tip(this.name + ' ' + message + ' op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "./images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
			}
		};

		keeper2.runAJAX();
	}

	function getWebservicePriceStockInfoSavedOrders(price_articles, salesorder_articles){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
					bFinishedPrices = true;
				}

	function utf8_encode(string) {
	    // *     example 1: utf8_encode('Kevin van Zonneveld');
	    // *     returns 1: 'Kevin van Zonneveld'

	    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");

	    var utftext = "";
	    var start, end;
	    var stringl = 0;

	    start = end = 0;
	    stringl = string.length;
	    for (var n = 0; n < stringl; n++) {
	        var c1 = string.charCodeAt(n);
	        var enc = null;

	        if (c1 < 128) {
	            end++;
	        } else if((c1 > 127) && (c1 < 2048)) {
	            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
	        } else {
	            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
	        }
	        if (enc != null) {
	            if (end > start) {
	                utftext += string.substring(start, end);
	            }
	            utftext += enc;
	            start = end = n+1;
	        }
	    }

	    if (end > start) {
	        utftext += string.substring(start, string.length);
	    }

	    return utftext;
	}

	function getWebservicePriceStockInfoElpo(price_articles, stock_articles, icon_voorraad1, icon_voorraad2, icon_voorraad3){
		var bFinishedPrices = false;
		var bFinishedStock = false;

		//Prijzen
		var arrPriceArticles = price_articles.split(";");
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/getWebservicePriceInfo.php?articles=" + arrPriceArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper.onCompletion = function(){
			var out = eval ('(' + keeper.response + ')');
			var arrResults = out[0].output.incl.split(";");
			var arrResultsExcl = out[0].output.excl.split(";");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("article" + arrPriceArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				container.innerHTML = "<span><strong>&euro; " + to2DecWithComma(arrResults[i]) + "<\/strong><\/span>";

				document.getElementById("article_prijs_" + arrPriceArticles[i]).value = arrResultsExcl[i];
				document.getElementById("article_basket_" + arrPriceArticles[i]).style.visibility = "visible";

				bFinishedPrices = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper.runAJAX();

		//Stock
		var arrStockArticles = stock_articles.split(";");
		var keeper2 = new sack();
		keeper2.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?articles=" + arrStockArticles + "&catno=0" + "&page=0" + "&view=list";

		keeper2.onCompletion = function(){
			var arrResults = keeper2.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrStockArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				//Image toevoegen
				var oImg = document.createElement('img');

				switch (arrResults[i]){
					case "op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad1);
						oImg.setAttribute("alt","op voorraad");
						oImg.setAttribute("title","op voorraad");
						oImg.onmouseover = function(){Tip('op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						//echo "<img src=\"./images/icon_voorraad_green.gif\" onmouseover=\"Tip('$lbl_op_voorraad', TITLE,'');\" onmouseout=\"UnTip();\"/>";
						break;
					case "niet op voorraad":
						oImg.setAttribute("src", "./images/" + icon_voorraad2);
						oImg.setAttribute("alt","niet op voorraad");
						oImg.setAttribute("title","niet op voorraad");
						oImg.onmouseover = function(){Tip('niet op voorraad', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
					case "in backorder":
						oImg.setAttribute("src", "./images/" + icon_voorraad3);
						oImg.setAttribute("alt","in backorder");
						oImg.setAttribute("title","in backorder");
						oImg.onmouseover = function(){Tip('in backorder', TITLE,'');};
						oImg.onmouseout = function(){UnTip();};
						container.appendChild(oImg);

						break;
				}

				bFinishedStock = true;

				if (bFinishedPrices === true && bFinishedStock === true){
					if ($('retrievingdata') != null) document.getElementById('retrievingdata').innerHTML = "";
				}
			}
		};

		keeper2.runAJAX();
	}

	function to2DecWithComma(num)
	{
		num="" + Math.floor(num*100.0 + 0.5)/100.0;

		var i=num.indexOf(".");

		if ( i<0 ) num+=",00";
		else {
		num=num.substring(0,i) + "," + num.substring(i + 1);
		i=(num.length - i) - 1;
		if ( i==0 ) num+="00";
		else if ( i==1 ) num+="0";
		else if ( i>2 ) num=num.substring(0,i + 3);
		}

		return num;
	}

	function getWebserviceStockInfo(articles){
		var arrArticles = articles.split(";");
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/getWebserviceStockInfo.php?articles=" + arrArticles + "&catno=0";

		keeper.onCompletion = function(){
			var arrResults = keeper.response.split("__");

			for (i = 0; i < arrResults.length; i++){
				var articlename = arrResults[i].replace(" ", "_");
				var container = document.getElementById("stock_" + arrArticles[i]);

				if (container != null){
					while (container.childNodes.length >= 1) {
					     container.removeChild(container.firstChild);
					}
				}

				switch (arrResults[i]){
					case "op_voorraad":
						break;
					case "in_backorder":
						break;
					case "uit_voorraad":
						break;
				}

				//container.innerHTML = "<br/><span><strong>" + arrResults[i] + "<\/strong> euro<\/span>";
			}
		};

		keeper.runAJAX();
	}

	/*function getWebservicePriceInfoByArticle(article){
		var arrArticles = articles.split(";");
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/getWebservicePriceInfoByArticle.php?article=" + article;

		keeper.onCompletion = function(){
			var results = keeper.response;
			var articlename = arrResults[i].replace(" ", "_");
			var container = document.getElementById(arrArticles[i]);

			while (container.childNodes.length >= 1) {
			     container.removeChild(container.firstChild);
			}

			container.innerHTML = "<br/><span><strong>" + results[i] + "<\/strong> euro<\/span>";
		};

		keeper.runAJAX();
	}*/

	function deleteFile(file){
		var answer = confirm ("Weet u zeker dat u dit bestand wenst te verwijderen?");

		if (answer){
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/deletefile.php?file="+file;
			keeper.onCompletion = function()
			{
				document.location.reload();
			};
			keeper.runAJAX();
		}
	}

	function toggle_cart(div_id)
	{
		if($(div_id).style.display == "none")
		{
			Effect.BlindDown($(div_id), {duration: 0.5});
			$(div_id + "_image").src = "./images/arrow_up.gif";
			$("toonalles").innerHTML = "Sluit order";
		}
		else
		{
			Effect.BlindUp($(div_id), {duration: 0.5});
			$(div_id + "_image").src = "./images/arrow_down.gif";
			$("toonalles").innerHTML = "Mijn order";
		}
	}

	function changeLeveringAdres(valueID){
		if (valueID != ""){
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/changeleveringadres.php?id="+valueID;
			keeper.onCompletion = function()
			{
				var out = eval ('(' + keeper.response + ')');

				$('lev_lastname').value = '' + out[0].output.naam;
				$('lev_address').value = '' + out[0].output.adres;
				$('lev_city').value = '' + out[0].output.plaats;
				$('lev_zipcode').value = '' + out[0].output.postcode;

				if (out[0].output.land == ""){
					$('lev_country').value = 'BE';
				}else{
					$('lev_country').value = ''+out[0].output.land;
				}
			};
			keeper.runAJAX();
		}
	}

	function changeFacAdres(valueID){
		if (valueID != ""){
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/changefacadres.php?id="+valueID;
			keeper.onCompletion = function()
			{
				var out = eval ('(' + keeper.response + ')');

				$('fac_lastname').value = '' + out[0].output.naam;
				$('fac_address').value = '' + out[0].output.adres;
				$('fac_city').value = '' + out[0].output.plaats;
				$('fac_zipcode').value = '' + out[0].output.postcode;
				$('fac_phone').value = '' + out[0].output.tel;

				if (out[0].output.land == ""){
					$('fac_country').value = 'BE';
				}else{
					$('fac_country').value = ''+out[0].output.land;
				}
			};
			keeper.runAJAX();
		}else{
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/getclientdata.php";
			keeper.setVar("email","");
			keeper.setVar("password","");

				keeper.onCompletion = function()
				{
					eval("var response = "+ keeper.response);
					//alert(response.status);
					if(response.status)//password ok
					{
						$('labelpassword').className = '';
						$('inputpassword').className = 'inputmedium5';

						$('fac_country').value = response.fac_country;
						$('fac_firstname').value = response.fac_firstname;
						$('fac_lastname').value = response.fac_lastname;
						$('fac_address').value = response.fac_address;
						$('fac_city').value = response.fac_city;
						$('fac_zipcode').value = response.fac_zipcode;
						$('fac_titleno').value = response.fac_titleno;
						$('fac_phone').value = response.fac_phone;
						$('fac_mobile').value = response.fac_mobile;
						$('fac_email2').value = response.fac_email;
					}
				};
				keeper.runAJAX();
		}
	}

	function RemoveFromRepair(articleno){
		var keeper = new sack();

		keeper.requestFile = "http://www.abyz.be/garantie_remove.php?articleno="+articleno;
		keeper.onCompletion = function()
		{
			document.location = "http://www.abyz.be/item.php?itemno=137_0&lang=NL";
		};
		keeper.runAJAX();
	}

	function getWebserviceRelInfo(){
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/getwebservicerelinfo.php";
		keeper.onCompletion = function()
		{

		};
		keeper.runAJAX();
	}

	function getWebserviceTitels(){
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/getwebservicetitels.php";
		keeper.onCompletion = function()
		{

		};
		keeper.runAJAX();
	}

	function getNewHeaderFotos(max, timeout, fotolib){
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/getnewheaderfotos.php?locatie=" + fotolib;
		keeper.onCompletion = function()
		{
			var out = keeper.response;
			var arrResults = out.split(";");

			if (arrResults.length > max){
				DisplayImages(out, max, timeout, -1);
			}
		};
		keeper.runAJAX();
	}

	function DisplayImages(images, max, timeout, already_done_div){
		imagesnew = images.split(";");

		imagesnew = shuffle(imagesnew);

		//Huidige afbeeldingen ophalen
		var arrImages = new Array();
		if (max >= 1){
			var arrImage = document.getElementById("header_foto_0_container").firstChild.src.split("/");
			arrImages[0] = arrImage[arrImage.length-1];
		}

		if (max >= 2){
			var arrImage = document.getElementById("header_foto_1_container").firstChild.src.split("/");
			arrImages[1] = arrImage[arrImage.length-1];
		}

		if (max >= 3){
			var arrImage = document.getElementById("header_foto_2_container").firstChild.src.split("/");
			arrImages[2] = arrImage[arrImage.length-1];
		}

		if (max >= 4){
			var arrImage = document.getElementById("header_foto_3_container").firstChild.src.split("/");
			arrImages[3] = arrImage[arrImage.length-1];
		}

		//Willekeurig een afbeelding uitkiezen om te wijzigen
		var random = 0;

		do{
			random = 1 + Math.floor(Math.random()*max);
		}while ((random-1) == already_done_div);

		var imgDiv = document.getElementById("header_foto_" + (random -1));

		var nieuweSrc = "";

		//Nieuwe source ophalen die niet huidig aanwezig is
		for (i = 0; i < imagesnew.length; i++){
			nieuweSrc = imagesnew[i];
			nieuweSrcChecktmp = nieuweSrc.split("/");
			nieuweSrcCheck = nieuweSrcChecktmp[nieuweSrcChecktmp.length-1];

			bFound = "N";

			for (j = 0; j < arrImages.length; j++){
				if (arrImages[j] == nieuweSrcCheck){
					bFound = "Y";
					break;
				}
			}

			if (bFound == "N"){
				break;
			}
		}

		//Nieuwe afbeelding aanmaken
		var container = document.createElement('div');
		container.setAttribute("id","header_foto_container_back");
		container.style.width = 163 + "px";
		container.style.height = 125 + "px";
		container.style.display = "none";
		container.style.zIndex = 9999;
		container.style.position = "absolute";
		container.style.top = 0;
		container.style.left = 0;

		imgDiv.appendChild(container);

		var oImg = document.createElement('img');
		oImg.setAttribute("src", nieuweSrc);
		oImg.setAttribute("style", "");
		oImg.style.overflow = "hidden";
		oImg.style.border = "0px";
		container.appendChild(oImg);

		Effect.Appear('header_foto_container_back', { duration: 1.4, afterFinish:
					function(){
						imgDiv.removeChild(imgDiv.firstChild);
						container.setAttribute("id","header_foto_" + (random-1) + "_container");}});

		images = images.replace("\n","");

		setTimeout("DisplayImages('" + images + "'," + max + "," + timeout + "," + (random-1) + ")", timeout);
	}

	function DisplayImagesBackUp(images, max, timeout){
		imagesnew = images.split(";");

		imagesnew = shuffle(imagesnew);

		for (i = 0; i < max;i++){
			document.getElementById("header_foto_" + i).style.display = "none";
			document.getElementById("header_foto_" + i).style.float = "left";
			document.getElementById("header_foto_" + i).style.width = 163 + "px";
			document.getElementById("header_foto_img_" + i).src = imagesnew[i];
		}

		for (i = 0; i < max;i++){
			Effect.Appear('header_foto_'+i);
		}

		setTimeout("DisplayImages('" + images + "'," + max + "," + timeout + ")", timeout);
	}

	function shuffle(o)
	{
		for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
		return o;
	}

	function SaveOrder(lang)
	{
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/shoppingcart/saveorder.php";
		/*keeper.setVar("lev_country",$('lev_country').value);
		keeper.setVar("lev_titleno",$('lev_titleno').value);
		keeper.setVar("lev_firstname", $('lev_firstname').value);
		keeper.setVar("lev_lastname",$('lev_lastname').value);
		keeper.setVar("lev_address",$('lev_address').value);
		keeper.setVar("lev_city",$('lev_city').value);
		keeper.setVar("lev_zipcode",$('lev_zipcode').value);
		keeper.setVar("lev_diff",levaddrr);
		keeper.setVar("fac_country",$('fac_country').value);
		keeper.setVar("fac_titleno",$('fac_titleno').value);
		keeper.setVar("fac_firstname",$('fac_firstname').value);
		keeper.setVar("fac_lastname",$('fac_lastname').value);
		keeper.setVar("fac_address",$('fac_address').value);
		keeper.setVar("fac_city",$('fac_city').value);
		keeper.setVar("fac_zipcode",$('fac_zipcode').value);
		keeper.setVar("fac_phone",$('fac_phone').value);
		keeper.setVar("fac_mobile",$('fac_mobile').value);
		keeper.setVar("fac_email2",$('fac_email2').value);
		keeper.setVar("fac_remarks",$('fac_remarks').value);
		keeper.setVar("email",$('fac_email').value);
		keeper.setVar("guestemail",$('guest_email').value);
		keeper.setVar("password",$('password_0').value);*/


		keeper.onCompletion = function()
		{
			document.location = "http://www.abyz.be/savedorders.php?saved=yes&lang="+lang;
		};
		keeper.runAJAX();

	}
	
	function saveRemark(lang) {
		var remark = "";
		
		if(document.getElementById("remarks") != null) {
			var remark = document.getElementById("remarks").value;
		}
		
		if(remark != "") {
	
			var keeper = new sack();
			keeper.requestFile = "http://www.abyz.be/shoppingcart/saveremark.php?remark="+remark;
	
			keeper.onCompletion = function()
			{
				document.location = "http://www.abyz.be/shoppingcart/order.php?lang="+lang;
			};
			keeper.runAJAX();
		}
		else 
		{
			document.location = "http://www.abyz.be/shoppingcart/order.php?lang="+lang;
		}
	}

	function showHideNotAvailableHistoriek(obj, containerID){
		var container = document.getElementById(containerID);

		if (container != null){
			var trs = document.getElementsByTagName("tr");

			for(var i=0; i < trs.length; i++){
				var tr = trs[i];
				var id = tr.id;
				var subSection = id.substring(0,9);

				if (subSection == "notfound_"){
					if (obj.checked){
						tr.style.display = "none";
					}else{
						var bname = navigator.appName;
						if (bname == "Microsoft Internet Explorer")
						{
							tr.style.display = "block";
						}
						else
						{
						   	tr.style.display = "table-row";
						}


					}
				}
			}
		}
	}

	function SlideBox(boxID, obj){
		var status = document.getElementById(obj);
		var statusstr = status.src;
		if (statusstr.search("arrow_bottom.png") > -1){
			//Sluiten
			status.src= "http://www.abyz.be//images/arrow_right.png";
			Effect.SlideUp(boxID);
			return false;
		}else{
			//Openen
			status.src= "http://www.abyz.be//images/arrow_bottom.png";
			Effect.SlideDown(boxID);
			return false;
		}
	}

	function showLandInfo(iLand, side){
		document.getElementById("landinfo").innerHTML = "";
		
		var oImg = document.createElement('img');
		oImg.setAttribute("src", "./images/ajax-loader.gif");
		oImg.setAttribute("style", "");
		oImg.style.border = "0px";
		document.getElementById("landinfo").appendChild(oImg);
				
		if (side == 'right'){
			document.getElementById("landinfo").style.left = "";
			document.getElementById("landinfo").style.right = "0px";
		}
		
		if (side == 'left'){
			document.getElementById("landinfo").style.right = "";
			document.getElementById("landinfo").style.left = "0px";
		}
				
		document.getElementById("landinfo").style.display = "block";
		
		var keeper = new sack();
		keeper.requestFile = "http://www.abyz.be/landinfo.php?land="+iLand;
		keeper.onCompletion = function()
		{
			var out = eval ('(' + keeper.response + ')');
			var status = out[0].output.status;
			var name = out[0].output.name;
			var description = out[0].output.description;
			
			if (status == "OK"){
				
				
				document.getElementById("landinfo").innerHTML = "<h3>" + name + "<\/h3><p><br\/>" + description + "<\/p>";
				document.getElementById("landinfo").style.display = "block";
				
				
			}
		};
		keeper.runAJAX();
	}
	
	function RemoveLandInfo(){
		document.getElementById("landinfo").style.display = "none";
	}
	
	function htmlentities (string, quote_style) {
	    var histogram = {}, symbol = '', tmp_str = '', entity = '';
	    tmp_str = string.toString();
	    
	    if (false === (histogram = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
	        return false;
	    }
	    
	    for (symbol in histogram) {
	        entity = histogram[symbol];
	        tmp_str = tmp_str.split(symbol).join(entity);
	    }
	    
	    return tmp_str;
	}

	function htmlentitiesdecode(string, quote_style){
	    var histogram = {}, symbol = '', tmp_str = '', entity = '';
	    tmp_str = string.toString();

	    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
	        return false;
	    }

	    delete(histogram['&']);
	    histogram['&'] = '&amp;';

	    for (symbol in histogram) {
	        entity = histogram[symbol];
	        tmp_str = tmp_str.split(entity).join(symbol);
	    }

	    return tmp_str;
	}

	function get_html_translation_table(table, quote_style){
	    var entities = {}, histogram = {}, decimal = 0, symbol = '';
	    var constMappingTable = {}, constMappingQuoteStyle = {};
	    var useTable = {}, useQuoteStyle = {};

	    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
	    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');

	    // Translate arguments
	    constMappingTable[0]      = 'HTML_SPECIALCHARS';
	    constMappingTable[1]      = 'HTML_ENTITIES';
	    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
	    constMappingQuoteStyle[2] = 'ENT_COMPAT';
	    constMappingQuoteStyle[3] = 'ENT_QUOTES';

	    // Map numbers to strings for compatibilty with PHP constants
	    if (!isNaN(useTable)) {
	        useTable = constMappingTable[useTable];
	    }
	    if (!isNaN(useQuoteStyle)) {
	        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
	    }

	    if (useQuoteStyle != 'ENT_NOQUOTES') {
	        entities['34'] = '&quot;';
	    }

	    if (useQuoteStyle == 'ENT_QUOTES') {
	        entities['39'] = '&#039;';
	    }

	    if (useTable == 'HTML_SPECIALCHARS') {
	        // ascii decimals for better compatibility
	        entities['38'] = '&amp;';
	        entities['60'] = '&lt;';
	        entities['62'] = '&gt;';
	    } else if (useTable == 'HTML_ENTITIES') {
	        // ascii decimals for better compatibility
	      entities['38']  = '&amp;';
	      entities['60']  = '&lt;';
	      entities['62']  = '&gt;';
	      entities['160'] = '&nbsp;';
	      entities['161'] = '&iexcl;';
	      entities['162'] = '&cent;';
	      entities['163'] = '&pound;';
	      entities['164'] = '&curren;';
	      entities['165'] = '&yen;';
	      entities['166'] = '&brvbar;';
	      entities['167'] = '&sect;';
	      entities['168'] = '&uml;';
	      entities['169'] = '&copy;';
	      entities['170'] = '&ordf;';
	      entities['171'] = '&laquo;';
	      entities['172'] = '&not;';
	      entities['173'] = '&shy;';
	      entities['174'] = '&reg;';
	      entities['175'] = '&macr;';
	      entities['176'] = '&deg;';
	      entities['177'] = '&plusmn;';
	      entities['178'] = '&sup2;';
	      entities['179'] = '&sup3;';
	      entities['180'] = '&acute;';
	      entities['181'] = '&micro;';
	      entities['182'] = '&para;';
	      entities['183'] = '&middot;';
	      entities['184'] = '&cedil;';
	      entities['185'] = '&sup1;';
	      entities['186'] = '&ordm;';
	      entities['187'] = '&raquo;';
	      entities['188'] = '&frac14;';
	      entities['189'] = '&frac12;';
	      entities['190'] = '&frac34;';
	      entities['191'] = '&iquest;';
	      entities['192'] = '&Agrave;';
	      entities['193'] = '&Aacute;';
	      entities['194'] = '&Acirc;';
	      entities['195'] = '&Atilde;';
	      entities['196'] = '&Auml;';
	      entities['197'] = '&Aring;';
	      entities['198'] = '&AElig;';
	      entities['199'] = '&Ccedil;';
	      entities['200'] = '&Egrave;';
	      entities['201'] = '&Eacute;';
	      entities['202'] = '&Ecirc;';
	      entities['203'] = '&Euml;';
	      entities['204'] = '&Igrave;';
	      entities['205'] = '&Iacute;';
	      entities['206'] = '&Icirc;';
	      entities['207'] = '&Iuml;';
	      entities['208'] = '&ETH;';
	      entities['209'] = '&Ntilde;';
	      entities['210'] = '&Ograve;';
	      entities['211'] = '&Oacute;';
	      entities['212'] = '&Ocirc;';
	      entities['213'] = '&Otilde;';
	      entities['214'] = '&Ouml;';
	      entities['215'] = '&times;';
	      entities['216'] = '&Oslash;';
	      entities['217'] = '&Ugrave;';
	      entities['218'] = '&Uacute;';
	      entities['219'] = '&Ucirc;';
	      entities['220'] = '&Uuml;';
	      entities['221'] = '&Yacute;';
	      entities['222'] = '&THORN;';
	      entities['223'] = '&szlig;';
	      entities['224'] = '&agrave;';
	      entities['225'] = '&aacute;';
	      entities['226'] = '&acirc;';
	      entities['227'] = '&atilde;';
	      entities['228'] = '&auml;';
	      entities['229'] = '&aring;';
	      entities['230'] = '&aelig;';
	      entities['231'] = '&ccedil;';
	      entities['232'] = '&egrave;';
	      entities['233'] = '&eacute;';
	      entities['234'] = '&ecirc;';
	      entities['235'] = '&euml;';
	      entities['236'] = '&igrave;';
	      entities['237'] = '&iacute;';
	      entities['238'] = '&icirc;';
	      entities['239'] = '&iuml;';
	      entities['240'] = '&eth;';
	      entities['241'] = '&ntilde;';
	      entities['242'] = '&ograve;';
	      entities['243'] = '&oacute;';
	      entities['244'] = '&ocirc;';
	      entities['245'] = '&otilde;';
	      entities['246'] = '&ouml;';
	      entities['247'] = '&divide;';
	      entities['248'] = '&oslash;';
	      entities['249'] = '&ugrave;';
	      entities['250'] = '&uacute;';
	      entities['251'] = '&ucirc;';
	      entities['252'] = '&uuml;';
	      entities['253'] = '&yacute;';
	      entities['254'] = '&thorn;';
	      entities['255'] = '&yuml;';
	    } else {
	        throw Error("Table: "+useTable+' not supported');
	        return false;
	    }

	    // ascii decimals to real symbols
	    for (decimal in entities) {
	        symbol = String.fromCharCode(decimal)
	        histogram[symbol] = entities[decimal];
	    }

	    return histogram;
	}
	
	function intval( mixed_var, base ) {	 
	    var tmp;
	 
	    var type = typeof( mixed_var );
	 
	    if(type == 'boolean'){
	        if (mixed_var == true) {
	            return 1;
	        } else {
	            return 0;
	        }
	    } else if(type == 'string'){
	        tmp = parseInt(mixed_var * 1, 10);
	        if(isNaN(tmp) || !isFinite(tmp)){
	            return 0;
	        } else{
	            return tmp.toString(base || 10);
	        }
	    } else if(type == 'number' && isFinite(mixed_var) ){
	        return Math.floor(mixed_var);
	    } else{
	        return 0;
	    }
	}
	
	function getInternetExplorerVersion() {
	    var rv = -1; // Return value assumes failure.

	    if (navigator.appName == 'Microsoft Internet Explorer') {
	        var ua = navigator.userAgent;
	        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
	        
	        if (re.exec(ua) != null)
	            rv = parseFloat(RegExp.$1);
	    }

	    return rv;
	}
	
	function ShowLoginForm(){
		var loginform = document.getElementById("loginform");
		var loginformblok1 = document.getElementById("loginformblok1");
		var loginleft = document.getElementById("header_blok_left");
		var blok2 = document.getElementById("header_blok2");
		
		if (loginform != null){
			if (loginform.style.display == "undefined" || loginform.style.display == "block"){
				loginform.style.display = "none";
				loginformblok1.style.display = "block";
				loginleft.style.backgroundImage = "url(http://www.abyz.be/images/header_bg_left.gif)";
				blok2.style.borderLeft = "1px dotted #dae8f2";
			}else{
				loginform.style.display = "block";
				loginformblok1.style.display = "none";
				loginleft.style.backgroundImage = "url(http://www.abyz.be/images/header_bg_left2.gif)";
				blok2.style.borderLeft = "0px";
				document.getElementById("gebruikersnaam").focus();
			}
		}
	}
	//]]>
