if (window != top && document.location.protocol == "http:") {
    top.location.href = location.href;
}


function vsignpopUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin"; 
}
var aWindow;
function heclosed()
{
        aWindow=null;
}
function openWin(URL){
        if(navigator.appName=="Microsoft Internet Explorer")
        {
                aWindow =window.open(URL,"siteWindow","resizable=no,toolbar=0,width=420,height=560,status=0,scrollbars=0,menubar=0");
        }
        else
                if(aWindow!=null)
                {
                        aWindow.location = URL;
                        aWindow.focus();
                }
                else
                {
                        aWindow = window.open(URL,"siteWindow","resizable=no,toolbar=0,width=420,height=540,status=0,scrollbars=0,menubar=0");
                }
}
function openWinPssl(URL){
        if(navigator.appName=="Microsoft Internet Explorer")
        {
                aWindow =window.open(URL,"siteWindow","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=800,height=550");
        }
        else
                if(aWindow!=null)
                {
                        aWindow.location = URL;
                        aWindow.focus();
                }
                else
                {
                        aWindow = window.open(URL,"siteWindow","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=800,height=550");
                }
}
function openChatWin(URL){
        if(navigator.appName=="Microsoft Internet Explorer")
        {
                aWindow =window.open(URL,"siteWindow","resizable=no,toolbar=0,width=130,height=75,status=0,scrollbars=0,menubar=0");
        }
        else
                if(aWindow!=null)
                {
                        aWindow.location = URL;
                        aWindow.focus();
                }
                else
                {
                        aWindow = window.open(URL,"siteWindow","resizable=no,toolbar=0,width=130,height=75,status=0,scrollbars=0,menubar=0");
                }
}
function openItemPricing(itemno) {
	window.open('/item/itempricing.aspx?itemno=' + itemno, 'myname', 'width=600,height=600');
}
function openGenericItemPricing() {
	window.open("/item/itempricing.aspx", "myname", "height=600,width=700,scrollbars=yes");
}
function openFreeshipping() {
	//var s = '/customerservice/shippingrestrictions.aspx';
	var s='/item/itempricing.aspx';
	window.open(s, 'myname', 'width=600,height=400,scrollbars=yes');
}
function openPopup(url, title, w, h) {
    window.open(url, title, "height=" + h + ",width=" + w + ",scrollbars=yes");
}

function openVcode() {
	window.open("/MyAccount/VCode.aspx", "vcodewin", "height=350,width=350,scrollbars=yes");
}
function openVcodeW() {
	window.open("/secure/VCode.htm", "vcodewin", "height=350,width=350,scrollbars=yes");
}
function openEmailForPrice(id) {
	window.open('/item/pricerequest.aspx?itemno=' + id + '&mode=1', 'myname', 'width=500,height=500');
}
function openCallForPrice(itemno) {
	window.open("/item/pricerequest.aspx?itemno=" + itemno + "&mode=2", "callforpricewin", "width=600,height=500");
}
function getCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i,j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i==0) break;
	}
	
	return null;
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function openWUValueProp(){
	window.open('/includes/westernunion/quick_pay.aspx', 'myWin', 'width=500,height=440');
}
function openMAP(){
	window.open('/item/map.htm','map','width=500,height=100');
}
function openMAP(list){
	window.open("/item/map.aspx?l=" + list +"",'map','width=600,height=120');
}
function openReturnPolicy(id) {
	self.name = 'parentwindow';
	window.open('/item/ReturnPolicy.aspx?status=' + id, 'myname', 'width=400,height=150');
}
function openProdAvail(po, availtype,date,showcart) {
	if (date == null)
		date = "";
	date = date.replace(" ", "%20");
	if (showcart == null)
		showcart = 0;
	window.open("/item/availability.aspx?itemno=" + po + "&availtype=" + availtype + "&d=" + date + "&c=" + showcart, "availwin", "width=480,height=330,scrollbars=1");
}
function openOutletDef(id,free){
	window.open("/outlet/OutletDefinitions.aspx?free=" + free + "#" + id,'def','width=500,height=200,scrollbars=yes');
}
function openExtraImages(prodid) {
	window.open('/item/extraimages.aspx?p=' + prodid,'myname','width=1050,height=800');
}
function openLargerImage(s, sizeid, zpic) {
    var newid = sizeid;

    switch (newid) {
	    case "1":
		    window.open('/item/expandedimage.aspx?t=1&img=' + escape(s) + "&zimg=" + escape(zpic), 'myname', 'width=650,height=710,scrollbars=yes,resizable=yes');
		    break;
	    case "2":
		    window.open('/item/expandedimage.aspx?t=2&img=' + escape(s) + "&zimg=" + escape(zpic), 'myname2', 'width=1050,height=450,resizable=yes');
		    break;
	    case "3":
		    window.open('/item/expandedimage.aspx?t=3&img=' + escape(s) + "&zimg=" + escape(zpic), 'myname3', 'width=300,height=360,resizable=yes');
		    break;
		case "4":
		    window.open('/item/expandedimage.aspx?t=4&img=' + escape(s) + "&zimg=" + escape(zpic), 'myname3', 'width=300,height=300,resizable=yes');
		    break;
	    default:
    		
		    window.open('/item/expandedimage.aspx?t=1&img=' + escape(s) + "&zimg=" + escape(zpic), 'myname4', 'width=650,height=650,resizable=yes');
		    break;
	    }
}
function openFree(itemno){
	window.open("/item/free.aspx?itemno=" + itemno,'free','width=500,height=200');
}
function openProdFiles(prodid,filetypeid,itemno){
	window.open("/Item/ProdFiles.aspx?prodid=" + prodid + "&f=" + filetypeid + "&itemno=" + itemno,'download','width=500,height=400');
}
function openWarranty(itemno) {
	window.open('/item/warranty.aspx?itemno=' + itemno, 'myname', 'width=600,height=200');
}	
function openGlossary(id) {
	window.open("/content/Glossary.aspx?id=" + id,"glossary","width=400,height=200");
}
function openBrandStory(id){
	window.open("/brand/brandstory.aspx?b=" + id,"win","width=545,height=400,scrollbars=yes");
}
function openFreeShippingPopup(){
	self.name = 'parentwindow';
	window.open("/GC-Free-Shipping-Popup-g10003t0.gc","win","width=530,height=550,scrollbars=yes");
}
function openFinanceLink(){
	self.name = 'parentwindow';
	//window.open("/customerservice/popupFinance.html","win","width=700,height=400,scrollbars=yes");
	window.open("/customerservice/creditapp.aspx?ispopup=1","win","width=880,height=700,scrollbars=yes");
}
function showWhyNoFreeShip() {
	window.open("/CustomerService/PopupWhyFS.html", "win", "width=600,height=400");
}
// Nav handling
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function setHClick(s) 
{
    document.cookie = "h_click=" + escape(s);
    return true;
}

