
/* COOKIES *************************************************** */
// http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days) {
	var expires = "";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}

/* SMOOTH BOXES ********************************************* */
function showModal(url,height,width){
	if ((getCurrentPDTMonth()==0) && (getCurrentPDTDate() < 10) && (url.indexOf('/TBG/GeneralContent/Shipping') > -1)) {
		showModal('/TBG/GeneralContent/Modal/Shipping_Inventory.jsp','340','545');
	} else if ((url.indexOf('/TBG/GeneralContent/Shipping_and_Returns.jsp') > -1)) {
		location.href='/TBG/GeneralContent/Shipping_and_Returns.jsp';
	} else if (url.indexOf('/TBG/GeneralContent/Shipping.jsp') > -1) {
		location.href='/TBG/GeneralContent/Shipping_and_Returns.jsp';
	} else if (url.indexOf('/store/catalog/product_detail_modal.jsp') > -1) {
		TB_show('',url+'?TB_iframe=true&height=525&width=888',false);			
	} else if (url.indexOf('/TBG/GeneralContent/Modal/SalesTax_TBD') > -1) {
		TB_show('',url+'?TB_iframe=true&height=400&width=600',false);	
//	} else if (url.indexOf('pages.exacttarget.com') > -1){
//		TB_show('',url+'&TB_iframe=true&height='+height+'&width='+width,false);
	} else if (url.indexOf('/TBG/GeneralContent/Modal/quicklink_shipping.jsp') > -1) {
		TB_show('',url+'?TB_iframe=true&height=460&width=840',false);
	} else {
		if (url.indexOf('?') > -1) {
			TB_show('',url+'&TB_iframe=true&height='+height+'&width='+width,false);
		} else {
			TB_show('',url+'?TB_iframe=true&height='+height+'&width='+width,false);
		}
	}
}

/* MINICART ************************************************* */
function toggleMiniCart(){
	if ($('minicart_container').getStyle('top') == '-200px')
	{
		showMiniCart(false);
	} else {
		hideMiniCart();
	}
}

var blnItemAdded = false; // to be checked in lastCall, below, for addition of 'checkout' link

function showMiniCart(autoHide){
	blnItemAdded = true;
	if ($('minicart_container').getStyle('top') == '-210px')
	{
//		new Fx.Style('minicart_container', 'top',{duration: 1000, transition: Fx.Transitions.sineInOut}).start(-210,0);
	}
	if (autoHide == true)
	{
//		setTimeout("hideMiniCart()", 3000);
	}
}
function hideMiniCart(){
	if ($('minicart_container').getStyle('top') != '-210px')
	{
//		new Fx.Style('minicart_container', 'top',{duration: 1000, transition: Fx.Transitions.sineInOut}).start(0,-210);
	}
}

// **************************************************************************//
// **************************************************************************//
// **************************************************************************//
/* TODO: These variables and methods are used specifically for these templates
   Acquity should remove this code and use their own navigational controls */
// *************************************************************************//
function clientSideInclude(id, url) {
	var req = false;
	// For Safari, Firefox, and other non-MS browsers
	if (window.XMLHttpRequest) {
		try {
			req = new XMLHttpRequest();
		} catch (e) {
			req = false;
		}
	} else if (window.ActiveXObject) {
		// For Internet Explorer on Windows
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				req = false;
			}
		}
	}
	var element = document.getElementById(id);
	if (!element) {
		alert("Bad id " + id + 
		"passed to clientSideInclude." +
		"You need a div or span element " +
		"with this id in your page.");
		return;
	}
	if (req) {
		// Synchronous request, wait till we have it all
		req.open('GET', url, false);
		req.send(null);
		element.innerHTML = req.responseText;
	} else {
		element.innerHTML =
		"Sorry, your browser does not support " +
		"XMLHTTPRequest objects. This page requires " +
		"Internet Explorer 5 or better for Windows, " +
		"or Firefox for any system, or Safari. Other " +
		"compatible browsers may also exist.";
	}
}


// PRINT *************************************************************//
function printpage(){  
	if (window.print) {
		window.print() ;  
	} else {
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
		WebBrowser1.outerHTML = "";  
	}
}

// swaps images for rollover functions of <input/> tags
function imageRollOver (image_replacement, elementID) {
	try {
		var imagetag = document.getElementById(elementID);
		imagetag.src = image_replacement;
	} catch(e) {
		// relax	
	}
}


if ((window.location.toString().indexOf('/TBG/Gifts/Gift_Cards.jsp') > -1) && (window.location.search.toString().indexOf('cm_mmc=TransEmail-_-Confirm') > -1)) {
	window.location = '/TBG/Gifts/GiftCards_M.jsp';
}

if ((window.location.toString().indexOf('/store/catalog/product_detail.jsp') > -1) && (window.location.search.toString().indexOf('prd_id=845524441764369') > -1)) {
	window.location = '/';
}

/*
if (window.location.toString().indexOf('www.tommybahama.com/store/catalog/search_results.jsp') > -1) {
	var headID = document.getElementsByTagName("head")[0];
    var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/media/TB001/images/static/css/search.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
	
}
*/

function showModalDiv(e) {
	var el_1 = document.getElementById('imgModalContent1');
	var el_2 = document.getElementById('imgModalContent2');
	
	if (e=='1') {
		el_1.style.display = 'block';
		el_2.style.display = 'hidden';
	} else {
		el_2.style.display = 'block';
		el_1.style.display = 'hidden';
	}
}

function isNumeric(x) {
	return (x!=null && !isNaN(x));
}


function getTopBGPromo() {
	return '<a style="color:#cc0000;font-family:Georgia;font-size:11px;" href="javascript:showModal(\'/TBG/GeneralContent/Modal/Swim2010.jsp\',\'471\',\'300\');">&gt; Spend $100 and then get 50% off all women\'s swimsuits and coverups*</a>';	
}

function socks() {
	showModal('/TBG/GeneralContent/Modal/sock_promo.jsp','318','645');
}

