<!--

 






function open_window(url, scrollbars, width, height, name, toolbar)	{
	m_lscroll_top = document.body.scrollTop;

	var aChildWin = new Array();
	var iLeft = ((screen.availWidth - parseInt(width)) / 2);
	var iTop = ((screen.availHeight - parseInt(height)) /2);
	
	if (!toolbar) {
		toolbar = "no";
	}
	
	var sProperties = "width=" + width 
							   + ", height=" + height 
							   + ", resizable=no, scrollbars=" + scrollbars 
							   + ", left=" + iLeft + "px, top= " + iTop + "px" 
							   + ", toolbar=" + toolbar 
							   + ", center=yes, status=no";
	
	var iWindex = aChildWin.length;
	var sWinName;
	
	if (name) {
		sWinName = name;
	} else {
		sWinName = "win" + iWindex.toString();
	}
	
	aChildWin[iWindex] = window.open(url, sWinName, sProperties);
	aChildWin[iWindex].opener = window.self;
	
	return aChildWin[iWindex];
}

// Open a new window --- Using In SendEmailLink
	
	function open_new_window(url, scrollbars, width, height, name, toolbar)	
	{
	
		m_lscroll_top = document.body.scrollTop;
            var aChildWin = new Array();
			var iLeft = ((screen.availWidth - parseInt(width)) / 2);
			var iTop = ((screen.availHeight - parseInt(height)) /2);
			if (!toolbar) {
				toolbar = "no";
			}
			var sProperties = "width=" + width 
												+ ", height=" + height 
												+ ", resizable=yes, scrollbars=" + scrollbars 
												+ ", left=" + iLeft + "px, top= " + iTop + "px" 
												+ ", toolbar=" + toolbar 
												+ ", center=yes, status=no";
			var iWindex = aChildWin.length;
			var sWinName;
			if (name) {
				sWinName = name;
			}
			else {
				sWinName = "win" + iWindex.toString();
			}
			aChildWin[iWindex] = window.open(url, sWinName, sProperties);
			aChildWin[iWindex].opener = window.self;
	}

function getJsDate(USDateString) {
	var arrDtParts = USDateString.split("/");
	var dt = null;
	
	try {
		dt =  new Date(arrDtParts[2], (arrDtParts[0] - 1), arrDtParts[1]);
	} catch(e) {
		return null;
	}
	
	return dt;
}

function validateDate(dateString) {
	var oRE = /^\d\d\/\d\d\/\d\d\d\d$/;
	
	if (oRE.test(dateString)) {
		var dt = getJsDate(dateString);
		return (dt != null);
	}
	
	return false;
}

function calculateAge(Birthday) {
	var dtNow = new Date();
	var iYears = dtNow.getFullYear() - Birthday.getFullYear();
	var iBirthMonth = Birthday.getMonth();
	var iBirthDay = Birthday.getDay();
	var iNowMonth = dtNow.getMonth();
	var iNowDay = dtNow.getDay();
	
	if (iNowMonth > iBirthMonth) {
		return iYears;
	} else {
		if (iNowDay > iBirthDay) {
			return iYears;
		} else {
			return iYears - 1;
		}
	}
}

function IsNumeric(expression) {
	var validChars = "0123456789";
	var validChar;
	var output = true;
	
	for (i = 0; i < expression.length && output == true; i++) { 
		validChar = expression.charAt(i);
		
		if (validChars.indexOf(validChar) == -1) {
			output = false;
		}
	}
	
	return output;
}

function IsOrderNumber(expression) {
	var validChars = "0123456789-";
	var validChar;
	var output = true;
	
	for (i = 0; i < expression.length && output == true; i++) { 
		validChar = expression.charAt(i);
		
		if (validChars.indexOf(validChar) == -1) {
			output = false;
		}
	}
	
	return output;
}
	
