<!--

	function checkboxCheckBU(nr) {
		if(document.billing.giftbox.checked=="1") {
			displayOn('giftdisplay');
			displayOn('giftdisplaytext');	
		} else {
			displayOff('giftdisplay');
			displayOff('giftdisplaytext');	
		}
	}
	
	function checkboxCheck(box,display,displaytext) {
		if(document.billing[box].checked=="1") {
			displayOn(display);
			displayOn(displaytext);	
		} else {
			displayOff(display);
			displayOff(displaytext);	
		}
	}

	function displayOff(nr){
		if (document.all)
			document.all[nr].style.display = 'none';
		else if (document.getElementById)
			document.getElementById(nr).style.display = 'none';
	}

	function displayOn(nr){
		if (document.all)
			document.all[nr].style.display = 'block';
		else if (document.getElementById)
			document.getElementById(nr).style.display = 'block';
	}


	//disables complete checkout images on confirm script.
	function disable() {
		var button = document.getElementById("submitbutton");
		var button2 = document.getElementById("submitbutton2");
		button.disabled = true;
		button2.disabled = true;
		return true;
	}

	// (C) 2003 CodeLifter.com
	// Source: CodeLifter.com
	// Do not remove this header

	// Set the message for the alert box
	// do not edit below this line
	// ===========================
	bV  = parseInt(navigator.appVersion)
	bNS = navigator.appName=="Netscape"
	bIE = navigator.appName=="Microsoft Internet Explorer"
	
	function nrc(e) {
	   if (bNS && e.which > 1){
	      return false
	   } else if (bIE && (event.button >1)) {
	     return false;
	   }
	}

	document.onmousedown = nrc;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	if (bNS && bV<5) window.onmousedown = nrc;


/*
	//openads main script
	<!--// <![CDATA[
	var OA_p=location.protocol=='https:'?'https:':'http:';
	var OA_r=Math.floor(Math.random()*99999999);
	if (!document.OA_used) document.OA_used = ',';
	function OA_adjs(z,n)
	{
	  if (z>-1) {
	    var az="<"+"script language='JavaScript' type='text/javascript' ";
	    az+="src='"+OA_p+"//www.tienda.com/admin/openads/www/delivery/ajs.php?n="+n+"&zoneid="+z;
	    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
	    az+="&mmm_fo="+(document.mmm_fo)?'1':'0';
	    if (document.context) az+= "&context=" + escape(document.context);
	    if (window.location) az+="&loc="+escape(window.location);
	    if (document.referrer) az+="&referer="+escape(document.referrer);
	    az+="'><"+"/script>";
	    document.write(az);
	  }
	}
	function OA_adpop(z,n)
	{
	  if (z>-1) {
	    var az="<"+"script language='JavaScript' type='text/javascript' ";
	    az+="src='"+OA_p+"//www.tienda.com/admin/openads/www/delivery/apu.php?n="+n+"&zoneid="+z;
	    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
	    if (window.location) az+="&loc="+escape(window.location);
	    if (document.referrer) az+="&referer="+escape(document.referrer);
	    az+="'><"+"/script>";
	    document.write(az);
	  }
	}
	// ]]> -->
*/

/*****************************************************************************/