/*
////////////////////////////////////////////////////////////////////////
//
// begin background assignment

var strNavPath = '';
if (window.location.toString().indexOf('/PRD_BT') > -1) {
	strNavPath = 'bandt_';
} else if (window.location.toString().indexOf('/TBG/Men') > -1) {
	strNavPath = 'men_';
} else if (window.location.toString().indexOf('/TBG/Big_and_Tall') > -1) {
	strNavPath = 'bandt_';
} else if (window.location.toString().indexOf('/TBG/Women') > -1) {
	strNavPath = 'women_';
} else if (window.location.toString().indexOf('/TBG/Swim') > -1) {
	strNavPath = 'swim_';
} else if (window.location.toString().indexOf('/TBG/Home') > -1) {
	strNavPath = 'homedecor_';
} else if (window.location.toString().indexOf('/TBG/Stores') > -1) {
	strNavPath = 'storesrestaurants_';
} else if (window.location.toString().indexOf('/TBG/Live_the_Life') > -1) {
	strNavPath = 'livethelife_';
} else {
	strNavPath = '';
}

document.write('<style type="text/css">');
//if (readCookie('bookit')=='on') {
	document.write('.top_nav_bg {background:url(/media/TB001/images/static/global/nav/bg_nav_'+strNavPath+'20110519.jpg) no-repeat;}');
//} else {
//	document.write('.top_nav_bg {background:url(/media/TB001/images/static/navbar2/bg_nav_'+strNavPath+'20101111.jpg) no-repeat;}');
//}
document.write('</style>');


//  end background assignment
//
////////////////////////////////////////////////////////////////
*/
if (navigator.userAgent.toLowerCase().indexOf('msie 6') > -1) {
	document.write('<link rel="stylesheet" type="text/css" href="/media/TB001/images/static/css/ie6.css" />');
	if (readCookie('ie6user')=='yes') {
		// you've been told within the last day.
	} else {
		if (window.location.toString().indexOf('/ie6.jsp') > -1) {
			// sit still
		} else {
			location.href = '/TBG/GeneralContent/ie6.jsp';
		}
	}
}

if (navigator.userAgent.toLowerCase().indexOf('msie 7') > -1) {
	var objMainBackground = $$('.main_background')[0];
	try {
		if (objMainBackground) {
			if (objMainBackground.style.top=='-111px') {
				objMainBackground.style.top = '-36px';
			}
		}
	} catch(e) {
		
	}
}
/*
// IE < 8
if ((navigator.userAgent.toLowerCase().indexOf('msie') > -1) && (navigator.userAgent.toLowerCase().indexOf('msie 8') < 0)) {
	document.write('<style type="text/css">');
	document.write('#divNumberOfItems {top:-147px;left:800px;}');
	document.write('</style>');	
}
*/
// non-IE:
if (navigator.userAgent.toLowerCase().indexOf('msie') < 0) {
	document.write('<style type="text/css">');
	document.write('#divSuggest {padding-top:100px;}');
	document.write('</style>');	
}

/*
//fix giftcard page layout issues
if ((window.location.toString().indexOf('/PRD_GC') > -1) || (window.location.toString().indexOf('/store/catalog/product_giftcard.jsp') > -1)) {
	document.write('<link rel="stylesheet" type="text/css" href="/media/TB001/images/static/css/giftcards.css" />');
	document.write('<style type="text/css">');		
	if (navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
		document.write('	.product_detail_bg {top:6px;}');
		document.write('	.detail_paperclip_giftcard {top:14px;}');
	} else {
		document.write('.product_detail_bg{top:-8px;}');
		document.write('.detail_paperclip_giftcard{top:0px;}');
	}
	document.write('</style>');
}
*/

if (getQuerystring('secret')=='on') {
	createCookie('secret','on',365);
} else if (getQuerystring('secret')=='off') {
	eraseCookie('secret');	
}

if (getQuerystring('showbv')=='on') {
	createCookie('bv','on',365);
} else if (getQuerystring('showbv')=='off') {
	eraseCookie('bv');	
}

if (getQuerystring('secret')=='yes') {
	createCookie('james','on',365);
}


if (getQuerystring('scottie')=='on') {
	createCookie('scottie','on',365);
} else if (getQuerystring('scottie')=='off') {
	eraseCookie('scottie');	
}

if (getQuerystring('darryl')=='on') {
	createCookie('darryl','on',365);
} else if (getQuerystring('darryl')=='off') {
	eraseCookie('darryl');	
}

if (getQuerystring('debug')=='on') {
	createCookie('debug','on',365);
} else if (getQuerystring('debug')=='off') {
	eraseCookie('debug');	
}


if (readCookie('bv')=='on') {
	document.write('<style type="text/css">#partnerContainer, #reviewdiv {display:block;}</style>');
}

function ddebug(strIncoming) {
	if (readCookie('debug')=='on') {
		alert(strIncoming);
	}
}

//////////////////////////////////////////////////////////////
//
//  to support SalesForce forms
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">');

//
//
//////////////////////////////////////////////////////////////

