function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function openWindow3(theURL)
	{ //v2.0
  window.open(theURL,"","scrollbars=yes,width=720,height=550");
	}
function open_win1(ship) {
	New_Win1 = window.open(ship,"new_Window1","height=333,width=430,toolbar=no,scrollbars=no,menubar=no");
	}
	var ship = "shipping_info.asp"
function open_win2(tax) {
	New_Win2 =window.open(tax,"new_Window2","HEIGHT=133,WIDTH=340,scrollbars=no,menubar=no");
	}
	var tax = "tax.asp"
function open_win3(zoom) {
	New_Win3 =window.open(zoom,"new_Window3","HEIGHT=670,WIDTH=550,scrollbars=no,menubar=no");
	}
	var zoom = "/zoom.asp"

function open_win4(giftpopup) {
            New_Win2 =window.open(giftpopup,"new_Window","HEIGHT=280,WIDTH=460,scrollbars=no,menubar=no");
            }
            var giftpopup = "/Common/HolidayCountDown/giftwrap_popup.asp"

function open_win7(billme) {
	New_Win7 =window.open(billme,"new_Window4","HEIGHT=480,WIDTH=470,scrollbars=yes,menubar=no");
	}
	var billme = "http://www.checkout-store.com/v30/popups/bml/whatis.asp"
function open_win8(pala) {
	New_Win7 =window.open(pala,"new_Window4","HEIGHT=535,WIDTH=470,scrollbars=yes,menubar=no");
	}
	var pala = "http://www.checkout-store.com/v30/popups/bml/pala.asp"
//yui function
function submitCallback(obj) {
	var response = obj.responseText;
	response = response.split("<!")[0];
	document.getElementById("resp").innerHTML = response;
	eval(response);
}

function showButton(buttonNumber) {
	document.getElementById(buttonNumber).style.display="";
}

function hideButton(buttonNumber) {
	document.getElementById(buttonNumber).style.display="none";
}

function swapImageIn(i) {		
	document.getElementById("qImg_"+i).src="/images/b_quickviewON.png";	
}

function swapImageOut(i) {		
	document.getElementById("qImg_"+i).src="/images/b_quickview.png";	
}

function initQuickView() {
	var handleCancel = function() {
		this.cancel();
	}
	var handleSubmit = function() {
		this.submit();
	}
	

	quickViewDialog = new YAHOO.widget.Dialog("QVdlg", { modal:true, visible:false, fixedcenter:true, constraintoviewport:true, draggable:true, close:false });
	var listeners = new YAHOO.util.KeyListener(document, { keys : 27 }, {fn:handleCancel,scope:quickViewDialog,correctScope:true} );
	quickViewDialog.cfg.queueProperty("keylisteners", listeners);
	
	var handleManual = function(type, args, obj) {
		alert("Manual submission of " + this.id + " detected");
	}

	quickViewDialog.manualSubmitEvent.subscribe(handleManual, quickViewDialog, true);
	quickViewDialog.render();
}
function selectAll() {
	var form = document.recalculate; 
	for (i = 0; i < form.elements.length; i++) {
		if (form.elements[i].type == "checkbox")
			form.elements[i].checked = true;
	}			
}
function Tax(x) {
	if (x == "show") {
		document.getElementById("taxBox").style.display = "block";
		document.getElementById("shipBox").style.display = "none";
	}
	else if (x == "hide")
		document.getElementById("taxBox").style.display = "none";
}
function Shipping(x) {
	if (x == "show") {
		document.getElementById("shipBox").style.display = "block";
		document.getElementById("taxBox").style.display = "none";
	}
	else if (x == "hide") {
		document.getElementById("shipBox").style.display = "none";
	}
}
function qv(current,total,fixed){
    if(current == 0){
         for (i=1;i<=total;i++){
         //close em all
           var block = "qv_" + i;
           document.getElementById(block).style.display = "none";
         }
    } else {
        for (i=1;i<=total;i++){
            if(i==current){
                var block = "qv_" + i;
                var vers = navigator.appVersion;
                document.getElementById(block).style.display = "block";
                if(fixed == 1){
                if (vers.indexOf("MSIE 6") > 0){
                    document.getElementById(block).style.position = "absolute";
                    document.getElementById(block).style.left = "50%";
                    document.getElementById(block).style.top = "50%";
                } else {
                    document.getElementById(block).style.position = "fixed";
                    document.getElementById(block).style.left = "50%";
                    document.getElementById(block).style.top = "50%";
                }
                    
                    document.getElementById(block).style.zIndex = 99;               
                }
               
            } else {
                block = "qv_" + i;
                document.getElementById(block).style.display = "none";
            }
        }
    }
}
function validateSearch(){
	var form = document.searchForm;
	var formVal = form.searchBox.value;
	if (formVal == ""){
		alert("Please enter a Keyword Search Phrase into this field before submitting");
		form.searchBox.focus();
    	return false;
	}
}
function validateQty() {
	var value = document.addtocart.cnt.value;
	var re = /^([1-9]|[1-9]\d|99)$/
	if ( re.test(value) ) 
	return true;
	alert("Enter a Valid Numeric Quantity and Click Add To Cart");
	return false;
}
function validateQtyForceRelated() {
	var value = document.addtocart.cnt.value;
	var re = /^([1-9]|[1-9]\d|99)$/
	if ( re.test(value) ){ 
	dialog.show();
	return false;
	}
	else {
	alert("Enter a Valid Numeric Quantity and Click Add To Cart");
	return false;
	}
}

// *********** CODE TO ENABGLE 'FORCE RELATED ITEMS' //yui functions **********
function submitCallback(obj) {
	var response = obj.responseText;
	response = response.split("<!")[0];
	document.getElementById("resp").innerHTML = response;
	eval(response);
}

function showButton(buttonNumber) {
	document.getElementById(buttonNumber).style.display="";
}

function hideButton(buttonNumber) {
	document.getElementById(buttonNumber).style.display="none";
}

function swapImageIn(i) {		
	document.getElementById("qImg_"+i).src="/images/quick_detail_button_over.gif";	
}

function swapImageOut(i) {		
	document.getElementById("qImg_"+i).src="/images/quick_detail_button.gif";	
}

function init() {
	var handleCancel = function() {
		this.cancel();
	}
	var handleSubmit = function() {
		this.submit();
	}
	
	dialog = new YAHOO.widget.Dialog("dlg", { modal:true, visible:false, fixedcenter:true, constraintoviewport:true, close:false, draggable:true });
	var listeners = new YAHOO.util.KeyListener(document, { keys : 27 }, {fn:handleCancel,scope:dialog,correctScope:true} );
	dialog.cfg.queueProperty("keylisteners", listeners);
	
	var handleManual = function(type, args, obj) {
		alert("Manual submission of " + this.id + " detected");
	}

	dialog.manualSubmitEvent.subscribe(handleManual, dialog, true);
	dialog.render();
}