<!--


	
	
	/*---------------------------------------------------------------------
		SetUpEmailToAFriend:	Sets up the parameters to send to
								the email to a friend page.
	---------------------------------------------------------------------*/
	function SetUpEmailToAFriend()
	{
		var strUrl
		
		//alert("upc: " + document.getElementById("currentUPCID").value);
		//alert("upc in basket: " + document.basket.upc.value);
		
		strUrl = "email_friend_.asp?sku=" + document.getElementById("productSkuID").value			+
				 "&f="					  + document.getElementById("currentFamilyID").value		+
				 "&upc="				  + document.basket.upc.value								+
				 "&cf="					  + document.getElementById("UpcClickedFromFamilyID").value	+
				 "&cupc="				  + document.getElementById("UpcClickedFromID").value		

		window.open(strUrl,"win",'scrollbars=no,width=480,height=410');
	}
	
	
	/*---------------------------------------------------------------------
		SetCrossSellDisplay:	Turns the display of the cross sell 
								div tags on and off.
	---------------------------------------------------------------------*/
	function SetCrossSellDisplay(strUpcClickedFromFamily, strUpcClickedFrom)
	{	
		//  Set up the variable used for the send a email function for tracking purposes.
		var objCurrentFamily	= document.getElementById("currentFamilyID")
		var objCurrentUPC		= document.getElementById("currentUPCID")
		
		objCurrentUPC.value		= strUpcClickedFrom
		objCurrentFamily.value	= ""
		
		if ( strUpcClickedFromFamily.length == 0 )
		{
			strDiv		= "CrossSellDiv";
			iDisplay	= 0;
			
			setDivDisplay(strDiv, iDisplay);
		}
		else
		{
			var obj = document.getElementById("families")
			
			// Determine which divs to turn on and off.
			var familyArray = obj.value.split(" ");
			
			for (i = 0; i < familyArray.length; i++ )
			{
				strDiv		= familyArray[i];
				iDisplay	= 0;
				
				if ( familyArray[i] == strUpcClickedFromFamily )
				{
					iDisplay	= 1;
					strDiv		= "CrossSellDiv";
					setDivDisplay(strDiv, iDisplay);
					
					strDiv		= strUpcClickedFromFamily;
					
					objCurrentFamily.value	= strUpcClickedFromFamily;
					
					// Loop through each href tag adding the product upc that this family is
					// associated with.
					var	strUpcClickedFromFamilyUpc
					var iPosition
					var strAnchorTag
					var strImageFamilyUPC
					
					var iUpcCount			= document.getElementById(strUpcClickedFromFamily + "UPCCount").value
					var strUpcClickedFrom	= "&upcClickedFrom=" + strUpcClickedFrom
					
					for (j = 1; j <= iUpcCount; j++)
					{
						strUpcClickedFromFamilyUpc	= strUpcClickedFromFamily	+ "upc" + j;
						strImageFamilyUPC			= strUpcClickedFromFamilyUpc + "Image";
						
						var ImageTag	= document.getElementById(strImageFamilyUPC);
						strAnchorTag	= ImageTag.href;
						
						// Removing the the variable &upcClickedFrom first.  If this is not removed, 
						// we just keep adding upcClickedFrom variables. Since this tag is built everytime
						// the mouse activates a new swatch, we must remove the upcClickedFrom before
						// building another one.  The same family can be associated with different
						// variants, thus having different upcClickedFroms.
						
						iPosition	= strAnchorTag.indexOf("&upcClickedFrom=");
						
						if ( iPosition > 0 )
						{
							strAnchorTag = strAnchorTag.substr(0, iPosition);
						}
						
						strAnchorTag = strAnchorTag + strUpcClickedFrom;
						ImageTag.href = strAnchorTag;
						
						//var anchorTag	= document.getElementById(strUpcClickedFromFamilyUpc);
						//anchorTag.href = strAnchorTag;
					}
				}
				setDivDisplay(strDiv, iDisplay);
			}
		}
	}
	
	/*---------------------------------------------------------------------
		setDivDisplay:	Turns the display of the div tag on or off.
	---------------------------------------------------------------------*/
	function setDivDisplay(strDiv, iDisplay)
	{
		if(document.layers)	   //NN4+
		{
		document.layers[strDiv].display = iDisplay ? "inline" : "none";
		}
		else if(document.getElementById)	  //gecko(NN6) + IE 5+
		{
			var obj = document.getElementById(strDiv);
			obj.style.display = iDisplay ? "inline" : "none";
		}
		else if(document.all)	// IE 4
		{
			document.all[strDiv].style.display = iDisplay ? "inline" : "none";
		}
	}
	
	/*---------------------------------------------------------------------
		doSubmit:	Submit the form.
	---------------------------------------------------------------------*/
	function doSubmit()
	{
		document.basket.submit();
	}
		/*---------------------------------------------------------------------
		hbxSwatchStrip:	strip the characters
	---------------------------------------------------------------------*/
	function hbxSwatchStrip(a) {    //  I called it _hbxStrip here, may be renamed if desired just keep it consistent
           a = a.split("|").join("");
           a = a.split("/").join("");
           a = a.split("!").join("");
           a = a.split("&").join("");
           a = a.split("'").join("");
           a = a.split("#").join("");
           a = a.split("$").join("");
           a = a.split("%").join("");
           a = a.split("^").join("");
           a = a.split("*").join("");
           a = a.split(":").join("");
           a = a.split("~").join("");
           a = a.split(";").join("");  // you might want to remove this line as the “;” is used for the account value split for global
           a = a.split(" ").join("+");
           return a;
    }
   
	
	function doLink( strUPC,strSKU)
	{
		window.location = "productDetail.asp?sku=" + strSKU + "&" + "upc="+strUPC;
		document.basket.referrerSaved.value =  document.referrer;
		
	}
					 
	
	
	
	/*---------------------------------------------------------------------
		doImage:	This function is called when the consumer moves the
					mouse over the swatch pictures.  It changes the
					picture that is displayed and saves the new upc
					code.
	---------------------------------------------------------------------*/
	function doImage( strImageName, 
					  strLargerImage, 
					  strUPC, 
					  strImageDirectory,
					  strSwatchImage,
					  strSeries,
					  strSwatches,
					  mPrice,
					  bBackOrder,
					  bEmployee,
					  bCorporate,
					  strBackOrderMsg,
					  strBackOrderDisplayDate,
					  strBackOrderDate,
					  strBackOrderFlag,
					  bLSRP,
					  mMSRPPrice,
					  strMSRPPrice,
					  strVariantImage1,
					  strVariantImage2,
					  strVariantImage3,
					  strDisplayAltViews,
					  strAltViewImage1,
					  strAltViewImage2,
					  strAltViewImage3,
					  strAltViewImage4,
					  bLuggageTagMonogramming,
					  bMonogramming,
					  blogos,
					  organization,
					  bProductCare,
					  strProductCareSku,
 					  strProductCarePrice,
					  strVariantFamily,
					  bCrossSell,
					  bSpecialMessage,
					  bContainsSpecialMessage,
					  strSpecialMessage,
					  strVariantBullet1,
					  strVariantBullet2,
					  strVariantBullet3,
					  strHbxSwatchName)  //<---- Added 6/22/2007
	{
		var aSwatches;
		var i;
		var j;
		var strDisplayImage;
		var strDiv;
		var iDisplay;
		
		
		
		/********************************************************************************
		*  Set page name and product variables with new Swatch Description for HBX
		********************************************************************************/
		
		    strHbxSwatchName = hbxSwatchStrip(strHbxSwatchName);
		    //hbx.pn=document.hbxProductVars.hbxItem.value + "+" + strHbxSwatchName;
		    //hbx.pr=document.hbxProductVars.hbxItem.value + "+" + strHbxSwatchName;	
		    document.basket.hbxSwatchName.value =  strHbxSwatchName;
		    document.form_search.series.value = strHbxSwatchName;
		    //_hbPageView(document.hbxProductVars.hbxItem.value + "+" + strHbxSwatchName, hbx.mlc);		   
    		//_hbLink(document.hbxProductVars.hbxItem.value + "+" + strHbxSwatchName);
    		
    		// Google Analytics PageView and Product View Event
    		pageTracker._trackPageview(_stripChars(document.hbxProductVars.hbxItem.value + " " + strHbxSwatchName));
    		pageTracker._trackEvent("Product", "View", _stripChars(document.hbxProductVars.hbxItem.value + " " + strHbxSwatchName));
    		
		/********************************************************************************
		*  Set page name and product variables with new Swatch Description for HBX
		********************************************************************************/
		
		/*-------------------------------------------------------------------------------
					This section turns the checkboxes on or off for special divs.
		-------------------------------------------------------------------------------*/
		// Special Message
		strDiv = "SpecialMessageDiv";
		iDisplay = 0;
	
		if ( bContainsSpecialMessage == "True") 
			iDisplay = 1;
			//document.basket.SpecialMessage.value = strSpecialMessage;
		
		if (bSpecialMessage == "True")
			document.basket.SpecialMessage.value = strSpecialMessage;
			
		setDivDisplay(strDiv, iDisplay);
		
		/*-------------------------------------------------------------------------------
					This section turns the checkboxes on or off for monogramming.
		-------------------------------------------------------------------------------*/
		// Monogramming and logo checkbox

		iDisplay = 0;
		strDiv = "LogoDiv";
		
		if (blogos == "True")
		{
			iDisplay = 1;
		}
		else
		{
			if (organization != "yes")
			{
				iDisplay = 0;
				strDiv = "MonogramDiv";

				if ( bMonogramming  == "True" ) 
					iDisplay = 1;

				setDivDisplay(strDiv, iDisplay);			
		
				// Luggage Tag Monogramming checkbox
		
				strDiv = "LuggageTagDiv";
				iDisplay = 0;
		
				if ( bLuggageTagMonogramming  == "True") 
					iDisplay = 1;
				
				setDivDisplay(strDiv, iDisplay);	
			}
		}
		setDivDisplay(strDiv, iDisplay);	
		/*-------------------------------------------------------------------------------
					This section turns the checkboxes on or off for product care.
		-------------------------------------------------------------------------------*/
		strDiv = "ProductCareDiv";
		iDisplay = 0;
		
		var productElement
		productElement = document.getElementById('productcare');
		productElement.checked = false;
		if ( bProductCare  == "True") 
		{
			iDisplay = 1;
			
			productElement = document.getElementById('productcarelink');
			productElement.href	= "productDetail.asp?sku=" +  strProductCareSku;
			productElement = document.getElementById('productcareprice');
			productElement.innerHTML = strProductCarePrice;
			productElement = document.getElementById('productcaresku');
			productElement.value = strProductCareSku;
		}

		setDivDisplay(strDiv, iDisplay);
		
		/*-------------------------------------------------------------------------------
					This section turns on/off the cross sell item section.
		-------------------------------------------------------------------------------*/
		// Cross Sell Display
		
		if ( bCrossSell == "True")
		{
			SetCrossSellDisplay(strVariantFamily, strUPC);
		}
		
		aSwatches = strSwatches.split(",")

		// Determine where the arrow needs to be pointing to.
		for (i = 0; i < aSwatches.length; i++)
		{
			for (j=0; j < document.images.length; j++)
			{
				if ( document.images[j].name == aSwatches[i] )
				{
					if (document.images[j].name == strSeries)
					{
						document.images[j].src = "images/common/trans1x1.gif"
					}
					else
					{
						document.images[j].src = "images/common/trans1x1.gif"
					}
					break;
				}
			}
		}

		//  Display the specified graphic
		document.getElementById('seriesText').innerHTML = "Series &nbsp;&nbsp;&nbsp;&nbsp;" + strSeries;
		document.basket.upc.value			= strUPC;
		document.basket.LargerImage.value	= strLargerImage;
		//document['ProductImage'].src		= strImageDirectory + strImageName;
		document.getElementById('featured').src		= "http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/" + strImageName.substring(0, strImageName.length - 5) + "3/medium.jpg";
		document.getElementById('popupimage').src		= "http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/" + strImageName.substring(0, strImageName.length - 5) + "3/popup.jpg";
		document.getElementById('magnify').href		= "http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/" + strImageName.substring(0, strImageName.length - 5) + "3/original.jpg";
		Widget.resetWidget();
		document.basket.SwatchImage.value	= strImageDirectory + strSwatchImage;
		var price = document.getElementById("Price");
		setText(price, mPrice);
		document.basket.Series.value	= strSeries;

		//  Determine if this variant has the displayAltViews flag set to "yes"
		//  Display the appropriate image based on this flag.
		strDisplayImage = "but_view_larger.gif";
		if (strDisplayAltViews == "Yes")
			strDisplayImage = "but_view_alt_images.gif";
		

		// Change alternate images with swatch change
		if (strDisplayAltViews == "Yes" && strAltViewImage1.length > 0)
		{
			$('#defaultImg').removeClass().addClass('gradualfader');
			$('#defaultImg').css('cursor', 'pointer');
			$('#defaultImg').attr('onClick', 'gradualFader.selectImage(this);switchImages(this);');
			$('#defaultImg').attr('src', 'http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/' + strImageName.substring(0, strImageName.length - 5) + '3/alt.jpg');
		}
		else
		{
			$('#defaultImg').removeClass();
			$('#defaultImg').css('cursor', 'default');
			$('#defaultImg').removeAttr('onClick');
			$('#defaultImg').attr('src', '/shop/images/common/blankAlt.jpg');
		}
		if (strDisplayAltViews == "Yes" && strAltViewImage1.length > 0)
		{
			$('#alt1').removeClass().addClass('gradualfader');
			$('#alt1').css('cursor', 'pointer');
			$('#alt1').attr('onClick', 'gradualFader.selectImage(this);switchImages(this);');
			$('#alt1').attr('src', 'http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/' + strAltViewImage1 + '/alt.jpg');
		}
		else
		{
			$('#alt1').removeClass();
			$('#alt1').css('cursor', 'default');
			$('#alt1').removeAttr('onClick');
			$('#alt1').attr('src', '/shop/images/common/blankAlt.jpg');	
		}		
		if (strDisplayAltViews == "Yes" && strAltViewImage2.length > 0)
		{
			$('#alt2').removeClass().addClass('gradualfader');
			$('#alt2').css('cursor', 'pointer');
			$('#alt2').attr('onClick', 'gradualFader.selectImage(this);switchImages(this);');
			$('#alt2').attr('src', 'http://c0166872.cdn.cloudfiles.rackspacecloud.com/hartmann/' + strAltViewImage2 + '/alt.jpg');
		}
		else
		{
			$('#alt2').removeClass();
			$('#alt2').css('cursor', 'default');
			$('#alt2').removeAttr('onClick');
			$('#alt2').attr('src', '/shop/images/common/blankAlt.jpg');	
		}
		
		gradualFader.init();
		
		//document['ViewProduct'].src			  = strImageDirectory + strDisplayImage;
		
		//  Set the alt views image flag and the image names.  These will be passed
		//  to the page for display purposes if this upc supports alt views.
		document.basket.DisplayAltViews.value	= strDisplayAltViews
		
		document.basket.AltViewImage1.value		= strAltViewImage1
		document.basket.AltViewImage2.value		= strAltViewImage2
		document.basket.AltViewImage3.value		= strAltViewImage3
		document.basket.AltViewImage4.value		= strAltViewImage4
		
		// Set the Image name for the Variant bullets
		var variantImage;
		variantImage = document.getElementById("VariantImage1");
		variantImage.innerHtml = strVariantImage1;
		variantImage = document.getElementById("VariantImage2");
		variantImage.innerHtml = strVariantImage2;
		variantImage = document.getElementById("VariantImage3");
		variantImage.innerHtml = strVariantImage3;

		// Display the specific variant bullets
		var variantDiv;
		variantDiv = document.getElementById("VariantDiv");	
		if (strVariantBullet1.length > 0 || strVariantBullet2.length > 0 || strVariantBullet3.length > 0)
		{
			variantDiv.style.display = "inline";
		}
		else
		{
			variantDiv.style.display = "none";
		}
		document.basket.VariantBullet1.value = strVariantBullet1;
		document.basket.VariantBullet2.value = strVariantBullet2;
		document.basket.VariantBullet3.value = strVariantBullet3;

		// Update the backorder information if at least one of the
		// items were set to backorder
		if ( bBackOrder == "True" )
		{
			var boDiv = document.getElementById("backorderDiv");
			boDiv.style.display = "inline";
			
			document.basket.BackOrderMsg.value			= strBackOrderMsg;
			document.basket.DisplayBackOrderDate.value	= strBackOrderDisplayDate;
			
			if (strBackOrderMsg.length == 0 && strBackOrderDisplayDate.length == 0)
			{
				boDiv.style.display = "none";				
			}
		}
		
		document.basket.BackOrderDate.value = strBackOrderDate
		document.basket.BackOrderFlag.value = strBackOrderFlag
		
		// Update the backorder information if at least one of the
		// items have an lsrp
	
		if ( bLSRP == "True" )
		{
			var msrp=document.getElementById("MSRPPrice");
			var msrpLabel=document.getElementById("MSRP");
			var priceLabel=document.getElementById("SalePrice");
			
			if ( strMSRPPrice == 0 ) 
			{
				setText(msrp, "");
			}
			else
			{
				setText(msrp, mMSRPPrice);
			}
			
			if( mMSRPPrice != mPrice )
			{
				msrp.style.textDecoration = "line-through";
				msrpLabel.style.textDecoration = "line-through";
				setText(priceLabel, "Sale Price");
				price.style.visibility = "visible";
			}
			else
			{			
				msrp.style.textDecoration = "none";
				msrpLabel.style.textDecoration = "none";
				price.style.visibility = "hidden";
				setText(priceLabel, "");
			}
		}
			

			
		
		//  Update the msrp display if the employee flag is set to true
		//  Added - 02/15/2006.  Paula Blohm.
		if ((bEmployee == "True") || ( bCorporate == "True"))
		{
				var msrp=document.getElementById("MSRPPrice");
				setText(msrp, mMSRPPrice);
		}
		
	}

    /*---------------------------------------------------------------------
		    ZoomWindow:	This function pop ups a new window.
    ---------------------------------------------------------------------*/
    function ZoomWindow(sku, collection, product)
    {
	    mywin = window.open("zoomView.asp?sku=" + sku + "&collection=" + collection + "&product=" + product,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=610,height=680');
    		
	    if(mywin.open) 
	    { 
		    window['mywin'].focus();
		    window['mywin'].focus(); 
	    }
    }


	/*---------------------------------------------------------------------
		ViewLargerImage:	This function builds the URL string for
							viewing the larger image.
	---------------------------------------------------------------------*/
	function ViewLargerImage( strImageDirectory )
	{
		var	sku;

        sku = document.basket.LargerImage.value.substring(0,document.basket.LargerImage.value.length - 4)

        _hbPageView("/z" + document.hbxProductVars.hbxItem.value + "+" + _hbxSwatchStrip(document.basket.hbxSwatchName.value), "/zoom");
        _hbLink("/z" + document.hbxProductVars.hbxItem.value + "+" + _hbxSwatchStrip(document.basket.hbxSwatchName.value));
//        _hbPageView("/z" + hbx.pn.substring(1), "/zoom");
//        _hbLink("/z" + hbx.pn.substring(1), "/zoom");
        ZoomWindow(sku, document.basket.Collection.value, document.basket.ProductName.value);
		
//		if ( document.basket.DisplayAltViews.value == "No")
//		{
//			strUrl = "ProductLarge.asp?image=" + strImageDirectory + document.basket.LargerImage.value;
//			
//			PopUpWindow(strUrl);
//		}
//		else
//		{
//			var		strArguments;
//			
//			strArguments = "?image1=" + document.basket.AltViewImage1.value;
//			strArguments = strArguments + "&image2=" + document.basket.AltViewImage2.value;
//			strArguments = strArguments + "&image3=" + document.basket.AltViewImage3.value;
//			strArguments = strArguments + "&image4=" + document.basket.AltViewImage4.value;
//			strArguments = strArguments + "&ProductName=" + document.basket.ProductName.value;
//			strArguments = strArguments + "&Collection=" + document.basket.Collection.value;
//			
//			strUrl = "product_alt_views_popup.asp" + strArguments
//			
//			PopUpWindowAlt(strUrl);
//		}
	}
	
	function getText(control) 
	{ 
		if (document.all) 
		{ 
			return control.innerText; 
		} 
		else 
		{ 
			return control.textContent; 
		} 
	} 
	
	function setText(control, value) 
	{ 
		if (document.all) 
		{ 
			control.innerText = value; 
		} 
		else 
		{ 
			control.textContent = value; 
		} 
	}


	function switchImages(obj)
	{
		var baseUrl = obj.src.substring(0, obj.src.lastIndexOf("/"));
		var x = document.getElementById("featured");
		x.src = baseUrl + "/medium.jpg";
		x = document.getElementById("magnify");
		x.href = baseUrl + "/original.jpg";
		x = document.getElementById("popupimage");
		x.src = baseUrl + "/popup.jpg";	

	}
	
	var zoomed = false;	
	var zooming = false;
	function showZoomMsg(action)
	{
		if (((action == "mouseover" && !zoomed) || (action == "click" && zoomed)) && !zooming)
		{
			zooming = true;
			$('#zoomMsg').fadeIn(350, function() { zooming=false; });	
		}
		else
		{
			if (zooming)
			{
				setTimeout("showZoomMsg('mouseout')", 200);
			}
			else
			{
				zooming = true;
				$('#zoomMsg').fadeOut(350, function() { zooming=false; });	
			}
		}
		
		if (action == "click")
		{
			if (zoomed)
			{
				zoomed = false;
			}
			else
			{
				zoomed = true;
			}
		}
	}
	
	-->