function lastCall() {
	
	try {
		var objTitleTag = document.getElementsByTagName('title')[0];
		if (objTitleTag.innerHTML=='null') {
			objTitleTag.innerHTML = 'Tommy Bahama';
		}
	} catch (e) {
		// do nothing
	}
	
	////////////////////////////////////////////////////////////////////////
	//
	// begin background assignment
	
	var strNavPath = 'plain_';
	try {		
		var objBreadcrumbs = document.getElementById('divBreadcrumbs');
		var objBreadcrumb = objBreadcrumbs.getElementsByTagName('a')[0];
	
		if (trim(objBreadcrumb.innerHTML) == "Shop Men's:") {
			strNavPath = 'men_';
		} else if (trim(objBreadcrumb.innerHTML) == "Shop Big &amp; Tall:") {
			strNavPath = 'bandt_';
		} else if (trim(objBreadcrumb.innerHTML) == "Shop Women's:") {
			strNavPath = 'women_';
		} else if (objBreadcrumb.innerHTML.indexOf("Swim") > -1) {
			strNavPath = 'swim_';
		} else if (objBreadcrumb.innerHTML.indexOf("Home") > -1) {
			strNavPath = 'homedecor_';
		} else if (objBreadcrumb.innerHTML.indexOf("Stores") > -1) {
			strNavPath = 'storesrestaurants_';
		} else if (trim(objBreadcrumb.innerHTML) == "Live the Life:") {
			strNavPath = 'ltl_';
		}
		
	} catch(e) {
		// do nothing
	}

	if ($('divIsHomePage')!=null) {
		strNavPath = 'plain_';
	}

	document.write('<style type="text/css">');
//	if (readCookie('james')=='on') {
//		document.write('.top_nav_bg {background:url(/media/TB001/images/static/global/nav/bg_nav_'+strNavPath+'20110913.gif) no-repeat;}');
//		document.write('body {background-image: url("/media/TB001/images/static/global/background_20110915.jpg"); background-position: 50% 0%; background-repeat: no-repeat;background-color:#111824;}');
//	} else {
		document.write('.top_nav_bg {background:url(/media/TB001/images/static/global/nav/bg_nav_'+strNavPath+'20120126.jpg) no-repeat;}');
//	}
	document.write('</style>');


	//  end background assignment
	//
	////////////////////////////////////////////////////////////////

	
	//On the Gift Cards Listing page, show a range of prices, instead of $25:
	if ((window.location.toString().indexOf('GiftCards_M.jsp') > -1) || (window.location.toString().indexOf('Gift_Cards.jsp') > -1) || (window.location.toString().indexOf('Traditional_Gift_Card.jsp') > -1)) {
		$$(".cat_product_desc").each(
			function(target){
				target.innerHTML = target.innerHTML.replace('$25','$25-$1000');
			}
		);
	}


	var elJimi = $$('.leftnav')[0];
	if (elJimi) {
		try {
			if (window.location.toString().indexOf('/TBG/GeneralContent/mockups/') > -1) {
				// don't do anything for mockups
			} else {
				
				var arrImages = elJimi.getElementsByTagName('img');
				
				var objImageDiv = elJimi.getElementsByTagName('div')[0];				
				
				/////////////////////////////////////////////////////////////////////
				//
				//  Highlight "Shop" links
				
				var objULOne = elJimi.getElementsByTagName('ul')[0];
				var arrTopLevelUL = objULOne.getElementsByTagName('ul');
				var arrTopLevelLI;
				var objTopLevelAnchor;
				var arrAnchorText;
				
				for (i=0;i<arrTopLevelUL.length;i++) {
					arrTopLevelLI = arrTopLevelUL[i].getElementsByTagName('li');
					for (x=0;x<arrTopLevelLI.length;x++) {
						if ((arrTopLevelLI[x].className=='leftnav_dotted') || ((arrTopLevelLI[x].id=='leftnav_sub') || (arrTopLevelLI[x].id=='leftnav_sub_on'))) {
							ddebug(objTopLevelAnchor.innerHTML);
							if (trim(arrTopLevelLI[x].innerHTML.toString().toLowerCase()).indexOf('top 25 gifts') > -1) {
								var arrSubs = arrTopLevelLI[x].getElementsByTagName('a');
								for (n=0;n<arrSubs.length;n++) {
									//ddebug(arrSubs[n].innerHTML.toLowerCase());
									if (arrSubs[n].innerHTML.toLowerCase().indexOf('top 25 gifts') > -1) {
										arrSubs[n].href += '?showAll=1';
									}
								}

							}
						} else {
							objTopLevelAnchor = arrTopLevelLI[x].getElementsByTagName('a')[0];
							arrAnchorText = trim(objTopLevelAnchor.innerHTML).split(" ");
							if (arrAnchorText[0]=='Visit') {
								objTopLevelAnchor.style.fontWeight = 'bold';
							}
							if (arrAnchorText[0].indexOf('Valentine') > -1) {
								objTopLevelAnchor.style.color = '#cc3333';
							}							
							if (trim(objTopLevelAnchor.innerHTML.toString()).indexOf('Jeans Event') > -1) {
								objTopLevelAnchor.style.textTransform = 'uppercase';
								objTopLevelAnchor.style.color = '#cc3333';
								objTopLevelAnchor.style.fontWeight = 'bold';
							}
							if (objTopLevelAnchor.innerHTML.toString().indexOf('Men\'s Swim Shop') > -1) {
								if (window.location.toString().indexOf('/TBG/Swim_Mens') > -1) {
									objTopLevelAnchor.innerHTML = '<img src="/media/TB001/images/static/leftnav_arrow.gif" class="leftnav_arrow" border="0" /> ' + objTopLevelAnchor.innerHTML;
									arrTopLevelLI[x].id = 'leftnav_on';
								} 
							}
							if (objTopLevelAnchor.innerHTML.toString().indexOf('Women\'s Swim Shop') > -1) {
								if (window.location.toString().indexOf('/TBG/Swim_Womens') > -1) {
									objTopLevelAnchor.innerHTML = '<img src="/media/TB001/images/static/leftnav_arrow.gif" class="leftnav_arrow" border="0" /> ' + objTopLevelAnchor.innerHTML;
									arrTopLevelLI[x].id = 'leftnav_on';
								}
							}
							if (trim(objTopLevelAnchor.innerHTML.toString()).indexOf('Holiday Gift') > -1) {
								objTopLevelAnchor.style.color = '#990000';
								objTopLevelAnchor.style.fontWeight = 'bold';
							}
						}
					}
				}
				
				//
				//
				/////////////////////////////////////////////////////////////////////
				
				if (window.location.toString().indexOf('/TBG/Swim_Womens') > -1) {
					var objULOne = elJimi.getElementsByTagName('ul')[0];
					var objULTwo = objULOne.getElementsByTagName('ul')[2];
					var arrLI = objULTwo.getElementsByTagName('li');
					var objAnchor;
					for (i=0;i<arrLI.length;i++) {
						if (arrLI[i].innerHTML.toString().indexOf('Black') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#000000';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Double Chocolate') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#533b3b';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Amethyst') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#c37d97';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Ocean Teal') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#017ba4';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Blue Lagoon') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#5771bc';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Sandstone') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#000000';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Mandarin Orange') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#000000';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Midnight Blue') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#2b2a38';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Blue Lapis') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#9abce9';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Mercury') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#898a8f';
						}
						if (arrLI[i].innerHTML.toString().indexOf('Pink') > -1) {
							objAnchor = arrLI[i].getElementsByTagName('a')[0];
							objAnchor.style.color = '#ffc0cb';
						}
					}
				}
			}
			
		} catch(e) {
			// do nothing
		}
	}


	
	if ((window.location.toString().indexOf('/store/myaccount/returns_confirm_print.jsp') > -1) || (window.location.toString().indexOf('/store/checkout/order_confirm_print.jsp') > -1)) {
		document.write('<style type="text/css">');
		document.write('.main_logo {background: url("/media/TB001/images/static/tommy_logo_print.gif") no-repeat;width:328px;height:54px;}');
		document.write('</style>');
	}
	

	if ((window.location.toString().indexOf('/Island_Values') > -1) || (window.location.toString().indexOf('/Like_Father_Like_Son.jsp') > -1)) {
		document.write('<style type="text/css">');
		document.write('.cat_product_desc {color:#e78a31;}');
		document.write('</style>');
		
	}




	/////////////////////////////////////////////////////////
	//  Positioning of upper-right images (contact us/checkout)
	// insert entire contact us/checkout paper in upper right

	try {
		var objTopNavPromo = document.getElementById('divTopNavPromo');

//		if ($('divIsHomePage') != null) {
			// unique free ship banner on shop home
//			objTopNavPromo.innerHTML = '<img src="/media/TB001/images/static/spacer.gif" width="410" height="50" border="0" alt="" />';
//		} else {
/*		if (getCurrentPSTMonth()==10 && getCurrentPSTDate()>19 && getCurrentPSTDate()<29) {
			objTopNavPromo.innerHTML = '<a href="javascript:showPromo()"><img src="/media/TB001/images/static/global/nav/promo_with_ship_20111120.png" width="410" height="85" border="0" alt="" /></a>';
		} else {
			objTopNavPromo.innerHTML = '<a href="javascript:showPromo()"><img src="/media/TB001/images/static/global/nav/free_ship_20111118.png" width="410" height="85" border="0" alt="" /></a>';
		}
*/
//		}
	} catch(e) {
		// not every page has divTopNavPromo...
	}

	//
	/////////////////////////////////////////////////////////
	
	if (window.location.toString().indexOf('/store/catalog/product_detail_modal.jsp') > -1) {
		document.write('<link rel="stylesheet" type="text/css" href="/media/TB001/images/static/css/productdetailmodal.css" />');
	}
	
	var objContactEmailConfirm = document.getElementById('contact-email-confirm');
	if (objContactEmailConfirm!=null) {
		objContactEmailConfirm.autocomplete = 'off';
	}
	var objCreditCardNumber = document.getElementById('credit-card-number');
	if (objCreditCardNumber!=null) {
		objCreditCardNumber.autocomplete = 'off';
	}
	
	// kill mm7.net pixel - 03/17/2011.  Stopgap until we get it removed from the template.
	try {
		var arrImages = document.getElementsByTagName('img');
		if (arrImages[(arrImages.length - 1)].src.indexOf('mm7.net') > -1) {
			arrImages[(arrImages.length - 1)].style.display = 'none';
		}
	} catch (e) {
		// do nothing
	}

	if (window.location.toString().indexOf('/store/checkout/address_details.jsp') > -1) {
		try {
			
			var objPromoCodeInputDiv = document.getElementById('promo_code_input'); // if there's a promo code input, then we're not really ON the address page, but on the cart when it's refreshed with an error.  URL bug.
			if (!objPromoCodeInputDiv) {
				var strSiteTipDiv = '<div id="divSiteTip"><img src="/media/TB001/images/static/checkout/sitetip2.jpg" border="0" alt="FYI - Using a Gift Card - If you have a Tommy Bahama gift card, you\'ll need it for the next step. Be sure to enter it as payment before your credit card." /></div>';
				var objRightPaymentInfo = $$('.right_payment_info')[0];
				objRightPaymentInfo.innerHTML += strSiteTipDiv;
			
				var objShippingSelect = document.getElementById('cartshipping');
				objShippingSelect.style.width = '190px';
			}
	
		} catch(e) {
			//alert(e.toString());
		}
	}

	
	////////////////////////////////////////////////////////////////////
	// GOHAC 
	//
	if ((window.location.toString().indexOf('/PRD_TH7352') > -1) || (window.location.toString().indexOf('/PRD_TH7353') > -1) || (window.location.toString().indexOf('/PRD_TH7354') > -1) || (window.location.toString().indexOf('/PRD_TW20499') > -1) || (window.location.toString().indexOf('/PRD_TB1017-BR') > -1) || (window.location.toString().indexOf('/PRD_T32577') > -1)) {
		var objDetailText = $$('.product_detail_text')[0];
		var objDetailTextDiv = objDetailText.getElementsByTagName('div')[1];
		objDetailTextDiv.innerHTML += '<div style="margin-top:8px;margin-bottom:16px;"><img src="/media/TB001/images/static/gohac/gohac_large.gif" width="247" height="84" border="0" alt="The Garden of Hope and Courage" /></div>';
	}
	//
	////////////////////////////////////////////////////////////////////

	window.addEvent('load', function() {
		var objSearchInput = document.getElementById("searchFor");
	
		if (objSearchInput != null) {
			if (document.referrer != document.location.href) {
				objSearchInput.value = 'Keyword or Style #';
			}
		}
	});
	
	var objSearchInput = document.getElementById("searchFor");

	if (objSearchInput != null) {
		objSearchInput.blur = function() {
			if (objSearchInput.value=='') {
				objSearchInput.value = 'Keyword or Style #';
			}
		}
	}


	// shopping bag updates
	if ((window.location.toString().indexOf('/store/checkout/cart.jsp') > -1) || (window.location.toString().indexOf('/store/checkout/address_details.jsp') > -1)) {
		// sometimes the cart can be shown when the URL is "address_details.jsp"
		try {
			var objPromoCodeInputDiv = document.getElementById('promo_code_input');// if there's a promo code input, then we're not really ON the address page, but on the cart when it's refreshed with an error.  URL bug.
			if (objPromoCodeInputDiv) {
				var objShippingInfo = $$('.bag_shipping_info_link')[0];
				objShippingInfo.innerHTML = objShippingInfo.innerHTML.replace("[shipping info]", "When will my order&nbsp;ship?");
				
				//widen shipping options drop-down (width is hardcoded, inline)
				var objShippingSelect = document.getElementById('cartshipping');
				objShippingSelect.style.width = '190px';
				
				var objShippingSelectDiv = objShippingSelect.parentNode;
				objShippingSelectDiv.style.width = '180px';
				var objShippingSelectTD = objShippingSelectDiv.parentNode;
				objShippingSelectTD.style.width = '200px';
				
				var objShoppingTable = $$('.shoppingbag_table_new')[0];
				var arrShoppingBagTD = objShoppingTable.getElementsByTagName('td');
				arrShoppingBagTD[4].width = '102';
				
				//move the gift box image over a little..
				var objGiftWrapLink = document.getElementById('giftServicesLink');
				var objGiftWrapImage = objGiftWrapLink.getElementsByTagName('img')[0];
				objGiftWrapImage.style.marginLeft = '28px';
				
				var objBookContent = $$('.book_content')[0];
				objBookContent.style.width = '888px';
				
				var objContinueButton = $$('.btn_continue_left')[0];
				var objContinueButtonTD = objContinueButton.parentNode;
				objContinueButtonTD.width = '618';
				
				var arrCartImages = document.getElementsByTagName('img');
				for (i=0; i<arrCartImages.length; i++) {
					if (arrCartImages[i].src.toString().indexOf('title_bar.gif') > -1) {
						arrCartImages[i].width = '888';
						arrCartImages[i].style.width = '888px';
					}
				}

				var objPromoCodeInputTD = objPromoCodeInputDiv.parentNode;
				var objPromoCodeInputTR = objPromoCodeInputTD.parentNode;
				var objPromoCodeInputTB = objPromoCodeInputTR.parentNode;
				var objPromoCodeInputTable = objPromoCodeInputTB.parentNode;
				//if (((getCurrentPSTMonth() > 9) && (getCurrentPSTDate() > 17)) || (getCurrentPSTMonth() > 10)) {
					//hide promo code table
				if (window.location.toString().indexOf('www.tommybahama.com') > -1) {
					//uncomment the following line to hide the promo code table:
					//objPromoCodeInputTable.style.display = 'none';
				}
				//}
				
				//widen promo code table
				objPromoCodeInputTable.style.width = '888px';
			
				var objPromoCodeLeftTD = objPromoCodeInputTR.getElementsByTagName('td')[0];
				objPromoCodeLeftTD.style.width = '626px';
				
				var objPromoCodeInput = document.getElementById('promotionCode');
				if (objPromoCodeInput) {
					objPromoCodeInput.onkeyup = function () {
						objPromoCodeInput.value = objPromoCodeInput.value.toUpperCase();
						objPromoCodeInput.value = objPromoCodeInput.value.replace(" ","");
						if ((objPromoCodeInput.value.length > 5) && (isNumeric(objPromoCodeInput.value))) {
							alert('If this is a Gift Card, please move forward in the checkout process and enter the Gift Card number within the "Payment Options" step.');
							objPromoCodeInput.value = '';
							objPromoCodeInput.blur();
						}
					}
				}
			}
		} catch(e) {
			//alert(e.toString());
		}
		
		try { 
			if (objShoppingTable) {
				var arrShoppingTableRows = objShoppingTable.getElementsByTagName('tr');
				var objShoppingTableTD = arrShoppingTableRows[0].getElementsByTagName('td')[0];
				var strInnerHTML = '';
				// start at the fifth row because that's the first possible row the PGC can appear in
				for (i=3;i<arrShoppingTableRows.length;i++) {
					objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[0];
					if (objShoppingTableTD) {
						if (objShoppingTableTD.innerHTML.indexOf('/PRD_PGC') > -1) {
							strInnerHTML = objShoppingTableTD.getElementsByTagName('a')[0].innerHTML; // grab what's inside the anchor
							objShoppingTableTD.innerHTML = strInnerHTML; // restore the anchor's contents (sans anchor--unlinked)
						}
					}
					objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[1];
					if (objShoppingTableTD) {
						if (objShoppingTableTD.innerHTML.indexOf('FREE GIFT') > -1) {
							strInnerHTML = objShoppingTableTD.innerHTML.replace('<font color="red">FREE GIFT</font>','[<a href="javascript:showModal(\'/TBG/GeneralContent/Modal/ShoePromo2010.jsp\',\'430\',\'740\');">FREE GIFT</a>]'); // replace "FREE GIFT" text with [FREE GIFT] link
							objShoppingTableTD.innerHTML = strInnerHTML; // restore the cell's contents
						}
						if (objShoppingTableTD.innerHTML.indexOf('Click here for free gift wrapping!') > -1) {
							strInnerHTML = objShoppingTableTD.innerHTML.replace('Gift Box','');
							strInnerHTML = strInnerHTML.replace('<br>GB0001<br>','');
							strInnerHTML = strInnerHTML.replace('<font color="red">Click here for free gift wrapping!</font>','<font color="red">You qualify for FREE Gift Services!<br />Click here to wrap your gifts.</font>');
							
							var objQuantitySelect;
							var objRemoveLink;
							objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[2];
							objShoppingTableTD.innertHTML = '';
							objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[3];
							objShoppingTableTD.innertHTML = '';
							objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[4];
							objShoppingTableTD.innertHTML = '';
							objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[5];
							objQuantitySelect = objShoppingTableTD.getElementsByTagName('select')[0];
							objQuantitySelect.style.display = 'none';
							objRemoveLink = objShoppingTableTD.getElementsByTagName('a')[0];
							objRemoveLink.style.display = 'none';
							
						}
					}
				}
			}
		} catch(e) {
			//alert('[' + i + '] ' + e.toString());
		}

		
	}

	if ((window.location.toString().indexOf('/store/checkout/order_review.jsp') > -1) || (window.location.toString().indexOf('/store/checkout/order_confirm') > -1)) {
		var objShoppingTable = $$('.shoppingbag_table')[0];
		try { 
			if (objShoppingTable) {
				var arrShoppingTableRows = objShoppingTable.getElementsByTagName('tr');
				var objShoppingTableTD = arrShoppingTableRows[0].getElementsByTagName('td')[0];
				var strInnerHTML = '';
				var objShoppingPromoAnchor;
				// start at the fifth row because that's the first possible row the PGC can appear in
				for (i=3;i<arrShoppingTableRows.length;i++) {
					objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[0];
					if (objShoppingTableTD) {
						if (objShoppingTableTD.innerHTML.indexOf('/PRD_PGC') > -1) {
							strInnerHTML = objShoppingTableTD.getElementsByTagName('a')[0].innerHTML; // grab what's inside the anchor
							objShoppingTableTD.innerHTML = strInnerHTML; // restore the anchor's contents (sans anchor--unlinked)
						}
					}
					objShoppingTableTD = arrShoppingTableRows[i].getElementsByTagName('td')[1];
					if (objShoppingTableTD) {
						if (objShoppingTableTD.innerHTML.indexOf('/PRD_PGC') > -1) {
							objShoppingPromoAnchor = objShoppingTableTD.getElementsByTagName('a')[0];
							strInnerHTML = objShoppingTableTD.getElementsByTagName('a')[0].innerHTML; // grab what's inside the anchor
							objShoppingTableTD.removeChild(objShoppingPromoAnchor);
							objShoppingTableTD.innerHTML = strInnerHTML + objShoppingTableTD.innerHTML; // restore the anchor's contents (sans anchor--unlinked)
							//objShoppingTableTD.innerHTML += '<font color="red">FREE GIFT</font>','[<a href="javascript:showModal(\'/TBG/GeneralContent/Modal/ShoePromo2010.jsp\',\'430\',\'740\');">FREE GIFT</a>]'; // restore "FREE GIFT", with link
						}
						if (objShoppingTableTD.innerHTML.indexOf('FREE GIFT') > -1) {
							strInnerHTML = objShoppingTableTD.innerHTML.replace('<font color="red">FREE GIFT</font>','[<a href="javascript:showModal(\'/TBG/GeneralContent/Modal/ShoePromo2010.jsp\',\'430\',\'740\');">FREE GIFT</a>]'); // replace "FREE GIFT" text with [FREE GIFT] link
							objShoppingTableTD.innerHTML = strInnerHTML; // restore the cell's contents
						}
					}
				}
			}
			

/*			
			// remove sIFR <h3> headers
			var arrH3 = document.getElementsByTagName('h3');
			var strH3Text = '';
			var objH3Parent;
			for (i=0; i<arrH3.length; i++) {
				if (arrH3[i].innerHTML.indexOf('SIZE') > -1) {
					strH3Text = '<div style="margin-left:6px;margin-right:6px;font-size:11px;font-family:Georgia;font-weight:bold;text-align:center;">' + arrH3[i].innerHTML + '</div>';
				} else {
					strH3Text = '<div style="margin-left:6px;margin-right:6px;font-size:11px;font-family:Georgia;font-weight:bold;">' + arrH3[i].innerHTML + '</div>';
				}
				
				arrH3[i].style.display = 'none';
				objH3Parent = arrH3[i].parentNode;
				objH3Parent.innerHTML = objH3Parent.innerHTML.replace('</h3>', '</h3>'+strH3Text);
				objH3Parent.innerHTML = objH3Parent.innerHTML.replace('</H3>', '</H3>'+strH3Text);
			}

			//alert(i);
*/		
		} catch(e) {
			//alert('[' + i + '] ' + e.toString());
		}

	}

	if (((window.location.toString().indexOf('/store/checkout/order_review.jsp') > -1) || (window.location.toString().indexOf('/store/account/order_detail.jsp') > -1)) && (navigator.userAgent.toLowerCase().indexOf('msie') > -1)) {
		try {
			// fix for IE--otherwise the footer doesn't adjust its vertical position accordingly...
			var objFooter = $('divFooter');
			objFooter.style.display = 'none';
			//document.write('<style type="text/css">#divFooter {top:71px;}</style>')
		} catch (e) {
			// do nothing
		}
	}

	if (window.location.toString().indexOf('/TBG/GeneralContent/ContactUs.jsp') > -1) {
		var objContactForm = $$('.accountForm')[0];
		var objContactFormText = objContactForm.getElementsByTagName('div')[0];
		objContactFormText.style.width = '680px';
		var objMainContent = $$('.main_content')[0];
	}
		
	if (window.location.toString().indexOf('Like_Father_Like_Son.jsp') > -1) {
		var arrProductDesc = $$('.product_desc');
		var objAnchor;
		for (i=0;i<arrProductDesc.length;i++) {
			objAnchor = arrProductDesc[i].getElementsByTagName('a')[0];
			if (objAnchor.innerHTML.indexOf('Boys') > -1) {
				//do nothing
			} else {
				objAnchor.innerHTML = 'Men\'s ' + objAnchor.innerHTML;
			}
		}
	}
	
	try {
		var objFooter = $('divFooter');
		if (objFooter.parentNode.className=='book_container') {
			objFooter.style.left = '0px';
		}
		if (navigator.appVersion.toString().indexOf('AppleWebKit') > -1) {
			document.write('<style type="text/css">.grid, #divCatListMainTopHTML, .restaurant_wrapper, .cat_grid {top:-4px;left:-11px;} .grid_footer_30 {left:-7px;} #cat_list_table {left:25px;} .main_background {top:-50px;} #divBeachBanner {left:26px;position:relative;} </style>');
		}
		if ($('divBreadcrumbNav')==null) {
			document.write('<style type="text/css">.main_content {padding-top:18px;}</style>');
		}
	} catch(e) {
		// do nothing
	}
	
	try {
		if ($('main_content').getElement('form.edit_personal_information')) {
			var arrStrong = document.getElementsByTagName('strong');
			for (i=0;i<arrStrong.length;i++) {
				if (arrStrong[i].innerHTML == 'Password:') {
					arrStrong[i].innerHTML = 'New Password:';
				}
			}
		}
	} catch (e) {
		//alert(e.toString());
	}
	
	//added by RG on 012412 to hide pdp promo -- remove later
	if(document.getElementById('divPromoContainer') != null)document.getElementById('divPromoContainer').style.display="none";
	
	
	/*
	// Kill dotted outline around links:
	var arrLinks = document.getElementsByTagName('a');
	for (i=0;i<arrLinks.length;i++) {
		arrLinks[i].onmousedown = function () {
			this.blur();
			return false;
		}
		arrLinks[i].onclick = function() {
			this.blur();
		}
		if ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) ) {
			arrLinks[i].onfocus = function() {
				this.blur();
			}
		}
	}
	*/

}

