	// rf: taken from navigation.js [depreciated July 2002] - not related to show/hide menus
	// hm
	if(window.event + "" == "undefined") event = null;
	function HM_f_PopUp(){return false};
	function HM_f_PopDown(){return false};
	popUp = HM_f_PopUp;
	popDown = HM_f_PopDown;

	// rf: taken from stylesniffer.js [depreciated - July 2002]
	// set up the appropriate stylesheet here
	var bMac = false;
	if  ( navigator.userAgent.indexOf("Mac") != -1 ) { bMac = true;}
	
	// check to see if this is a version 4 browser
	var oldBrowser=false;//Standards Compliant Browser
	if (document.all && !document.getElementById) { var oldBrowser="true"; } //IE4 
	else if (document.layers) { var oldBrowser="true"; } //Netscape Navigator 4
	else if (document.getElementById) { var oldBrowser=false; } //Standards Compliant Browser
			
	if  ( bMac ) {
		if (oldBrowser) {
			document.write("<link rel='stylesheet' href='/css/mac.css' type='text/css'/>")
		} else {
			document.write("<link rel='stylesheet' href='/css/main.css' type='text/css'/>");
		}
	} else {
		document.write("<link rel='stylesheet' href='/css/main.css' type='text/css'/>");
	}

	
	//Q2 DEPRECIATE
	function update (theform) {
		if (check_form(theform)) {
			theform.submit();
		}
	}
	
	//Q2 DEPRECIATE
	function changed_row (theform,row_num, col_num, total_cols) {
		theform.elements[row_num*total_cols+col_num].value = "yes";
		theform.Update_needed.value = "yes";
	}

	//Q2 DEPRECIATE - USED IN ACCTREG ONLY
	function action_to_perform (theform,action) {
		theform.Action.value = action;
		
		if (check_form(theform)) {
			theform.submit();
		}
	}
	
	//Q2 DEPRECIATE
	function changeImgOver(imgName){
		imgName.src = menuImg1;
	}

	//Q2 DEPRECIATE
	function changeImgOut(imgName){
		imgName.src = menuImg0;
	}
			
	//Q2 DEPRECIATE
	function Trim(s){
	  return LTrim(RTrim(s));
	}

	//Q2 DEPRECIATE
	function LTrim(s){
	  return s.replace(/^\s+/,'');
	}

	//Q2 DEPRECIATE
	function RTrim(s){
	  return s.replace(/\s+$/,'');
	}

	// Q2 DEPRECIATE REPLACE WITH: closePopUpWin
	function closeWin(){
		window.close();
		}

	// Q2 DEPRECIATE REPLACE WITH: openPopUpWin
	function openURL(popURL, popWidth, popHeight) {
		window.open(popURL, 'GrandAndToyPopUpWindow', 'width=' + popWidth + ',height=' + popHeight);
	}

	/* The following functions are used but should be replaced */
	
	// Q2 DEPRECIATE REPLACE WITH:
	function GetCookie (name) {
		var dcookie = document.cookie; 
		var cname = name + "=";
		var clen = dcookie.length;
		var cbegin = 0;
		
		while (cbegin < clen) {
			var vbegin = cbegin + cname.length;
			if (dcookie.substring(cbegin, vbegin) == cname) { 
				var vend = dcookie.indexOf (";", vbegin);
					if (vend == -1) vend = clen;
					return unescape(dcookie.substring(vbegin, vend));
			}
			cbegin = dcookie.indexOf(" ", cbegin) + 1;
			if (cbegin == 0) break;
		}
		return null;
	}
	
	// Q2 DEPRECIATE:
	function SetCookie (name, value, expires) {
		if (!expires) expires = new Date();
		document.cookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() +  "; path=/";
	}	
	
	// REPLACE WITH: openPopUpWin
	function popWindow(URL,name,widgets) {
		popwin = window.open(URL, name, widgets)		
		popwin.opener = self	
		popwin.focus()
		window.name = "MainWin"			
		}
	
	function screen_changed (object) {
		object.value = "yes";
	}

	function goto_page(theform,page) {
		theform.Current_page.value = page;
		theform.submit();
	}
	
	var popup = new Array(1);
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;

	// REPLACE WITH: openPopUpWin
	function open_window (index, url, name, feature, width, height) {
		window_index = index;
		load_url = url
		window_name = name
		window_feature = feature + ',width=' + width + ',height=' + height
         
		var message;
		language = GetCookie("Lang");
		if(language=="en"){
			message = "New window cannot be opened. Free some memory and try again.";
		} else{
              message="Une nouvelle fenêtre ne peut pas être ouverte. Libérez de la mémoire et essayez de nouveau.";
        }
		if (NS4) {
			x = parseInt ((screen.width - width) / 2, 10)
			y = parseInt ((screen.height - height) / 2, 10)
			window_feature += ',screenX=' + x + ',screenY=' + y
			popup[window_index] = window.open (load_url, window_name, window_feature)
			if (popup[window_index] == null)
				alert (message);
			else
				popup[window_index].focus();
		} else {
			if (popup[window_index] != null && !popup[window_index].closed) {
				popup[window_index].focus();
				if (load_url != "")
					popup[window_index].location.href = load_url;
			} else {
				x = parseInt ((screen.width - width) / 2, 10)
				y = parseInt ((screen.height - height) / 2, 10)
				window_feature += ',top=' + x + ',left=' + y
				popup[window_index] = window.open (load_url, window_name, window_feature);
				popup[window_index].focus();
			}
		}
	}
	 
	function logoff () {
		var ck_sLang = getCookie("Lang");
		if (ck_sLang.toUpperCase() != "EN" && ck_sLang.toUpperCase() != "FR"){ck_sLang = "EN";}
		if(ck_sLang.toUpperCase()!="FR"){message = "Are you sure you want to sign off?";} else {	message="Êtes-vous certain de vouloir quitter?";}
		if (confirm(message)) {
			self.location="/shopping/xt_logoff.asp";
		}
	}

	function help_alert () {
		var ck_sLang = getCookie("Lang");
		if (ck_sLang.toUpperCase() != "EN" && ck_sLang.toUpperCase() != "FR"){ck_sLang = "EN";}
		if(ck_sLang.toUpperCase()!="FR") {
			message = "We are currently updating this section.\nPlease contact grandandtoy.com Customer Service.\n\n(English) 1-877-860-2910 or customerservice@grandtoy.com\n\n(French) 1-800-669-3360 or servicealaclientele@grandtoy.com"
		} else {
			message="Cette section est en cours de mise à jour.\nVeuillez communiquer avec le service à laclientèle de Grand & Toy.\n\n(en anglais) 1-877-860-2910 ou à l’adresse customerservice@grandtoy.com\n\n(en français) 1-800-669-3360 ou à l’adresse servicealaclientele@grandtoy.com";
		}
		alert(message);
	}

	 /* Q2 FUNCTIONS START HERE - CLEAN UP */
	function openPopUpWin(purl, pwidth, pheight, scroll) {
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
	
		if (scroll)
        {
            params += ',scrollbars';
        }

		window.open(purl,'',params);
	}

   // returns a reference to a named window
   // use to return focus to an existing window
    function openNamedPopUpWindow(purl, pname, pwidth, pheight, scroll)
    {
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) 
        {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
	
        if (scroll) 
        {
            params += ',scrollbars';
        }

		return window.open(purl, pname, params);
	}
    
    function openFullWindow(purl) {
		
		var pheight = 400;
		var pwidth = 800;
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
		
		params += ',resizable,scrollbars,toolbar,status,menubar,location';
		window.open(purl, '', params);
	}
	
	function openResizePopup(purl) {
	
		var pheight = 400;
		var pwidth = 500;
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
		
		params += ',resizable,scrollbars,toolbar,status,menubar,location';
		pname = 'GrandToyWindow';
		window.open(purl, pname, params);
	}
	
	function openProductDetailsPopUp(pcode, psite) {
	    if (psite > 0) {purl = "/shopping/ProductDetailsPopup.aspx?productCode=" + pcode; } else { purl = "/sites/CORP/ProductDetailsPopup.aspx?productCode=" + pcode; }
		openPopUpWin(purl, 520, 410, true);		
	}							
	
	function openCompareDetailsPopUp(pcode, plin, psg1, psite) {
		if (psite > 0) {purl = "/shopping/catalogue/compare_product_detail.asp?pc=" + pcode + "&plcode=" + plin + "&psg=" + psg1}else{purl = "/CorporatePages/compare_product_details.asp?pcode=" + pcode + "&plcode=" + plin + "&psg=" + psg1;}
		openPopUpWin(purl, 520, 410, true);		
	}							
	
	function openProductDetailsWithQty(pcode, psite,pseq) {
		if (psite > 0) {purl = "/shopping/catalogue/product_detail_popup.asp?pc=" + pcode + "&pseq=" + pseq}else{purl = "/CorporatePages/product_details.asp?pcode=" + pcode;}
		openPopUpWin(purl, 520, 410, true);		
	}		
	
	function openProductDetailsWithTemplate(pcode,psite,pseq,templateID,quantity) {
		if (psite > 0) {purl = "/shopping/catalogue/product_detail_popup.asp?pc=" + pcode + "&pseq=" + pseq + "&templateID=" + templateID + "&qty=" + quantity}else{purl = "/CorporatePages/product_details.asp?pcode=" + pcode;}
		openPopUpWin(purl, 520, 410, true);		
	}	
	
	function closePopUpWin(){
	  window.close();
	 }

	function deleteOrderItem(vOrderDetailSeq){
		var ck_sLang = getCookie("Lang");
		if (ck_sLang.toUpperCase() != "EN" && ck_sLang.toUpperCase() != "FR"){ck_sLang = "EN";}
		if  (ck_sLang.toUpperCase() == "FR"){
			var message = "Êtes-vous certain de vouloir supprimer cet article?";
		} else {
			var message = "Are you sure you want to delete this item?";
		}
		if (confirm (message)){
			document.objOrderSumFrm.line_seq.value = vOrderDetailSeq;
			document.objOrderSumFrm.action = "/Shopping/xt_removeOrderItem.asp";
			document.objOrderSumFrm.submit();
		}
	}
	
	function manageOrderSummary(nID) {
		var ck_sLang = getCookie("Lang");
		var no_order = false;
		
		if (ck_sLang.toUpperCase() != "EN" && ck_sLang.toUpperCase() != "FR"){ck_sLang = "EN";}
		var sAlert = "There are currently no products in your order";
		if (ck_sLang.toUpperCase() == 'FR'){sAlert = "Votre commande ne contient présentement aucun produit";}

		
		if (document.objOrderSumFrm!=null)
		{
			if (document.objOrderSumFrm.item_count.value == 0 ) {
				no_order = true;
				alert(sAlert);
			}
		} 
		
		if(!no_order)
		{
			switch (nID) {
				case 1 : self.location.href = "/shopping/order/order_details.asp?od_style=vod";
				break;
				case 2 : openPopUpWin('/shopping/please_wait.asp?myaction=%2fshopping%2forder%2fpreview.aspx&method=get', 660, 480, true);
				break;
				case 3 : self.location.href = "/shopping/checkout/CheckoutRedirect.asp";
				break;
				case 4 : 
					if (ck_sLang.toUpperCase() == 'FR') {
						var message = "Êtes-vous certain de vouloir annuler cette commande?"
					} else {
						var message = "Are you sure you want to cancel this order?"
					}

					if (confirm(message)) {
						self.location.href = "/shopping/order/xt_cancel_order.asp";
					}
					break;

	            case 5:
	                /**/
	                if ( GetCookie("promotion") == "Y" ) 
	                {
	                    var sAlert = "Products highlighted in orange were originally promotional items that may be re-priced or removed when the order is copied or re-opened.";

	                    if (ck_sLang.toUpperCase() == 'FR') {
	                        sAlert = "Les produits en surbrillance orange sont des articles en promotion dont le prix pourrait avoir changé ou qui pourraient avoir été supprimés quand la commande sera rouverte."
	                    }
	                    alert(sAlert);
	                }
	                break;
            				
				case 6 : 
					if (ck_sLang.toUpperCase() == 'FR') {
						var message = "Êtes-vous certain de vouloir annuler ce panier?"
					} else {
						var message = "Are you sure you want to cancel this cart?"
					}

					if (confirm(message)) {
						self.location.href = "/shopping/order/xt_cancel_order.asp";
					}
				break;
                }
                
		}
	}

	function validateQuickSearchFrm(objFrm) {
		var ck_sLang = getCookie("Lang");
		if (ck_sLang.toUpperCase() != "EN" && ck_sLang.toUpperCase() != "FR"){ck_sLang = "EN";}
		if (ck_sLang.toUpperCase() == "FR"){sAlert = "Veuillez entrer un mot clé ou un code de produit.";}else{sAlert = "Please enter a keyword or Product Code.";}
		if (objFrm.txtInput.value== "")
		{
			alert(sAlert);
		}
		else 
		{
			objFrm.submit();
		}
	}

	function getCookie (name) {
		var dcookie = document.cookie; 
		var cname = name + "=";
		var clen = dcookie.length;
		var cbegin = 0;
		
		while (cbegin < clen) {
			var vbegin = cbegin + cname.length;
			if (dcookie.substring(cbegin, vbegin) == cname) { 
				var vend = dcookie.indexOf (";", vbegin);
					if (vend == -1) vend = clen;
					return unescape(dcookie.substring(vbegin, vend));
			}
			cbegin = dcookie.indexOf(" ", cbegin) + 1;
			if (cbegin == 0) break;
		}
		return '';
	}
	
	function setCookie (name, value, expDays) {
		if (!expDays) {
			expDays = 180;
		}

		expires = new Date();
		expires.setTime(expires.getTime() + expDays * 24 * 60 * 60 * 1000);

		document.cookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() +  "; path=/";
	}

	function openPopupAnnouncement () {
		var ecpopup = getCookie("ecpopup");
		var ck_sLang = getCookie("Lang");
		var sUserId = getCookie("UserID");

		if (sUserId != '') {
			if (ecpopup.toUpperCase() != "Y") {
				setCookie ("ecpopup", "Y", 90);

				var purl = "/popup/ExpressCheckout/" + ck_sLang + "_ExpressCheckoutPopup.html";
				var pwidth = 478;

				if (ck_sLang.toUpperCase() == "FR") {
					var pheight = 370;
					var purl = "/popup/ExpressCheckout/fr_ExpressCheckoutPopup.html";
				} else {
					var pheight = 330;
					var purl = "/popup/ExpressCheckout/en_ExpressCheckoutPopup.html";
				}				

				var scroll = false;
				var params = "height=" + pheight + ",innerHeight=" + pheight;

				params += ",width=" + pwidth + ",innerWidth=" + pwidth;

				if (window.screen) {
					var ah = screen.availHeight - 30;
					var aw = screen.availWidth - 10;
					var xc = (aw - pwidth) / 2;
					var yc = (ah - pheight) / 2;
					params += ",left=" + xc + ",screenX=" + xc;
					params += ",top=" + yc + ",screenY=" + yc;
				}
			
				if (scroll) {params += ',scrollbars';}

				pname = 'AnnouncementPopupWindow';
				window.open(purl, pname, params);
			}
		}
	}

	function openMessagePopUpWin(purl, pwidth, pheight, scroll) {
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
	
		if (scroll) {params += ',scrollbars';}

		pname = 'MessageCentrePopup';
		window.open(purl, pname, params);
	}

	function MessageCentre() {
		if (getCookie("NewMessages") == "Y") {
			setCookie("NewMessages", "", 0);
			openMessagePopUpWin("/shopping/account/messagecentre/ViewPopupMessages.aspx", 450, 450, true);
		}
		// Popup message, based on 'Messaging on Select account' attribute		
		if (getCookie("messagePopup") == "Y") {
			setCookie("messagePopup", "", 0);
			openMessagePopUpWin("/shopping/MessagePopup.aspx", 550, 690, true);
		}
		
	}

	function openProductSubst() {
		return window.open("/shopping/modal_order_substitutions.asp?URL="+ escape(window.location.href),"dlog","height=322,width=586,scrollbars,modal=yes");
	}		

    function openProductUOMSubst() {
		return window.open("/shopping/modal_uom_substitutions.asp?URL="+ escape(window.location.href),"dlog","height=322,width=586,scrollbars,modal=yes");
	}	
	
	function openCustomerSku() {
		return window.open("/shopping/order/modal_customer_sku.asp?URL="+ escape(window.location.href),"dlog","height=322,width=586,scrollbars,modal=yes");
	}
	function openCustomerSkuTemplate() {
		return window.open("/shopping/template/modal_customer_sku_template.asp?URL="+ escape(window.location.href),"dlog","height=322,width=586,scrollbars,modal=yes");
	}
	//HG:TTT 4406 Pop up for cust_type = 1 apprear only once to customer
		
	window.onLoad = MessageCentre();

	var isNN = (navigator.appName.indexOf("Netscape")!=-1);

	function autoTab(input, len, e) {
		var keyCode = (isNN) ? e.which : e.keyCode; 
		var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
		if(input.value.length >= len && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
		function containsElement(arr, ele) {
			var found = false;
			var index = 0;
			while(!found && index < arr.length)
				if(arr[index] == ele)
					found = true;
				else
					index++;
			return found;
		}
		function getIndex(input) {
			var index = -1;
			var i = 0;
			var found = false;
			while (i < input.form.length && index == -1)
				if (input.form[i] == input)
					index = i;
				else 
					i++;
			return index;
		}
		return true;
	}

    function openDEFPopUpWindow(purl, pname, pwidth, pheight)
    {
		var params = "height=" + pheight + ",innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen) 
        {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
	
		params += ',resizable,scrollbars';
		
		window.open(purl, pname, params);
	}

	function openLargeImagePopUpWin(purl) {
		var pheight;
		var pwidth;
		var params;
		
		if (window.screen) {
			if (screen.availHeight <= 600) {
				pheight = 500;
				pwidth = 630;
			} else {
				pheight = 650;
				pwidth = 610;
			}

			params = "height=" + pheight + ",innerHeight=" + pheight;
			params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
	
		if (screen.availHeight <= 600 && !isNN)
        {
            params += ',resizable,scrollbars';
        }

		if (screen.availHeight <= 600 && isNN)
        {
            params += ',scrollbars=yes,resizable=yes';
        }

		window.open(purl,'',params);
	}
	
/*	function fuelSurcharge() {
		
		setCookie("fs", "", 0);
		
		var ck_sLang = getCookie("Lang");
		var popupIsShown = getCookie("fsOct3");
		var showPopup = getCookie("showFS");
		
		if (showPopup == "y") {
			if (popupIsShown != "y") {
				if (ck_sLang.toUpperCase() == "FR") {
					openPopUpWin("/popup/FuelSurcharge/fr_FuelSurchargeOct3.html", 505, 320, true);
				} else {
					openPopUpWin("/popup/FuelSurcharge/en_FuelSurchargeOct3.html", 505, 260, true);
				}
				setCookie("fsOct3", "y", "");
			}
		}
		
	}	
	window.onload = fuelSurcharge;*/


	function paperPopup()
	{
		 var showPaperPopup = getCookie("showPPNew");
		 if (showPaperPopup != "Y")
		 {
			  openPopUpWin("/popup/paper/paperpopup.asp",615,360,false)
        	  //document.cookie = "showPP" + "=" + escape ("Y") + "; path=/";
			  setCookie("showPP", "Y",30);
		 }
		
	 }

	function NewCataloguePopup()
	{

		 var showCataloguePopup = getCookie("showNewCatalogue");
		 var language = GetCookie("Lang");
		 if (showCataloguePopup == "1")
		 {
			  openPopUpWin("/popup/shownewcatalogue/" + language + "_og.html",655,460,false);
        	  //document.cookie = "showPP" + "=" + escape ("Y") + "; path=/";
			  setCookie("showNewCatalogue", "Y",30);
		 }
		
	 }


	// JJ - TTT 6979 DHL Pilot Account
	function DhlPopup()
	{
		if ((getCookie("DhlPilot") == "1") && (getCookie("DHL") != "1"))
		{
			setCookie("DHL", "1", 365);
			openPopUpWin("/popup/DHL/DhlPopup.htm", 320, 520, true);
		}
	}

			
//DhlPopup();	 
//NewCataloguePopup();

	 
function windowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight]
}

function scrollPosition() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function pleaseWait() {
	return;
}

function languageString()
{
	if (getCookie("Lang").toUpperCase() == "FR")
	{
		return "FR";
	}
	else
	{
		return "EN";
	}
}

function goToPageWithPleaseWait(newLocation)
{
	// alternative implementation
	if (document.forms.length == 0)
	{
		// this blocks in Firefox
		window.location.href = newLocation;	
	}
	else
	{
		// hijack the existing form 
		document.forms[0].action = newLocation;
		
		// destroy all existing fields
		var i;
		for(i=0; i<document.forms[0].length; i++)
		{
			document.forms[0][i].name = "killed";
			document.forms[0][i].value = "";
		}

		document.forms[0].method = "post";
		document.forms[0].submit();
		
	}
//	document.navigator.action = newLocation;
//	document.navigator.submit();
}

// jj - TTT 6667
function openReturnPolicyPopup(ptype)
{
	//var purl = "/Shopping/Checkout/ReturnPolicy.aspx?rtype=" + ptype;
	var purl;
	var language = GetCookie("Lang");
	var purl = "/POPUP/ReturnPolicy/Terms.htm";
		
	if (language.toUpperCase() == "FR")
	{
		if (ptype == "UOM")
		{
			purl = "/POPUP/ReturnPolicy/TermsFR.htm#quantity";
		}
		else
		{
			purl = "/POPUP/ReturnPolicy/TermsFR.htm#returns";
		}
	}
	else
	{
		if (ptype == "UOM")
		{
			purl = "/POPUP/ReturnPolicy/Terms.htm#quantity";
		}
		else
		{
			purl = "/POPUP/ReturnPolicy/Terms.htm#returns";
		}
	}
	
	var pheight = 360;
	var pwidth = 600;
	var params = "height=" + pheight + ", innerHeight=" + pheight;
		params += ",width=" + pwidth + ",innerWidth=" + pwidth;
		
		if (window.screen)
		{
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
			var xc = (aw - pwidth) / 2;
			var yc = (ah - pheight) / 2;
			params += ",left=" + xc + ",screenX=" + xc;
			params += ",top=" + yc + ",screenY=" + yc;
		}
		
	params += ",scrollbars";
	window.open(purl, 'ReturnPolicy', params);
}

function openPolicyPopup(ptype) {
    
    var purl;
    var language = GetCookie("Lang");
    var purl = "/POPUP/ReturnPolicy/Terms.htm";
    var caption = "ReturnPolicy";

    if (language.toUpperCase() == "FR") {
        if (ptype == "UOM") {
            purl = "/POPUP/ReturnPolicy/TermsFR.htm#quantity";
        }
        else if(ptype == "EHF"){
            purl = "/POPUP/ReturnPolicy/TermsFR.htm#EHF";
            caption = "FME";
        }
        else if (ptype == "RETURNS") {
            purl = "/POPUP/ReturnPolicy/TermsFR.htm#returns";
        }
        else{
            purl = "/POPUP/ReturnPolicy/TermsFR.htm";
        }
    }
    else {
        if (ptype == "UOM") {
            purl = "/POPUP/ReturnPolicy/Terms.htm#quantity";
        }
        else if (ptype == "EHF") {
            purl = "/POPUP/ReturnPolicy/Terms.htm#EHF";
            caption = "EHF";
        }
        else if (ptype == "RETURNS") {
            purl = "/POPUP/ReturnPolicy/Terms.htm#returns";
        }
        else {
            purl = "/POPUP/ReturnPolicy/Terms.htm";
        }
    }

    var pheight = 360;
    var pwidth = 600;
    var params = "height=" + pheight + ", innerHeight=" + pheight;
    params += ",width=" + pwidth + ",innerWidth=" + pwidth;

    if (window.screen) {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;
        var xc = (aw - pwidth) / 2;
        var yc = (ah - pheight) / 2;
        params += ",left=" + xc + ",screenX=" + xc;
        params += ",top=" + yc + ",screenY=" + yc;
    }

    params += ",scrollbars";
    window.open(purl, caption, params);
}
