// JavaScript Document
			function isNumeric() {
				if (navigator.appName.indexOf("Netscape")<0) {
					get=event.keyCode;
					if((get>47&&get<58)||(get==8)||(get==9)) { return true; } else { event.returnValue=false; }
				}
			}

			function isNNumeric(e) {
				var isNN = (navigator.appName.indexOf("Netscape")!=-1);
				var keyCode = (isNN) ? e.which : e.keyCode;
				if (isNN) {
					if (keyCode == 0)
						return true;
				}
				if((keyCode>47&&keyCode<58)||(keyCode==8)||(keyCode==9)) {
					return true;
				} else {
					if (e.returnValue) {
						e.returnValue = false;
						return false;
					}
					else if (e.preventDefault) {
						e.preventDefault();
						return false;
					}
					this.event.returnValue = false;
					return false;
				}
			}


			function containsElement(arr, el) {
				var found = false, index = 0;
				while(!found && index < arr.length)
					if(arr[index] == el) found = true; else index++;
				return found;
			}

			function getIndex(input) {
				var index = -1, i = 0, found = false;
				while (i < input.form.length && index == -1)
				if (input.form[i] == input) index = i; else i++;
				return index;
			}

			function AutoTab(input,len, e) {
				if (!isNNumeric(e))
					return false;
				var isNN = (navigator.appName.indexOf("Netscape")!=-1);
				var keyCode = (isNN) ? e.which : e.keyCode;
				var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
				len = (isNN) ? len-1 : len;
				if(input.value.length >= len && !containsElement(filter,keyCode)){
					input.value = input.value.slice(0, len);
					input.form[(getIndex(input)+1) % input.form.length].focus();
				}
				return true;
			}

			function AutoTabEdit(input,len, e) {
				if (!isNNumeric(e))
					return false;
				var isNN = (navigator.appName.indexOf("Netscape")!=-1);
				var keyCode = (isNN) ? e.which : e.keyCode;
				var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
				len = (isNN) ? len-1 : len;
				if(input.value.length >= len && !containsElement(filter,keyCode)){
					input.value = input.value.slice(0, len);
					elf = input.form[(getIndex(input)+1) % input.form.length];
					elf.value = '';
					elf.focus();

				}
				return true;
			}


			function CaptureEnterKey(e) {
	  		var isNN = (navigator.appName.indexOf("Netscape")!=-1);
			var keyCode = (isNN) ? e.which : e.keyCode;
   			if((isNNumeric(e) == 'true')) return true; else return false;

    		}

			bAutotab = true;

			function stopAutoTab() {
				bAutotab = false;
			}


			function loadCoupon(divid, customer_id, order_id){
					url = 'coupon_handler.php?action=display_enter_coupon&customer_id='+customer_id+'&order_id='+order_id;
					loader = 'Loading...'; // 'html for loading' or false
					effect = 'highlight'; // 'appear' , 'blind' , 'highlight' or false
					ecache = false; //cache for html file true or false
					$ajaxload(divid, url, loader, effect, ecache);
				}

			function applyCoupon(divid, divtextid, customer_id,order_id){
					var coupon_code = document.getElementById(divtextid).value;
					if(!coupon_code){return false;}else{
					url = 'coupon_handler.php?action=apply_coupon&coupon_code='+coupon_code+'&customer_id='+customer_id+'&order_id=' + order_id;
					loader = 'Loading...'; // 'html for loading' or false
					effect = 'highlight'; // 'appear' , 'blind' , 'highlight' or false
					ecache = false; //cache for html file true or false
					$ajaxload(divid, url, loader, effect, ecache);
					}
				}

			function submitRedeem(){
					var el = document.getElementById('gv_redeem_code').value;
					if(!el){
						return false;
						}else{
						return true;
							}
				}

			function changeRating(image){
					var star_img = '<img src="' + image + '" border="0">';
					document.getElementById('id_stars').innerHTML = star_img;
				}

				function couponpopupWindow(url) {
				window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150, left=150');
				}

				function cvvpopupWindow(url) {
				window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=200,screenX=150,screenY=150,top=150, left=150');
				}

				function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