function showPromo() {
	
	showModal('/TBG/GeneralContent/Modal/Free_Shipping.jsp','300','575');

	/*
	if (getCurrentPSTMonth()==10 && getCurrentPSTDate()>19 && getCurrentPSTDate()<29) {
		showModal('/TBG/GeneralContent/Modal/Free_Shipping.jsp','310','550');
	} else {
		showModal('/TBG/GeneralContent/Modal/Free_Shipping.jsp','310','550');
	}	
	*/
	
}

function showEprize() {
	popupWindow('http://tommybahama.promo.eprize.com/paradisegiveaway/','626','970');
}


function emailSignup() {
//	location.href = '/TBG/EmailSignup.jsp';

	var objEmailSignupInput = document.getElementById('txtEmailSignup');
	var lnk = 'http://pages.exacttarget.com/page.aspx?QS=773ed3059447707ddea6110ebb8616436a6a8798f3bdc497b48d6ac64d34fcd6';
	var w = 272;
	var h = 346;
	
	var topOffset = (screen.height - h) / 2;
	var leftOffset = (screen.width - w) / 2;
	settings='width='+w+',height='+h+',top='+topOffset+',left='+leftOffset+',scrollbars=0,status=0,location=0';
	var popupname='emailSignup';
	var win = window.open(lnk, popupname , settings);
	win.focus();
}