function quantityCheck(input, limit, stock) {
	if (!IsNumeric(input.value)) {
		alert("Please enter a valid, numeric, quantity.");
		input.focus();
		return;
	}
	
	var quantity = parseInt(input.value);
	if (quantity > limit) {
		alert("This item is limited to " + limit.toString() + " per customer.");
		input.value = limit;
		input.focus();
		return;
	}
	
	return;
}
   
function findPosition(item) {
	if (item.offsetParent) {
		
		for( var posX = 0, posY = 0; item.offsetParent; item = item.offsetParent ) {
			posX += item.offsetLeft;
			posY += item.offsetTop;
		}
		
		return [ posX, posY ];
		
	} else {
		
		return [ item.x, item.y ];
		
	}
}

function findBrowserDimensions() {
	var width = 0;
	var height = 0;
	
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		width = window.innerWidth;
		height = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	
	return [ width, height ];
}

function findBrowserOffset() {
	var width = 0;
	var height = 0;
	
	if (typeof(window.pageYOffset) == 'number') {
		//Netscape compliant
		width = window.pageXOffset;
		height = window.pageYOffset;
	} else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
		//DOM compliant
		width = document.body.scrollLeft;
		height = document.body.scrollTop;
	} else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
		//IE6 standards compliant mode
		width = document.documentElement.scrollLeft;
		height = document.documentElement.scrollTop;
	}
	
	return [ width, height ];
}

	function closeAndRefreshParent()
	{
		window.opener.page_form.mode.value="refresh";
		window.opener.page_form.onsubmit();
		window.opener.page_form.submit();
		window.opener.focus();
		window.close();
	}

	
	function parentPageJump(path)
	{
		window.opener.location=path;
		window.opener.focus();
		window.close();
	}
	
	function replaceIt(sString, sReplaceThis, sWithThis) { 
		if (sReplaceThis != "" && sReplaceThis != sWithThis) { 
			var counter = 0; 
			var start = 0; 
			var before = ""; 
			var after = ""; 
			while (counter<sString.length) { 
				start = sString.indexOf(sReplaceThis, counter); 
				if (start == -1) { 
					break; 
				} else { 
					before = sString.substr(0, start); 
					after = sString.substr(start + sReplaceThis.length, sString.length); 
					sString = before + sWithThis + after; 
					counter = before.length + sWithThis.length; 
				} 
			} 
		} 
		return sString; 
	} 
//-->