/** QAS Ajax Auto-verification - Peter Quinsey, July 25 2007				**/



	/* The safer way to add multiple handlers to the window.onload event.

	 *

	 * Pass the name of the function you want to add the the onload event,

	 * and it will add it to the function queue for the event.

	 */

	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			}
		}
	}

	function initQASVerify() {
		if (document.getElementById("ship_qas")) {
			document.infocollect.zip_shp.onchange = function() {
				verifyShippingAddress()
			}

			document.getElementById("replace_address_with_qas").onclick = function() {
				document.infocollect.address1_shp.value = document.getElementById("ship_address1").innerHTML;
				document.infocollect.address2_shp.value = document.getElementById("ship_address2").innerHTML;
				document.infocollect.city_shp.value = document.getElementById("ship_city").innerHTML;
				document.infocollect.state_shp.value = document.getElementById("ship_state").innerHTML;
				document.infocollect.zip_shp.value = document.getElementById("ship_zip").innerHTML;
				if (document.infocollect.same_as_bill.checked == true) {
					document.infocollect.address1_bill.value = document.getElementById("ship_address1").innerHTML;
					document.infocollect.address2_bill.value = document.getElementById("ship_address2").innerHTML;
					document.infocollect.city_bill.value = document.getElementById("ship_city").innerHTML;
					document.infocollect.state_bill.value = document.getElementById("ship_state").innerHTML;
					document.infocollect.zip_bill.value = document.getElementById("ship_zip").innerHTML;
				}
				document.getElementById("ship_qas").style.display = "none";
				document.getElementById("ship_address1").innerHTML
					= document.getElementById("ship_address2").innerHTML 
					= document.getElementById("ship_city").innerHTML
					= document.getElementById("ship_state").innerHTML
					= document.getElementById("ship_zip").innerHTML
					= "";
				return false;
			}
			if (document.infocollect.zip_shp.value.length > 0)
				verifyShippingAddress();
		}
	}

	function initQASCatalogVerify() {

		if (document.getElementById("catalog_qas")) {
			document.infocollect.zip_shp.onchange = function() {
				verifyCatalogAddress()
			}

			document.getElementById("replace_address_with_qas").onclick = function() {
				document.infocollect.address1_shp.value = document.getElementById("ship_address1").innerHTML;
				document.infocollect.address2_shp.value = document.getElementById("ship_address2").innerHTML;
				document.infocollect.city_shp.value = document.getElementById("ship_city").innerHTML;
				document.infocollect.state_shp.value = document.getElementById("ship_state").innerHTML;
				document.infocollect.zip_shp.value = document.getElementById("ship_zip").innerHTML;
				document.getElementById("catalog_qas").style.display = "none";
				document.getElementById("ship_address1").innerHTML
					= document.getElementById("ship_address2").innerHTML 
					= document.getElementById("ship_city").innerHTML
					= document.getElementById("ship_state").innerHTML
					= document.getElementById("ship_zip").innerHTML
					= "";
				return false;
			}
		}
	}

	addLoadEvent(initQASVerify);
	addLoadEvent(initQASCatalogVerify);

	function error(msg) {
		/*alert(msg);*/
	}

	function verifyShippingAddress() {
		if (document.infocollect.country_shp.value == "001") { 		// US addresses only!
			url = "/cart/remote_qas.html?";
			url += "address1_shp=" + document.infocollect.address1_shp.value;
			url += "&address2_shp=" + document.infocollect.address2_shp.value;
			url += "&city_shp=" + document.infocollect.city_shp.value;
			url += "&state_shp=" + document.infocollect.state_shp.value;
			url += "&zip_shp=" + document.infocollect.zip_shp.value;
			url += "&sid=" + document.infocollect.sid.value;
			loadXMLDoc(url);
		}
	}

	function verifyCatalogAddress() {
		if (document.infocollect.country.value == "001") { 		// US addresses only!
			url = "/cart/remote_catalog_qas.html?";
			url += "address1_shp=" + document.infocollect.address1_shp.value;
			url += "&address2_shp=" + document.infocollect.address2_shp.value;
			url += "&city_shp=" + document.infocollect.city_shp.value;
			url += "&state_shp=" + document.infocollect.state_shp.value;
			url += "&zip_shp=" + document.infocollect.zip_shp.value;			
			loadXMLDoc(url);
		}
	}

	function processQASResults(response) {
		resultText = response.getElementsByTagName('result')[0].firstChild.data;
		if (resultText == "Address Verified") {
			if (response.getElementsByTagName('zip')[0].firstChild) {
				zip = response.getElementsByTagName('zip')[0].firstChild.data
				document.infocollect.zip_shp.value = zip;
				if (document.infocollect.same_as_bill.checked == true)
					document.infocollect.zip_bill.value = zip;
			}
		} else if (resultText == "Incorrect Address - Single Address Suggested") {
			/* I'm processing each element individually, so we're more flexible in case of
			 * fragmented addresses (and so we don't overwrite existing form entries with
			 * blank data).
			 */
			if (response.getElementsByTagName('address1')[0].firstChild)
				document.getElementById("ship_address1").innerHTML = response.getElementsByTagName('address1')[0].firstChild.data;
			if (response.getElementsByTagName('address2')[0].firstChild)
				document.getElementById("ship_address2").innerHTML = response.getElementsByTagName('address2')[0].firstChild.data;
			if (response.getElementsByTagName('city')[0].firstChild)
				document.getElementById("ship_city").innerHTML = response.getElementsByTagName('city')[0].firstChild.data;
			if (response.getElementsByTagName('state')[0].firstChild)
				document.getElementById("ship_state").innerHTML = response.getElementsByTagName('state')[0].firstChild.data;
			if (response.getElementsByTagName('zip')[0].firstChild)
				document.getElementById("ship_zip").innerHTML = response.getElementsByTagName('zip')[0].firstChild.data;

			if (document.getElementById("catalog_qas")) { document.getElementById("catalog_qas").style.display = "block"; }
			if (document.getElementById("ship_qas")) { document.getElementById("ship_qas").style.display = "block"; }
		}
	}

	/* Our XMLHTTPRequest object.  Needs to be global. */
	var req; 

	/* Send out a request for an XML document. */
	function loadXMLDoc(url) {
		if (window.XMLHttpRequest) { 	// native XMLHttpRequest object, Moz family
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);
		} else if (window.ActiveXObject) {	// ActiveX for IE
			req = new ActiveXObject("Microsoft.XMLHTTP");
			if (req) {
				req.onreadystatechange = processReqChange;
				req.open("GET", url, true);
				req.send();
			}
		}
	}

	/* Receive the response for the XML document. */
	function processReqChange() {
		if (req.readyState == 4) {		// 4 is "complete"
			if (req.status == 200) {		// HTTP OK
				processQASResults(req.responseXML.documentElement);
			} else {
				error(req.status + ": A problem was encountered retrieving the XML data: \n" + req.statusText);
			}
		}
	}

/** End of QAS Ajax Auto-verification										**/
/*****************************************************************************/

/** JQuery Functions **/
$(document).ready(function(){ 
	$('.display_tooltip').tooltip({
		track:true,
		delay:0,
		showURL:false,	
		fade:350
	});

	$("#more_reviews").live("click",function() {
		var skus=$("#more_reviews").attr("title").split(":");
		//alert("sku: "+skus[0]+" start: "+skus[1]);
		$("#product_comments").load("/includes/product_comments.inc.php",{sku: skus[0],start: skus[1]});
	});
});

function emailCheckoutSubmit(event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if(keyCode==13) { self.document.checkoutform.checkout_action.value="checkout"; }
}
-->