function showShareThis() {
	
	if (window.location.toString().indexOf('product_detail_modal.jsp') > -1) {
		//do nothing; don't show "share this" in a cross-sell modal.
	} else {
		document.write('<div id="divProceedToCheckout" style="display:block;margin-top:8px;text-align:right;"><a href="/store/checkout/cart.jsp"><img src="/media/TB001/images/static/btn_proceed_to_checkout.gif" border="0" alt="Proceed to Checkout" /></a></div>');
	}
}






function hideFlyout(e) {
	try {
		hideElement(e);
		if (window.location.toString().indexOf('/TBG/PRD_') > -1) {
			var objIframe = document.getElementById('S7ProdTest');
		//	showElement(objIframe);
		}
	} catch(e) {
	
	}
}

function showFlyout(e) {
	try {
		showElement(e);
		
	} catch(e) {
		alert(e.toString());
	}
}

function hideElement(e) {
	try {
		e.style.display='none';	
	} catch(e) {
		
	}
}

function showElement(e) {
	try {
		e.style.display='block';	
	} catch(e) {
		
	}
}

function showShippingModal() {
	showModal('/TBG/GeneralContent/Shipping.jsp','560','640');
}

/******************************************************
	View Larger Link on Product Details Page
******************************************************/

function viewLarger(strPagePath,strStyle,strSelectedColor, productId) {
	var strImageFormat = '';
	var intScreenWidth = screen.width;
	var intPopupWidth = 708;
	var intPopupHeight = 645;
	
	var lnk = strPagePath+"?if=" + strImageFormat + "&style=" + strStyle + "&color=" + strSelectedColor +"&productId=" + productId, intPopupHeight,intPopupWidth;
	var w = intPopupWidth;
	var h = intPopupHeight;
	
	var topOffset = (screen.height - h) / 2;
	var leftOffset = (screen.width - w) / 2;
	settings='width='+w+',height='+h+',top='+topOffset+',left='+leftOffset;
	var popupname='viewLarger';
	var win = window.open(lnk, popupname , settings);
	win.focus();
	
}

