	// -- update the each price
	function doPriceChangeUpdate() {
		var finalPrice = parseFloat(productBasePrice); 
		for(var i=0; i < selectObjects.length; i++) {
			if ($('optionSelect_' + selectObjects[i])[$('optionSelect_' + selectObjects[i]).selectedIndex].value != 0) {
				finalPrice = finalPrice + parseFloat(eval("affectsPrice_" + selectObjects[i] + "['s" + $('optionSelect_' + selectObjects[i])[$('optionSelect_' + selectObjects[i]).selectedIndex].value + "']")); 
				}		
			}
		$('productTotalEach').innerHTML = "<b>$" + to2DecWithComma(finalPrice) + "</b>&nbsp;<font size=-2>USD</font>";
		}	
	// -- make sure all options are selected
	function addToShoppingCart() {
		for(var i=0; i < selectObjects.length; i++) {
			if ($('optionSelect_' + selectObjects[i])[$('optionSelect_' + selectObjects[i]).selectedIndex].value == 0) {
				alert('Please make sure you have selected all your product options before adding the product to your shopping cart');
				return; }
			}
		document.shoppingCart.submit();
	}

	// -- 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 = "https://www.tubeproinc.com/shopping.php?action=checkout"; }

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

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

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