<!--	
	// start cart widget js
	var req;
	var mButton			= null;
	var mCaseButton		= null;
	var mAddQS;
	var mCartLink 		= "<a href='/checkout/default.aspx' class='widgetlink'  title='Proceed to Checkout'>cart</a>";
	var mCheckoutLink	= "<span class=\"tnavshipto\"> | </span><a href=\"/checkout/default.aspx\" title=\"Proceed to Checkout\" class=\"widgetlink\">checkout</a></span>";
	var mLoading 		= "<div style='display: inline;' align='center'><i>loading cart</i> <img src=\"/images/img_loading.gif\" width=\"10\" height=\"10\" /></div>";
	var mAddBaseUrl 	= '/checkout/cartsummary.aspx';
	var mCartBaseUrl 	= "/checkout/default.aspx";
	
	// called from the onload event of the body tag
	function pageInit()
	{
		loadCartWidget();
		
	}
	
	// loads the initial cart sidget in the topnav
	function loadCartWidget()
	{
		var timeStamp;
		var date;
		
		// create time stamp
		date 			= new Date();
		timeStamp 		= date.getTime();
		
		if (document.getElementById("cartWidget") != null)
		{
			document.getElementById("cartWidget").style.visibility = "visible";
		 	document.getElementById("cartWidget").innerHTML = mLoading;
	        loadXMLDoc('?counter=' + timeStamp);
		}
	}
    
	// function to hit the cart with the AJAX JS httpget
	function loadXMLDoc(qs) 
	{
		// set global var for use later
		mAddQS= qs;
		
	    // branch for native XMLHttpRequest object
	    if (window.XMLHttpRequest) {
	        req = new XMLHttpRequest();
	        req.onreadystatechange = processReqChange;
	        req.open("GET", mAddBaseUrl + qs, true);
	        req.send(null);
	    // branch for IE/Windows ActiveX version
	    } else if (window.ActiveXObject) {
	        req = new ActiveXObject("Microsoft.XMLHTTP");
	        if (req) {
	            req.onreadystatechange = processReqChange;
	            req.open("GET", mAddBaseUrl + qs, true);
	            req.send();
	        }
	    }
		
		
	}
	
	// captures events thrown by the loadXMLDoc request
	function processReqChange() 
	{
	    var itemsTxt;
		var itemAddedTxt;
		var isError;
		var productNotAdded;
	        
        // only if req shows "loaded"
        if (req.readyState == 4) 
		{
			// make sure we got xml back
            //if (!req.responseXML.hasChildNodes())
            //{
			//	isError = true;
			//}
			
			// check if the error node is set to true
			if (!isError && req.responseXML.getElementsByTagName('IsError')[0].firstChild.nodeValue == "True")
			{
                isError = true;
			}
				
            if (isError)
			{
				// check if the error node is set to true
				if (req.responseXML.getElementsByTagName('productNotAdded')[0].firstChild.nodeValue == "True")
				{
                	productNotAdded = true;
				}else{
					productNotAdded = false;
				}
			
				// request failed, bounce to the real cart with add so user can see error
				if (productNotAdded)
				{
					window.location.href = mCartBaseUrl + mAddQS;
				}
				else
				{
				 	window.location.href = mCartBaseUrl; 
				}
               
			}
			else
			{
				// we are good to go
                // eval the XML
               	itemsTxt 		= req.responseXML.getElementsByTagName('ItemsText')[0].firstChild.nodeValue;
				itemAddedTxt 	= req.responseXML.getElementsByTagName('QTYofAddedText')[0].firstChild.nodeValue;
				itemQty 		= req.responseXML.getElementsByTagName('QTYofAdded')[0].firstChild.nodeValue;
				
				//itemsTxt = itemsTxt + " for " + req.responseXML.getElementsByTagName('Total')[0].firstChild.nodeValue;
                // end eval
                
                // we have info, show main cart widget in top nav
				if (document.getElementById("cartWidget") != null)
				{
                	document.getElementById("cartWidget").style.visibility = "visible";
                	// blast new HTML content into <div>
                	document.getElementById("cartWidget").innerHTML =  itemsTxt + " in your " + mCartLink + mCheckoutLink;
                }
				
				// set the add to cart button to the add again state
                if (mButton != null)
                {
                    
                    if (mButton != null)
                    {
						// normal button
						mButton.src = "/images/btn_add_cart_again.gif"; 	
						// set button to null for future state testing in the addToCart function
						mbutton = null;
                    }else{
						// must be a case button
						mCaseButton.src = "/images/btn_add_cart_again.gif"; 
						// set button to null for future state testing in the addToCart function
						mCaseButton = null;
                    }
					
					
                }
            }
            
            if (req.status == 200) {
               // waiting......
			   // we have already flipped to the waiting state after the click 
			   // so we don't do anything here
               
            } else {
               // something very bad happened; jump to the cart itself
			   
			   //window.location.href = mCartBaseUrl;
            }
        }
    }
	
	
	
	
	// function called from the onclick add a case event of the button
    function addACase(pproductId, clickId, iid, passedButton)
    {
		var timeStamp;
		var date;
		var qty;
		var cartUrl
		var prodType
		
		// first check to see we already have a button in action; if so flip the previous button to normal
		if (mCaseButton != null)
		{
			mCaseButton.src = "/images/btn_add_cart_again.gif"; 
		}
		
		// create time stamp to persuade the browser that this is a unique request.
		// we shouldn't need this since the header is returning 'no-cache' but I put it in
		// as an added precaution -kgh
		date 			= new Date();
		timeStamp	 	= date.getTime();
		
		// set the button to the global var for future state change
        mButton 		= passedButton;
		
		// flip the source of the button to show the adding animated gif
        mButton.src 	= "/images/btn_add_cart_adding.gif";
		qty 			= 12;
		
		// show the loading text/image in the main widget
		if (document.getElementById("cartWidget") != null)
		{
        	document.getElementById("cartWidget").innerHTML = mLoading;
			cartUrl = '?mode=add&pproduct_id=' + pproductId + '&qty=' + qty + '&ct=' + clickId  + '&iid=' + iid +'&counter=' + timeStamp;
			// alert(cartUrl);
			// load the xml doc
        	loadXMLDoc(cartUrl); 
		}
    }
	
	
	// function called from the onclick event of the button
    function addToCart(pproductId, clickId, iid, checkQTY, passedButton)
    {
		var timeStamp;
		var date;
		var qty;
		var cartUrl
		var prodType
		
		// first check to see we already have a button in action; if so flip the previous button to normal
		if (mButton != null)
		{
			mButton.src = "/images/btn_add_cart_again.gif"; 
		}
		
		// create time stamp to persuade the browser that this is a unique request.
		// we shouldn't need this since the header is returning 'no-cache' but I put it in
		// as an added precaution -kgh
		date 			= new Date();
		timeStamp	 	= date.getTime();
		
		// set the button to the global var for future state change
        mButton 		= passedButton;
		
		// if we are adding a wine club, grab the pproduct id from the form
		// and swap in the color if a wineclub and color is passed
		if (pproductId =="wineclub" || pproductId =="giftcert")
		{
			prodType = pproductId;
			pproductId = document.forms['addToCart'].elements['pproduct_id'].options[document.forms['addToCart'].elements['pproduct_id'].selectedIndex].value;
			
			if (prodType =="wineclub" )
			{
				if (document.forms['addToCart'].elements['color'] !=null)
				{
					if (document.forms['addToCart'].elements['color'].options !=null)
					{
						pproductId = replaceIt(pproductId, "COLOR", document.forms['addToCart'].elements['color'].options[document.forms['addToCart'].elements['color'].options.selectedIndex].value);
					}
					else
					{
						pproductId = replaceIt(pproductId, "COLOR", document.forms['addToCart'].elements['color'].value);
					}	
				}
			}
		}
		
		// flip the source of the button to show the adding animated gif
        mButton.src 	= "/images/btn_add_cart_adding.gif";
		qty 			= 1;
		
		// grab the qty from the drop down if on the detail page
		// ONLY if we have the flag passed in
		if (checkQTY == "True" && document.forms['addToCart']!= null && document.forms['addToCart'].elements['qty'] != null)
		{
			if (document.forms['addToCart'].elements['qty'].options != null)
			{
				qty = document.forms['addToCart'].elements['qty'].options[document.forms['addToCart'].elements['qty'].selectedIndex].value;
			}
			else
			{
				qty = document.forms['addToCart'].elements['qty'].value;
			}
			
		}
		
		
		// check for the aspnet form name
		if (checkQTY == "True" && document.forms['aspnetForm']!= null && document.forms['aspnetForm'].elements['qty'] != null)
		{
			if (document.forms['aspnetForm'].elements['qty'].options != null)
			{
				qty = document.forms['aspnetForm'].elements['qty'].options[document.forms['aspnetForm'].elements['qty'].selectedIndex].value;
			}
			else
			{
				qty = document.forms['aspnetForm'].elements['qty'].value;
			}
			
		}
		
        
		// show the loading text/image in the main widget
		if (document.getElementById("cartWidget") != null)
		{
        	document.getElementById("cartWidget").innerHTML = mLoading;
			cartUrl = '?mode=add&pproduct_id=' + pproductId + '&qty=' + qty + '&ct=' + clickId  + '&iid=' + iid +'&counter=' + timeStamp;
			// alert(cartUrl);
			// load the xml doc
        	loadXMLDoc(cartUrl, processReqChange); 
		}
    }