function updateLargeImage(strImageFormat,path,img) {
	var objLargeImage = document.getElementById("imgLarge");
	var strURL = "";
	strURL += path.toString() + img.toString() + '?$' + strImageFormat.toString() + '$';
	objLargeImage.src = strURL;
}


function closeModal() {
	parent.TB_remove();
}

function closeWindow() {
	window.close();
}

/******************************************************
	End View Larger Link
******************************************************/

function showEmailSignup() {
	location.href = '/TBG/EmailSignup.jsp'
	/*
	var lnk = 'http://pages.exacttarget.com/EmailSignUp';
	var w = 413;
	var h = 445;
	
	var topOffset = (screen.height - h) / 2;
	var leftOffset = (screen.width - w) / 2;
	settings='width='+w+',height='+h+',top='+topOffset+',left='+leftOffset+',scrollbars=0,status=0,location=0';
	var popupname='emailSignup';
	var win = window.open(lnk, popupname , settings);
	win.focus();
	*/
}

/******************************************************
	Two functions that used to be written inline along with the footer HTML:
**/
function popupWindow(lnk, h, w) {
	var topOffset = (screen.height - h) / 2;
	var leftOffset = (screen.width - w) / 2;
	settings='width='+w+',height='+h+',top='+topOffset+',left='+leftOffset;
	var popupname='defaultName';
	var win = window.open(lnk, popupname , settings);
}


