function getHTTPObject() {
	var xhr = false;
	if (window.XMLHttpRequest) {
		var xhr = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			var xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				var xhr = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
			var xhr = false;
			}
		}
	}
	return xhr;
}

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 openWindowVideo(theURL)
	{ 
 	New_WinVideo = window.open(theURL,"3D_Video","height=362,width=558,toolbar=no,scrollbars=no,menubar=no");
	}
	
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_win360(zoom360) {
    New_Win360 =window.open(zoom360 + '?edp360=' + edp360,"New_Win360","HEIGHT=670,WIDTH=550,scrollbars=no,menubar=no");
    }
    var zoom360 = "/360.asp"	
    var edp360;
	
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 == "" || formVal == " " || formVal == "  SEARCH STORE"){
		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 Priority_info(x) {
	if (x == "show") {
		document.getElementById("priority_info_box").style.display = "block";
		document.location.href = "#";
	}
	else if (x == "hide")
		document.getElementById("priority_info_box").style.display = "none";
}

function priority_err(x) {
	if (x == "show") {
		document.getElementById("priority_err").style.display = "block";
		document.location.href = "#";
	}
	else if (x == "hide")
		document.getElementById("priority_err").style.display = "none";
}

function closeSoftPop() {
    killSoftPop = 1;
    softPopWindow = window.open("","softPopWindow","status=1,width=350,height=150");
    softPopWindow.close();
}