
function checkBrowser() {
        this.ver=navigator.appVersion
        this.dom=document.getElementById?1:0
		this.ie4=(document.all && !this.dom)?1:0;
		this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
		this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
       	this.ns4=(document.layers && !this.dom)?1:0;
        this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.ie6)
        return this
}

browser=new checkBrowser()

// declare global browser-specific DOM variables
var domStart,domEnd,domVis,domInvis,domBack

// set global browser-specific DOM variables
if(browser.ns4) {
	domStart = "document.layers['"
	domEnd = "']"
	domVis = "show"
	domInvis = "hide"
	domBack = ".bgColor"
} else {
	domVis = "visible"
	domInvis = "hidden"
	domBack = ".backgroundColor"
	
	if(browser.ie5) {
		domStart = "document.all."
		domEnd = ".style"
	} else if (browser.ns6 || browser.ie6) {
		domStart = "document.getElementById('"
		domEnd = "').style"
	}
}

//newWin = null

var newWin;
if(newWin) newWin.onload = focusOnNewWin;
function openWindow(url,width,height,browserProps) {
	if(browserProps == "all") {
		windowProperties = ",left=100,top=0,location=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,scrollbars=yes"
	} else if(browserProps == "file") {
		windowProperties = ",left=100,top=0,location=no,resizable=yes,menubar=yes,status=no,toolbar=no,scrollbars=yes"
	} else if(browserProps == "nolocation") {
		windowProperties = ",left=100,top=0,location=no,resizable=yes,menubar=yes,status=yes,toolbar=yes,scrollbars=yes"
	} else if(browserProps == "none") {
		windowProperties = ",left=100,top=0,location=no,resizable=no,menubar=no,status=no,toolbar=no,scrollbars=no"
 	} else {
		windowProperties =",left=100,top=0,location=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,scrollbars=yes"
	}

	if(!newWin || newWin.closed) {
		newWin = window.open(url,"","width="+width+",height="+height+windowProperties)
	} else {
  		newWin.close()
  		newWin = window.open(url,"","width="+width+",height="+height+windowProperties)
 	}
}
		
function onOff(item,status) {
// is the cursor over a sub menu item

	hexColor = status=="off" ? "<%=primaryColor%>" : "#99B27F"
	
	if(browser.ns4) {
		eval(domStart+"headerArea"+domEnd+"."+domStart+"headerNav"+domEnd+"."+domStart+item+domEnd+domBack+"='"+hexColor+"'");
	} else {
		eval(domStart+item+domEnd+domBack+"='"+hexColor+"'");
	}
	
}

function resizeHandler() {
	if (innerWidth != origWidth || innerHeight != origHeight) {
		origWidth = innerWidth;
		origHeight = innerHeight;
		document.location = document.location
	}
}

//window.onresize = resizeHandler()


		function changeShipping(dropDown) {
			document.forms.shippingcosts.submit()
		}
		
		function addrSame() {
			chkOutFrm = document.forms.checkout
			for(i=0;i<chkOutFrm.length;i++) {
				thisName = chkOutFrm[i].name
				thisType = chkOutFrm[i].type
				if(chkOutFrm.sameas.checked) {
					if(thisName.indexOf("ship_") > -1) {
						
						thisField = thisName.substring(thisName.indexOf("ship_")+5,thisName.length)
						
						if(thisType == "text") {
							thisValue = chkOutFrm[i].value
							eval("document.forms.checkout.bill_" + thisField + ".value='" + thisValue + "'")
						} else if(thisType.indexOf("select") > -1) {
							thisValue = chkOutFrm[i].selectedIndex
							eval("document.forms.checkout.bill_" + thisField + ".selectedIndex=" + thisValue)
						}
					}
				} else {
					if(thisName.indexOf("bill_") > -1) {
						
						if(thisType == "text") {
							chkOutFrm[i].value = ""
							
						} else if(thisType.indexOf("select") > -1) {
							chkOutFrm[i].selectedIndex = 0
						}
					}
				}
			}
			/* 
			chkOutFrm.ship_street1.value = chkOutFrm.bill_street1.value
			chkOutFrm.ship_street2.value = chkOutFrm.bill_street2.value
			chkOutFrm.ship_street3.value = chkOutFrm.bill_street3.value
			*/
		}
	