function newWindow(lnk) {
	var win = window.open(lnk, "fullscreen");
}

/**
******************************************************/

/********************************************************
	Quicklink Modals
**/
function quickLink(strWhich,blnWrite) {
	strReturnHTML = '';
	strReturnURL = '';
	switch(strWhich) {
		//  These return modal links:
		case 'returns':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_returns.jsp','220','680')";
			strReturnHTML = 'Free, Easy Returns';
			break;
		case 'shipping':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_shipping.jsp','460','800')";
			strReturnHTML = 'Shipping Options &amp; Rates';
			break;
		case 'international':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_shipping.jsp?show=Intl','460','880')";
			strReturnHTML = 'International Shipping';
			break;
		case 'canada':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_shipping.jsp?show=Canada','460','800')";
			strReturnHTML = 'Shipping to Canada';
			break;
		case 'gifts':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_gifts.jsp','340','680')";
			strReturnHTML = 'Sending a Gift';
			break;
			
		//  These just spawn modals immediately (nothing returned):
		case 'taxes':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_taxes.jsp','400','520')";
			break;
		case 'duty':
			strReturnURL = "showModal('/TBG/GeneralContent/Modal/quicklink_duty.jsp','200','520')";
			break;
	}
	if (blnWrite == true) {
		var strReturn = '<a href="javascript:' + strReturnURL + '">' + strReturnHTML + '</a>';
		return strReturn;
	} else {
		eval(strReturnURL);
	}
}


