//=======================================================================================
// Webshop functions
//=======================================================================================

	function isCorrectQuantity(quantity) 
	{
		//quantity = parseInt(quantity);
		if (isNaN(quantity))
			return false;
		else if (quantity < 1 || quantity > 999999)
			return false;

		return true;
	}
	
//=======================================================================================
// Form functions
//=======================================================================================

	function isEmpty(value)
	{
		return (value.replace(/ /g,'').length == 0) ? true : false;
	}
	
	function isNumber(elm, extras) 
	{
		var valid = '1234567890'+extras;
		var tmpValue = elm.value;
		for (var i=0; i < elm.value.length; i++) {
			tmp = elm.value.substring(i,i+1);
			if (valid.indexOf(tmp) < 0) {
				alert('Only digits are allowed in this form.');
				elm.focus();
				elm.select();
				return false;
				break;
			}
		}
		return true;
	}
	
	function isEmail(value) 
	{
		return (value.indexOf("@") < 0 || value.indexOf(".") < 0 ) ? false : true;
	}
	
//=======================================================================================
// Format functions
//=======================================================================================

	function parseDecimal(value)
	{	if(value == null) value = 0;
		return parseFloat(((1/2).toString().indexOf(".") > -1) ? value.toString().replace(',','.') : value.toString().replace('.',','));
	}
	
	function round(value, numdecimals)
	{
		var dec = ((1/2).toString().indexOf(".") > -1) ? "." : ",";
		if(value.toString().indexOf(dec) < 0)
		{
			 return value;
		}
		else
		{
			var arr = value.toString().split(dec);
			
			return (arr.length == 0) ? arr[0] : arr[0] + dec + arr[1].toString().substring(0,numdecimals);
		}
	}

//=======================================================================================
// Window functions
//=======================================================================================
	
	function openWindow(inURL, Name, inHeight, inWidth, inScrollbars, inResizeable) {
		window.open(inURL, Name, 'resizable='+inResizeable+',scrollbars='+inScrollbars+',width='+inWidth+',height='+inHeight)
	}

//=======================================================================================
// iFrame functions
//=======================================================================================
	
	function requestPassword()
	{
		parent.window.open('../templates/popups/shop_request_password.aspx', 'RequestPassoword', 'width=200,height=200');
	}

	var toggle = false;
	
	function hideReqPassw(el)
	{
		document.getElementById(el).style.visibility='hidden';
		document.getElementById(el).height='0px';
	}
	function showReqPassw(el)
	{
		document.getElementById(el).style.visibility='visible';
		document.getElementById(el).height='77px';
	}

//=======================================================================================
// Swap images
//=======================================================================================

	function buy_over(artnr)
	{
		document.images[artnr].src='../media/images/buttons/btn_buy_omo.gif';
	}

	function buy_out(artnr)
	{
		document.images[artnr].src='../media/images/buttons/btn_buy.gif';
	}
	
	function buy_down(artnr)
	{
		document.images[artnr].src='../media/images/buttons/btn_buy_clk.gif';
	}
	
	// ImageSwap for asp:ImageButton (general)
	
	function ibover(elm, button) 	
	{
		elm.src='../media/images/buttons/btn_'+button+'_omo.gif'; 
	}

	function ibout(elm, button)	
	{
		elm.src='../media/images/buttons/btn_'+button+'.gif';
	}
	
	function ibdown(elm, button)	
	{
		elm.src='../media/images/buttons/btn_'+button+'_clk.gif';
	}

	// ImageSwap for asp:ImageButton (sublevel)
	
	function ibover2(elm, button) 	
	{
		elm.src='../../media/images/buttons/btn_'+button+'_omo.gif'; 
	}

	function ibout2(elm, button)	
	{
		elm.src='../../media/images/buttons/btn_'+button+'.gif';
	}
	
	function ibdown2(elm, button)	
	{
		elm.src='../../media/images/buttons/btn_'+button+'_clk.gif';
	}


