 	function categoryMouse(elm, border, newCategory){
		if(border == 0){
			elm.style.borderColor = "#ffffff";
		}
		else
		{
			elm.style.borderColor = "#646464";
		}
		
		if(typeof(newCategory) != "undefined"){
			if(newCategory != curHomeCategory){
				var oldCat = 'products' + curHomeCategory;
				var productListElm = document.getElementById(oldCat);
				productListElm.style.display = 'none';
				
				var newCat = 'products' + newCategory;
				var newProductListElm = document.getElementById(newCat);
				newProductListElm.style.display = 'inline';
				curHomeCategory = newCategory;
			}
		}
	}
	function openProductList(categoryId)
	{
		var newUrl = rootPath + 'index.php?page=products&cat=' + categoryId;
		window.location.href = newUrl;
	}
	function post_to_url(path, params, method) { 
		method = method || "post"; // Set method to post by default, if not specified. 
	 
		// The rest of this code assumes you are not using a library. 
		// It can be made less wordy if you use one. 
		var form = document.createElement("form"); 
		form.setAttribute("method", method); 
		form.setAttribute("action", path); 
	 
		for(var key in params) { 
			var hiddenField = document.createElement("input"); 
			hiddenField.setAttribute("type", "hidden"); 
			hiddenField.setAttribute("name", key); 
			hiddenField.setAttribute("value", params[key]); 
	 
			form.appendChild(hiddenField); 
		} 
	 
		document.body.appendChild(form);    // Not entirely sure if this is necessary 
		form.submit(); 
	} 
	
	function UpdateShippingForm(chkBox){
		if(chkBox != null){
			var State = !chkBox.checked;
			document.shippingInformation.person.disabled = State;
			document.shippingInformation.street.disabled = State;
			document.shippingInformation.housenumber.disabled = State;
			document.shippingInformation.zipcode.disabled = State;
			document.shippingInformation.city.disabled = State;		
			document.shippingInformation.country.disabled = State;		
			if(State == false){
				document.shippingInformation.person.focus();
				document.shippingInformation.person.select();
			}
		}
	}	

	function changeAantal(elementId, product_item_id)
	{
		var element = document.getElementById(elementId);
		var newUrl = rootPath + 'index.php?page=card';
		
		post_to_url(newUrl, {'changeProduct':product_item_id, 'newQuantity':element.value}, 'POST');

	}
	
	function addActieProductToCard(elm, productId, elementId)
	{
		var element = document.getElementById(elementId);

		var parElement = element.parentNode.parentNode;
		var selectElements = parElement.getElementsByTagName('select');
		var sizeValue = 0;


		for(var index=0; index< selectElements.length; index++)
		{

			if(selectElements[index].id == 'actiesize'+productId){
				sizeValue = selectElements[index].value;
			}			
		}
		if(parseInt(sizeValue) > 0){

			var newUrl = rootPath + 'index.php?page=card'; 
			post_to_url(newUrl, {'addProduct': productId, 'size_id':sizeValue}, 'POST');
//			window.location.href = newUrl;
		}
	}
	
	function addProductToCard(elm, productId, elementId)
	{
		var element = document.getElementById(elementId);
		var parElement = element.parentNode;
		var selectElements = parElement.getElementsByTagName('select');
		var sizeValue = 0;
		
		for(var index=0; index< selectElements.length; index++)
		{
			if(selectElements[index].id == 'size'+productId){
				sizeValue = selectElements[index].value;
			}
		}

		if(parseInt(sizeValue) > 0){

			var newUrl = rootPath + 'index.php?page=card'; //&addProduct=' + productId + '&size_id=' + sizeValue + '&quantity='+ quantityValue;
			post_to_url(newUrl, {'addProduct': productId, 'size_id':sizeValue}, 'POST');
//			window.location.href = newUrl;
		}
				
	}