/*****************************************************
*  mediaForge - this boolean determines whether or not to write the global mediaForge "basic tag" to the page.
*	the "basic tag" should not be written on Product Detail or Confirmation pages; it's set to false for those pages
* 	via /templates/store/catalog/product_detail_redesign/main_content.jsp and 
*	/templates/store/checkout/order_confirm/inc_confirm_thirdparty_tags.jsp, respectively.  The global "basic tag"
*	is printed via /templates/store/global/post.jsp when blnMF_Global==true.
*/
	var blnMF_Global = true;
/*
*
******************************************************/

/**
******************************************************/

/********************************************************
	Size Charts
**/

function showSizeChart(strWhich,strURL) {
	// for now, we're ignoring strURL and hardcoding a different one below, to avoid prematurely overwriting the old one:
	var strFullURL = "/TBG/GeneralContent/Modal/Size_Charts.jsp?show=" + strWhich;
	var strWidth = '';
	var strHeight = '';
	//javascript:showModal(strFullURL, '550', '750');
	if (strWhich=='TBM') {
		strWidth = '850';
		strHeight = '375';
	} else if(strWhich=='TBK') {
		strWidth = '765';
		strHeight = '285';
	} else if(strWhich=='TW') {
		strWidth = '850';
		strHeight = '215';
	} else if(strWhich=='TSW') {
		strFullURL = '/TBG/GeneralContent/Modal/Swim_Size_Help.jsp';
		strWidth = '690';
		strHeight = '515';
	} else if(strWhich=='BT') {
		strWidth = '765';
		strHeight = '400';
	} else if(strWhich=='TBMF') {
		strWidth = '315';
		strHeight = '400';
	} else if(strWhich=='TBWF') {
		strWidth = '315';
		strHeight = '350';
	}
	if (strWidth.length > 0) {
		showModal(strFullURL, strHeight, strWidth);
	} else {
		window.location = '/TBG/GeneralContent/Size_Chart.jsp';
	}
}

/**
******************************************************/


function getQuerystring(key, default_) {
	if (default_==null) {
		default_="";
	}
	key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
	var qs = regex.exec(window.location.href);
	if(qs == null) {
		return default_;
	} else {
		return qs[1];
	}
}


function Left(str, n) {
	if (n <= 0) {
		return "";
	} else if (n > String(str).length) {
		return str;
	} else {
		return String(str).substring(0,n);
	}
}

function Right(str, n) {
	if (n <= 0) {
		return "";
	} else if (n > String(str).length) {
		return str;
	} else {
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}


/////////////////////////////////////////////////////////////////////
// fix for sunglass promo;

var Sunglass20OffPromo;
var SwimSummer2010Test;
var WomensSwimPromoeMail;
var WomensSwimPromoSiteWide;
var WomensSwimPromoFaceBook;
var BigandTall25offwithPCBIGDEAL;
var BigandTall25offwithPCBIGDEAL2;
var DenimFall2010Test;
var DenimFall2010;

function showPromoModal(o) {
	//showModal('/TBG/GeneralContent/Modal/SwimPromo.jsp','375','650');
	//showDenimPromo();
	showModal('/TBG/GeneralContent/Modal/glass.jsp','230','425');
}

//
/////////////////////////////////////////////////////////////////////

function showDenimPromo() {
	if ((getCurrentPDTMonth() == 9) && ((getCurrentPDTDate() > 20) && (getCurrentPDTDate() < 24))) {
		// denim promo with free shipping
		showModal('/TBG/GeneralContent/Modal/Free_Shipping.jsp','450','550');
	} else {
		// denim promo
		showModal('/TBG/GeneralContent/Modal/Denim_Promo.jsp','350','400');
	}
}

function showFitVideo(strWhich,intWhich) {
	if (strWhich == 'm') {
		showModal('/TBG/GeneralContent/Modal/video/denim_men.jsp' + '?v=' + intWhich,'402','824');
	} else if (strWhich == 'w') {
		showModal('/TBG/GeneralContent/Modal/video/denim_women.jsp' + '?v=' + intWhich,'402','824');
	} else if (strWhich == 'bt') {
		showModal('/TBG/GeneralContent/Modal/video/denim_bigtall.jsp' + '?v=' + intWhich,'402','824');
	}
}

function showCCV() {
	showModal('/TBG/GeneralContent/Modal/CVV.jsp','450','560');
}

function shippingRestrictions(strType) {
	showModal('/TBG/GeneralContent/Modal/Shipping_Restrictions.jsp?rest='+strType,'450','560');
}

function shippingRestrictionError(strType) {
	showModal('/TBG/GeneralContent/Modal/Shipping_Restrictions.jsp?rest='+strType,'450','560');
}

function getCurrentPSTHour(){
	var TimezoneOffset = -8;  // PST
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var hour = time.getHours(); 
	return hour;
}

function getCurrentPSTDate(){
	var TimezoneOffset = -8;  // PST
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var date = time.getDate(); 
	return date;
}

function getCurrentPSTMonth(){
	var TimezoneOffset = -8;  // PST
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var month = time.getMonth(); 
	return month;
}

function getCurrentPSTDay(){
	var TimezoneOffset = -8;  // PST
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var day = time.getDay(); 
	return day;
}

function getCurrentPDTHour(){
	var TimezoneOffset = -7;  // PDT
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var hour = time.getHours(); 
	return hour;
}

function getCurrentPDTDate(){
	var TimezoneOffset = -7;  // PDT
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var date = time.getDate(); 
	return date;
}

function getCurrentPDTMonth(){
	var TimezoneOffset = -7;  // PDT
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var month = time.getMonth(); 
	return month;
}

function getCurrentPDTDay(){
	var TimezoneOffset = -7;  // PDT
	var localTime = new Date();
	var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000;
	var time =  new Date(ms);
	var day = time.getDay(); 
	return day;
}

function ieFlickerFix(){
	//FIX for IE flicker with CSS rollover images
	try {
	  document.execCommand("BackgroundImageCache", false, true);
    } catch(err) {
    }
}

function removeDashes(element2Scrub) {
	var dashedElement = document.getElementsByName(element2Scrub);
        if (dashedElement != null) {
		var noDashes = dashedElement[0].value;
		dashedElement.value = noDashes.replace(/-/g,"");
	}
}

function writeURL(strURL) {
	window.location = 'http://' + window.location.host.toString() + strURL;
}

function writeSecureURL(strURL) {
	window.location = 'https://' + window.location.host.toString() + strURL;
}

function trim(str) {
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}


