
	// -- Add product to shopping cart
	function addToShoppingCart(q,qcat) {
	   document.location.href = "shopping.php?action=add&id=" + q + "&qty=" + $('shoppingCartQty' + q).value + "&cat=" + qcat; 
       }
	

	// -- Shopping cart functions
	function shoppingCartEmpty() {
			var x = confirm("Empty your shopping cart?");
			if (x) { document.location.href = "./shopping.php?action=empty"; } }

	function shoppingCartCheckout() {
		document.location.href = "./checkout.php"; 

		//var x = confirm("Are you sure you want to checkout?");
		//if (x) { document.location.href = "./checkout.php"; } 
        
        }

	function shoppingCartAdjustQty(q,qcat) {
		document.location.href = "shopping.php?action=adjust&id=" + q + "&qty=" + $('shoppingCartQty' + q).value + "&cat=" + qcat; }

	// -- quick search functions

	function checkSearch() {
		if (document.qsearch.qsearch.value.length < 3) { alert('Please enter a search term larger then 3 characters'); }
		else { 
		document.location.href = "products.php?cat=0&q=" + document.qsearch.qsearch.value; } }

	function disableEnter(e) { 
		var key;     
		if(window.event) { key = window.event.keyCode; } //IE 
		else { key = e.which; } //firefox
		if (key == 13) { checkSearch(); return false; }
		else { return (key); } }

	// -- formate the numbers for currancy

	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; }