function popupNewWindow(url, width, height) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+width+',height='+height+',screenX=150,screenY=150,top=150,left=150')
}
				function popupWishlistSample(url) {
				  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=450,screenX=150,screenY=150,top=150,left=150')
				}


function popupProductImage(url, image_src, image_name) {
	window.open(url + '?image_name='+image_name+'&image='+image_src,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
	//alert('ok, later..');
}


function showHide(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") {
		document.getElementById(d).style.display = "block";
	}
	else {
		document.getElementById(d).style.display = "none";
	}
}


function refresh_form(form_id) {
	if ( null != document.getElementById(form_id) ) {
		var the_form =	document.getElementById(form_id);
		the_form.action.value = 'refresh';
		the_form.state.value = '';
		the_form.submit();
	}
   return true;
}


function submitOrder() {
		var submit_button = document.getElementById('submit_final');
		var process_info = document.getElementById('order_process_info');

		document.getElementById('processing_img').style.display='block';
		submit_button.style.backgroundColor = '#A1A1A1';
		submit_button.style.borderColor = '#828282';

		submit_button.disabled = true;

		submit_button.value = 'Processing...';
		process_info.innerHTML = 'Your order is now being processed. <strong>Please wait...</strong>';
		document.getElementById('checkout_confirmation').submit();
		return true;
	}



	function suggest_display(id){
		// requires prototype

		var url = 'includes/suggest_handler.php';
		var pars = 'action=show_suggest';

		var myAjax = new Ajax.Updater(
				'id_suggest_description', url,
				{method: 'post', parameters: pars});


	}

function updatePrice(option_id, option_value_id){
	//$('id_products_price').innerHTML = 'NEW PRICE!';
	//alert('opt_id: ' + option_id + "\n" + 'opt_val_id:' + option_value_id);
}


	function checkAll(form_id) {
		var form = document.getElementById(form_id);
		for ( i = 0; i < form.elements.length; i++ ) {
			var e = form.elements[i];
				if ( e.type == 'checkbox' ) {
					e.checked = true;
				}
		}
	}

	function uncheckAll(form_id) {
		var form = document.getElementById(form_id);
		for ( i = 0; i < form.elements.length; i++ ) {
			var e = form.elements[i];
				if ( e.type == 'checkbox' ) {
					e.checked = false;
				}
		}
	}
	function inverseAll(form_id) {
		var form = document.getElementById(form_id);
		for ( i = 0; i < form.elements.length; i++ ) {
			var e = form.elements[i];
				if ( e.type == 'checkbox' ) {
					e.checked = !e.checked;
				}
		}
	}




	function switchProdImage(isrc) {
		var prodimg = document.getElementById('id_prodimg');

		/*
		var selectedPosX = 0;
		var selectedPosY = 0;

		while ( prodimg != null ) {
			selectedPosX += prodimg.offsetLeft;
			selectedPosY += prodimg.offsetTop;
			prodimg = prodimg.offsetParent;
		}
		var loading_prodimg = document.getElementById('loading_prodimg');
		if ( null != loading_prodimg ) {
			loading_prodimg.style.position = 'absolute';
			loading_prodimg.style.left = selectedPosX;
			loading_prodimg.style.top = selectedPosX;
		}
		*/

		var oImg = new Image();
		oImg.src = isrc;
		if (oImg.complete && prodimg != null) {
			prodimg.width = oImg.width;
			prodimg.height = oImg.height;
			prodimg.src = isrc;
			return true;
		} else {
			window.setTimeout('switchProdImage(\''+isrc+'\')', 1000);
		}
	}
	function CVVPopUpWindow(url) {
		window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=233,screenX=150,screenY=150,top=150,left=150')
	}

	function captcha_reload(){
		var captcha_src = document.getElementById('id_captcha').src;
		document.getElementById('id_captcha').src = captcha_src + '&reload=true';
	}