//-->

<!--
	var keyTimer = null;
	
	function keyMouseOut() {
		keyTimeout(1000);
	}
	
	function keyMouseOutItem(key, time) {
		keyTimer = setTimeout("keyHide(" + key + ")", time);
	}
	
	function keyMouseOver() {
		clearTimeout(keyTimer);
	}
	
	function keyTimeout(time) {
		keyTimer = setTimeout("keyHideAll()", time);
	}
	
	function keyHideAll() {
		var key = document.getElementById("key");
		if (key) {
			keyHide(key);
		}
		
		key = document.getElementById("descriptionFullKey");
		if (key) {
			keyHide(key);
		}
		
		key = document.getElementById("recommendationsFullKey");
		if (key) {
			keyHide(key);
		}
		
		key = document.getElementById("shareWrapper");
		if (key) {
			keyHide(key);
		}
		
		key = document.getElementById("winelistKey");
		if (key) {
			keyHide(key);
		}
		
		//key = document.getElementById("feedWrapper");
		//keyHide(key);
		
		hideCommunityWineListButtons();
		
		
	}
	
	function keyHide(key) {
		var child = key.firstChild;
		while ( child != null ) {
			if ( child.nodeType == 1 ) {
				if (child.getAttribute("id") != null) {
					switch(child.getAttribute("id")) {
						case "iconKey":
						case "ratingKey":
						case "recommendationsKey":
						case "descriptionFull":
						case "shareKey":
						case "feedKey":
						case "typeKey":
						case "varietalKey":
						case "regionKey":
						case "appellationKey":
						case "winelistKey":
						case "winelistForm":
						case "suggestionsKey":
							child.className = "isHidden";
							break;
					}
				}
			}
			child = child.nextSibling;
		}
		
            
	}
	
    function keyShow(icon, legend) {
		keyMouseOver();
		keyHideAll();
		keyTimeout(4000);
		
		// Get key and icon
		var key = document.getElementById(legend);
		
		// Get Browser Height and Width
		var browserDimensions = findBrowserDimensions();
		var browserOffset = findBrowserOffset();
		
		// Set up positioning
		var position = findPosition(icon);
		var intOffsetTop = 15 + position[1];
		var intOffsetBottom = position[1] - key.offsetHeight - 10;
		var intOffsetLeft = 15 + position[0];
		var intOffsetRight = position[0] - key.offsetWidth;

		if (position[1] + key.offsetHeight >= (browserDimensions[1] * 1.15) + browserOffset[1]) {
			key.style.top = intOffsetBottom + "px";
		} else {
			key.style.top = intOffsetTop + "px";
		}
		if (position[0] >= (browserDimensions[0] / 2)) {
			key.style.left = intOffsetRight + "px";
		} else {
			key.style.left = intOffsetLeft + "px";
		}

		// Make visibile
		key.className = "isVisible";
	}
	
    function keyShowPositional(icon, legend, top, left) {
		keyMouseOver();
		keyHideAll();
		keyTimeout(4000);
		
		// Get key and icon
		var key = document.getElementById(legend);

		// Set up positioning
		var position = findPosition(icon);
		var intOffsetTop = 15 + position[1] + top;
		var intOffsetLeft = 15 + position[0] + left;
		
		key.style.top = intOffsetTop + "px";
		key.style.left = intOffsetLeft + "px";
		
		// Make visibile
		key.className = "isVisible";
	}
	
	function keyShowUnderAlignRight(icon, legend) {
		keyMouseOver();
		keyHideAll();
		keyTimeout(4000);
		
		// Get key and icon
		var key = document.getElementById(legend);

		// Get Browser Height and Width
		var browserDimensions = findBrowserDimensions();
		var browserOffset = findBrowserOffset();
		
		// Set up positioning
		var position = findPosition(icon);
		var intOffsetTop = 15 + position[1];
		var intOffsetLeft = position[0] - key.offsetWidth + icon.offsetWidth;
		
		key.style.top = intOffsetTop + "px";
		key.style.left = intOffsetLeft + "px";
		
		// Make visibile
		key.className = "isVisible";
	}

	function closeBoxOver(item) {
		item.className = "closeBoxHover";
	}
	
	function closeBoxOut(item) {
		item.className = "closeBox";
	}
	
	function subscribe(querystring) {
        var theNewWin = window.open('/v6/rss/rss.aspx?' + querystring,'feed','width=900,height=640,resizable=yes,toolbar=no,location=yes,scrollbars=yes');
        if ( typeof theNewWin != "undefined" &&
             theNewWin != null ) {
            theNewWin.focus();
        }
		
		reloadWithShare("rss");
	}
	
	function sharePage(service, url) {
		if (url.length == 0)
	    	url = location.href;
	    url = url.replace(/^http:\/\/[a-z]+\.u\./i,'http://www.');
		
		//if (url.indexOf("?") > 0) {
		//	url = url + '&cid=share:' + service;
		//} else {
		//	url = url + '?cid=share:' + service;
		//}

		var title = document.title
		if ((title.indexOf("wine.com") <= 0) && (title.indexOf("Wine.com") <= 0)) {
			title = title + ' from wine.com'
		}
	    encodedurl = encodeURIComponent(url);
	    var encodedtitle = encodeURIComponent(title);
	
	    var serviceUrl = null;
		
		switch(service) {
			case 'delicious':
				serviceURL	= 'http://del.icio.us/post?v=4&noui&jump=close'
							+ '&url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'digg':
				serviceURL	= 'http://digg.com/submit?phase=2'
							+ '&url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'fark':
				serviceURL	= 'http://www.fark.com/cgi/fark/submit.pl'
							+ '?new_url=' + encodedurl
							+ '&new_comment=' + encodedtitle;
				break;
				
			case 'google':
				serviceURL	= 'http://www.google.com/bookmarks/mark?op=add'
							+ '&bkmk=' + encodedurl
							+ '&title=' + encodedtitle
							+ '&labels=' + ''
							+ '&annotation=' + '';
				break;
				
			case 'newsvine':
				serviceURL	= 'http://www.newsvine.com/_tools/seed&save'
							+ '?u=' + encodedurl;
				break;
				
			case 'reddit':
				serviceURL	= 'http://reddit.com/submit'
							+ '?url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'slashdot':
				serviceURL	= 'http://slashdot.org/bookmark.pl'
							+ '?url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'technorati':
				serviceURL	= 'http://technorati.com/faves?sub=favthis'
							+ '&add=' + encodedurl;
				break;
				
			case 'blink':
				serviceURL	= 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Quick=true&Pop=yes'
							+ '&url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'yahoo':
				serviceURL	= 'http://myweb2.search.yahoo.com/myresults/bookmarklet?d=&ei=UTF-8'
							+ '&u=' + encodedurl
							+ '&t=' + encodedtitle;
				break;
				
			case 'furl':
				serviceURL	= 'http://www.furl.net/storeIt.jsp'
							+ '?u=' + encodedurl
							+ '&t=' + encodedtitle;
				break;
			
			case 'simpy':
				serviceURL	= 'http://simpy.com/simpy/LinkAdd.do?v=6&src=bookmarklet'
							+ '&href=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'spurl':
				serviceURL	= 'http://www.spurl.net/spurl.php?v=3';
							+ '&url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'wink':
				serviceURL	= 'http://www.wink.com/_/tag'
							+ '?url=' + encodedurl
							+ '&doctitle=' + encodedtitle;
				break;
				
			case 'live':
				serviceURL	= 'https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&top=1'
							+ '&url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'diigo':
				serviceURL	= 'http://www.diigo.com/post'
							+ '?url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
				
			case 'stumble':
				serviceURL	= 'http://www.stumbleupon.com/submit'
							+ '?url=' + encodedurl
							+ '&title=' + encodedtitle;
				break;
	    }
		
	    if ( serviceURL != null ) {
	        var theNewWin = window.open(serviceURL,'share','width=900,height=640,resizable=yes,toolbar=no,location=no,scrollbars=yes');
	        if ( typeof theNewWin != "undefined" &&
	             theNewWin != null ) {
	            theNewWin.focus();
	        }
	    }
		
	    // remove the layer.
	    //document.getElementById('shareKey').className = "isHidden";
		// reload page for omniture tracking
		reloadWithShare(service);
	}
	
	function reloadWithShare(share) {
		var href = location.href;
		var startPos = href.toLowerCase().indexOf("shared=");
		if (startPos > 0) {
			var endPos = href.toLowerCase().indexOf("&", startPos);
			if (endPos < 0) {
				endPos = href.length;
			}
			
			href = href.substr(0, startPos - 1) + href.substr(endPos, href.length);
		}

		if (href.indexOf("?") >= 0) {
			location.href = href + '&shared=' + share;
		} else {
			location.href = href + '?shared=' + share;
		}
	}
	
	function loadSuggestions(clickObject, productId, pproductId, state) {
		var loadImg = document.getElementById("suggestionsLoadingImg");
		if (loadImg) {
			loadImg.style.display = "";
		}

		var loadText = document.getElementById("suggestionsLoadingText");
		if (loadText) {
			loadText.style.display = "";
		}

		var content = document.getElementById("suggestionsContent");
		if (content) {
			content.style.display = "none";
		}
		
		keyShowUnderAlignRight(clickObject, "suggestionsKey");
		clearTimeout(keyTimer);
		callSuggestions(productId, pproductId, state);
	}
	
	function callSuggestions(productId, pproductId, state) {
		var url = "/v6/services/productservice.aspx?method=recommendationsandaffinity&data=" + state + "|" + productId + "|" + pproductId;

		//var loadText = document.getElementById("suggestionsLoadingText");
		//if (loadText) {
		//	loadText.innerHTML = url;
		//}
		
	    // branch for native XMLHttpRequest object
	    if (window.XMLHttpRequest) {
	        req = new XMLHttpRequest();
	        req.onreadystatechange = showSuggestions;
	        req.open("GET", url, true);
	        req.send(null);
	    // branch for IE/Windows ActiveX version
	    } else if (window.ActiveXObject) {
	        req = new ActiveXObject("Microsoft.XMLHTTP");
	        if (req) {
	            req.onreadystatechange = showSuggestions;
	            req.open("GET", url, true);
	            req.send();
	        }
	    }
	}
	
	function showSuggestions() {
		if (req.readyState == 4) {
			var content = document.getElementById("suggestionsContent");
			if (content) {
				content.innerHTML = req.responseText;
			}
			
			setTimeout("showSuggestionsFinished()", 1000);
		}
	}
	
	function showSuggestionsFinished() {
		var loadImg = document.getElementById("suggestionsLoadingImg");
		if (loadImg) {
			loadImg.style.display = "none";
		}

		var loadText = document.getElementById("suggestionsLoadingText");
		if (loadText) {
			loadText.style.display = "none";
		}

		var content = document.getElementById("suggestionsContent");
		if (content) {
			content.style.display = "";
		}
	}

	function doSearch(terms) {
		if ((terms.length > 0) && (terms != "Enter keyword")) {
			terms = escape(terms);
			//document.location.href = "/search/search_results.asp?Ntt="+terms+"&D="+terms;
			document.location.href = "/v6/search/?term="+terms;
		} else {
			var termPrompt = document.getElementById("searchHints");
			if (termPrompt) {
				termPrompt.style.display = "";
			}
		}
		return false;
	}
	
	function hideSearchHints() {
			var termPrompt = document.getElementById("searchHints");
			if (termPrompt) {
				termPrompt.style.display = "none";
			}
	}
	
	function doAddThisClick(url, lnk) {
		addthis_url = url;
		addthis_title = document.title;
		reloadWithShare("addthis");
		return addthis_click(lnk);
	}

	function gxStateChange(dropdown) {
	    if (dropdown) {
	        var path = location.href;
	        var option = dropdown.options[dropdown.selectedIndex].value;
	        
	        location.href = '/home/newtransfercart.asp?new=' + option + '&next=' + escape(path);
	        return true;
	    }
	}
//-->