// JavaScript Document //browser detection var userBrowser,userPlat; if (navigator.userAgent.indexOf("MSIE") >= 0) userBrowser = "ie"; if (navigator.userAgent.indexOf("Firefox") >= 0 ) userBrowser = "ff"; if (navigator.userAgent.indexOf("Safari") >= 0) userBrowser = "sf"; userPlat = (navigator.userAgent.indexOf("Mac") >= 0) ? "mac" : "pc"; function validQnty(qntTxtField) { if(/[0-9]/.test(qntTxtField.value)) qntTxtField.value=qntTxtField.value.replace(/[a-z]/gi, ""); var val = qntTxtField.value; if (val != null) { val = qntTxtField.value.replace(/^\s+|\s+$/g,""); if (isNaN(val)){ val = '1'; }else{ if (val < 1){ val = '1'; } } } if ( val == null || val == ''){ val = '1'; } qntTxtField.value = val; } //to find x,y of elements (object needs to be passed as variable) function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do{ curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return [curleft,curtop]; } function jsPaus(ms){ var date = new Date(); var curDate = null; do{ curDate = new Date(); } while(curDate - date < ms); } //show the persistent cart function showPersistCart(){ var gotoPage = "/include/ajax/top_nav_persist.jsp"; divTagId="topNavDiv"; var callBack = "function callBackFunc(t) {if (t != null) {showBag(); } }"; sendAjaxRequest(false, gotoPage, document.forms['add_to_cart','dont_add_to_cart'], divTagId, false, null, true, callBack); } function showError(t){ var size = t.length; for(var i=0;i 1) { var callBack = "function callBackFunc(t) {if (t[1] != null) {showBag(); } }"; } else { var callBack = "function callBackFunc(t) {if (t[1] != null) {document.getElementById('persistShoppingBag').style.display = 'block'; isBagOpen(); } }"; } //omniture var s=s_gi(s_account); s.linkTrackVars='channel,prop1,prop11,products,events'; s.linkTrackEvents='scRemove'; s.channel='Shopping Bag:Remove'; s.events='scRemove'; s.prop1=s.channel; s.prop11=s.channel; //s.prop12=s.channel; s.products = ";"+prod; s.tl(this,'o','Remove from Shopping Bag'); //proclivity if (pcFlag == 'true') { wec.cart_remove('sku='+sku, 'price='+price, 'qty='+qty); //alert(sku+':'+price+':'+qty); } sendAjaxRequest(false, gotoPage, document.forms['persistent_shopping_cart'], divTagIds, true, "remove_from_cart", true, callBack); } //check is persistent cart is open/close & do appropriate actions function isBagOpen() { var shoppingBag = document.getElementById("persistShoppingBag"); if(shoppingBag && shoppingBag.style.display == 'block') { shoppingBag.style.display = 'none'; document.getElementById("shoppingBagBttn").src = imgShoppingBagClosePath; var iframe = document.getElementById("if_persistShoppingBag"); if(iframe != null) { iframe.style.display = 'none'; iframe.style.width = 0; iframe.style.height = 0; iframe.style.left = 0; iframe.style.top = 0; } } else { showPersistCart(); document.getElementById("shoppingBagBttn").src = imgShoppingBagOpenPath; } } //close the bag if it is open function closeBag() { var shoppingBag = document.getElementById("persistShoppingBag"); if(shoppingBag && shoppingBag.style.display == 'block') { shoppingBag.style.display = 'none'; document.getElementById("shoppingBagBttn").src = imgShoppingBagClosePath; var iframe = document.getElementById("if_persistShoppingBag"); if(iframe != null) { iframe.style.display = 'none'; iframe.style.width = 0; iframe.style.height = 0; iframe.style.left = 0; iframe.style.top = 0; } } } //open & adjust persistent cart position function showBag() { var shoppingBag = document.getElementById("persistShoppingBag"); if(shoppingBag && shoppingBag.style.display == 'none') { document.getElementById("shoppingBagBttn").src = imgShoppingBagOpenPath; var shpnBagX = findPos(document.getElementById("shoppingBagBttn")); ajustX = (userBrowser == "ie" ? 1 : 1); if (userPlat == "mac" && userBrowser == "sf") { ajustY = 14; } else { ajustY = (userBrowser == "ie" ? 16 : 16); } shoppingBag.style.display = 'block'; shoppingBag.style.left = shpnBagX[0] - ajustX; shoppingBag.style.top = shpnBagX[1] + ajustY; document.getElementById("shoppingBagBttn").src = imgShoppingBagOpenPath; var iframe = document.getElementById("if_persistShoppingBag"); if(iframe != null) { var layer = document.getElementById("persistShoppingBag"); iframe.style.zIndex = layer.style.zIndex - 1; iframe.style.display = 'block'; iframe.style.width = layer.offsetWidth; iframe.style.height = layer.offsetHeight; iframe.style.left = shoppingBag.style.left; iframe.style.top = shoppingBag.style.top; } } } function openPopupGeneral(p_url,p_width,p_height,p_scroll,p_resize){ var p_arguments=""; if(p_width!=null)p_arguments+="width="+p_width+","; if(p_height!=null)p_arguments+="height="+p_height+","; if(p_scroll!=null)p_arguments+="scrollbars="+p_scroll+","; if(p_resize!=null)p_arguments+="resizable="+p_resize; window.open(p_url,'JCpopUp',p_arguments); } function togglePromoDetails(obj, toggle){ var newY = findPos(obj); var descDiv = document.getElementById('globalpromo_detailsDiv'); var detailsDiv = document.getElementById('globalpromo_details'); var iframe = document.getElementById("if_globalpromo"); var promoContainer = document.getElementById("promo_container"); if (toggle == 'open') { descDiv.style.display='block'; descDiv.style.position = 'absolute'; var divHeight = descDiv.offsetHeight; ajustY = (userBrowser == "ie" ? -5 : 10); descDiv.style.left = detailsDiv.offsetLeft + 5; descDiv.style.top = detailsDiv.offsetTop + 25; descDiv.style.zIndex = 800; if (userBrowser == "ie") { promoContainer.style.zIndex = 15; } if(iframe != null) { iframe.style.display = 'block'; iframe.style.position = 'absolute'; iframe.style.width = descDiv.offsetWidth ; iframe.style.height = descDiv.offsetHeight; iframe.style.left = descDiv.offsetLeft; iframe.style.top = descDiv.offsetTop + 2; iframe.style.zIndex = (userBrowser == "ie" ? 0 : descDiv.style.zIndex - 1); } } if (toggle == 'close') { descDiv.style.display='none'; iframe.style.display = 'none'; } } function mkRandomString(stringLength) { var chars = new Array ('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); var charCount = chars.length; var randomString = ""; i = 0; do { randomString += chars[Math.floor(Math.random()*charCount)]; i++; } while (i < stringLength); return randomString; }