function setTimer () {
	// function to automatically log of after $Timer/1000 seconds
	var $Timer = 300000; 
	var $Clock;
	
	clearTimeout($Clock);
	$Clock = setTimeout('window.location="http://10.0.0.2/erp/index.php?type=uitloggen"',$Timer); 
}

function addAmount($sForm,$sElement,$nNumber) {
	// to add or substract $nNumber to the given box
    $x = parseInt($sForm.elements[$sElement].value,10);
    
    if (isNaN($x)){
	    $x=0;
    }
    
    $x += $nNumber;
    if ($x < 0){
	    $x=0;
    }
    
    $sForm.elements[$sElement].value = $x;
}

function openLink(src){
	window.location=src;
}

function deleteProduct($p_nProductID) {
	$bConfirmed = confirm("Product echt verwijderen? Dit kan niet ongedaan gemaakt worden!");
	
	if ($bConfirmed) {
		location.href = "admin.php?type=dropproduct&productid="+$p_nProductID;
	}
	
}

function loadProduct() {
	//document.allproducts.submit();
	//document.forms['allproducts'].submit();
}

function switchPrices () {
	
	var $aDivs = document.getElementsByTagName("div");
	for (var $nCount = 0; $nCount < $aDivs.length; $nCount++) {
		var $sDiv = $aDivs[$nCount];
		
		if ($sDiv.className == 'visible') {
			$sDiv.className = 'hidden';
			$sDiv.style.display='none';
		} else if ($sDiv.className == 'hidden') {
			$sDiv.className = 'visible';
			$sDiv.style.display='block';
		}
	}
}

function setCustomFieldBasket ($p_nID, $p_sValue) {
	alert($p_nID+" "+$p_sValue);
}
