function toggleEdit(form) { if(form.edit.value==""){ form.edit.value="Y"; }else{ form.edit.value=""; } form.nurl.value = form.rurl.value; form.submit(); } function linkCat(scLevel, scId){ var form = this.document.forms[0]; //alert("linkCat, called for " + form.name + ":" +scLevel+":"+scId) form.action = "/edealinv/servlet/SearchStoreItems"; form.nurl.value = "control/StoreDirectory.vm"; form.eurl.value = "control/SearchStoreItems.vm"; //alert("linkCat, about to set scId "+form.scId) form.scId.value = scId; //alert("linkCat, scId set "+form.scId.value) form.scLevel.value = scLevel; //form.scName.value = scName; //if(scChildren.length==0) // scChildren=-1; //form.scChildren.value = scChildren; //search criteria form.si_sc_id.value = scId; form.si_title.value = ""; form.csku_name.value = ""; form.st_si_price.value = ""; form.end_si_price.value = ""; form.sidx.value="0"; form.method = "get"; form.submit(); } function itemPage(siId){ var form = this.document.forms[0]; form.action = "/edealinv/servlet/ExecMacro"; form.nurl.value = "control/StoreItem.vm"; form.eurl.value = "control/StoreDirectory.vm"; form.siId.value = siId; //form.cskuName.value = cskuName; //form.siTitle.value = siTitle; //form.siPrice.value = siPrice; //form.siQty.value = siQty; //form.siThmbUrl.value = siThmbUrl; form.method = "get"; form.submit(); } function orderBy(col1){ var form = this.document.forms[0]; //Test form.action = "/edealinv/servlet/SearchStoreItems"; form.nurl.value = "control/StoreDirectory.vm"; form.eurl.value = "control/SearchStoreItems.vm"; if(form.orderby.value==col1){ if(form.sortasc.value=="0"){ form.sortasc.value="1"; }else{ form.sortasc.value="0"; } } form.orderby.value = col1; form.submit(); } // TKO: 10/11/2005 // This function should be used on all the pages except for the home page. function buyItem(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; if (form.ourl) { form.ourl.value = "control/StoreItem.vm"; } form.siId.value = siId; form.siQty.value = qty; form.method = "post"; form.submit(); } // Victor: This function is used for warranty function WarrantybuyItem(form, siId, qty, warranty_id) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN") { alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if // we need to handle multiple items var si_list = siId; var qty_list = qty; // SF - this is for the free gift sku... if(warranty_id) { var si_id_warranty = warranty_id; var qty_id_warranty = "1"; if(si_id_warranty && si_id_warranty != "invalid") { si_list += "," + si_id_warranty; qty_list += "," + qty_id_warranty; } } form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; if (form.ourl) { form.ourl.value = "control/StoreItem.vm"; } form.siId.value = si_list; form.siQty.value = qty_list; form.method = "post"; form.submit(); } function buyItemAndGift(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ // alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); // return; }//if // we need to handle multiple items var si_list = siId; var qty_list = qty; freegiftvalue = eval("form."+"freegift_"+siId+".value"); // SF - this is for the free gift sku... if(freegiftvalue == "Y") { var si_id_gift = eval("form."+"sku_gift_"+siId+".value"); var qty_id_gift = eval("form."+"qty_gift_"+siId+".value"); //alert("si_id: " + si_id_gift); //alert("qty: " + qty_id_gift); if(si_id_gift && si_id_gift != "invalid") { si_list += "," + si_id_gift; qty_list += "," + qty_id_gift; } } //alert("si_list: " + si_list); //alert("qty_list: " + qty_list); form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; if (form.ourl) { form.ourl.value = "control/StoreItem.vm"; } form.siId.value = si_list; form.siQty.value = qty_list; form.method = "post"; form.submit(); } // TKO: 10/11/2005 // This function should be used on all cached pages (ie. home page). function buyItemCached(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; form.siId.value = siId; form.siQty.value = qty; form.method = "get"; form.submit(); } // TKO: 08/10/2006 // This function should be used on all the pages except for the home page, and if the item is coming // from a merchandising area. function buyItemMA(form, siId, qty, maId) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; form.siId.value = siId; form.siQty.value = qty; form.maId.value = maId; form.method = "post"; form.submit(); } // TKO: 08/10/2006 // This function should be used on the home page, if it is cached, and if the item is coming // from a merchandising area. function buyItemMACached(form, siId, qty, maId) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your shopping cart."); return; }//if form.action = "/edealinv/servlet/AddStoreOrderItem"; form.nurl.value = "control/AddOrder.vm"; form.eurl.value = "control/StoreItem.vm"; form.siId.value = siId; form.siQty.value = qty; form.maId.value = maId; form.method = "get"; form.submit(); } // GIFT REGISTRY Functions function addItemToGiftregistry(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your wish list."); return; }//if form.action = "/edealinv/servlet/ManageGiftregistry"; form.giftregistryAction.value = "addStoreItem"; form.nurl.value = "control/ViewGiftregistry.vm"; form.eurl.value = "control/ViewGiftregistry.vm"; if (form.ourl) { form.ourl.value = "control/ViewGiftregistry.vm"; } form.siId.value = siId; form.siQty.value = qty; form.method = "post"; form.submit(); } //SL Dec 2006: Add an item to a specific Gift Registry using a dropdown menu to select the registry ID function addItemToSpecificGiftregistry(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your wish list."); return; }//if form.action = "/edealinv/servlet/ExecMacro"; form.giftregistryAction.value = "addStoreItem"; form.nurl.value = "control/ViewGiftregistry.vm"; form.eurl.value = "control/ViewGiftregistry.vm"; if (form.ourl) { form.ourl.value = "control/ViewGiftregistry.vm"; } form.siId.value = siId; form.siQty.value = qty; form.method = "post"; form.submit(); } // updates the giftregistry function updateGiftregistry(theForm, giftregistryId) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = "updateGiftregistry"; theForm.giftregistryId.value = giftregistryId; theForm.method = "post"; theForm.submit(); } // send email invites to view the giftregistry function sendMailInvitesGiftRegistry(theForm, giftregistryId) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = "sendMailInvites"; theForm.giftregistryId.value = giftregistryId; theForm.method = "post"; theForm.submit(); } // This function is used to remove an item from the giftregistry function removeItemFromGiftRegistry(theForm, giftregistryId, siId) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = "removeStoreItem"; theForm.giftregistryId.value = giftregistryId; theForm.siId.value = siId; theForm.method = "post"; theForm.submit(); } // select the giftregistry function selectGiftregistry(theForm, action) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = action; theForm.giftregistryId.value = theForm.giftregistrySelect.value; theForm.siId.value = ""; theForm.siQty.value = ""; theForm.method = "post"; theForm.submit(); } // removes the giftregistry function removeGiftregistry(theForm, giftregistryId) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = "removeGiftregistry"; theForm.giftregistryId.value = giftregistryId; theForm.method = "post"; var agree=confirm("Are you sure you want to remove this item?"); if (agree) { theForm.submit(); } else { return false ; } } // creates a giftregistry function createGiftregistry(theForm, newGiftregistryName) { theForm.action = "/edealinv/servlet/ManageGiftregistry"; theForm.nurl.value = "control/ViewGiftregistry.vm"; theForm.eurl.value = "control/ViewGiftregistry.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewGiftregistry.vm"; } theForm.giftregistryAction.value = "createGiftregistry"; theForm.giftregistryName.value = newGiftregistryName; theForm.method = "post"; theForm.submit(); } // GIFT REGISTRY Functions // WISH LIST Functions function updateWishlist(theForm, wishlistId) { theForm.action = "/edealinv/servlet/ManageWishlist"; theForm.nurl.value = "control/ViewWishlist.vm"; theForm.eurl.value = "control/ViewWishlist.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewWishlist.vm"; } theForm.wishlistAction.value = "updateWishlist"; theForm.wishlistId.value = wishlistId; theForm.method = "post"; theForm.submit(); } function sendMailInvitesWishlist(theForm, wishlistId) { theForm.action = "/edealinv/servlet/ManageWishlist"; theForm.nurl.value = "control/ViewWishlist.vm"; theForm.eurl.value = "control/ViewWishlist.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewWishlist.vm"; } theForm.wishlistAction.value = "sendMailInvites"; theForm.wishlistId.value = wishlistId; theForm.method = "post"; theForm.submit(); } //adds an item to the wishlist function addItemToWishlist(theForm, siId, qty) { theForm.action = "/edealinv/servlet/ManageWishlist"; theForm.nurl.value = "control/ViewWishlist.vm"; theForm.eurl.value = "control/ViewWishlist.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewWishlist.vm"; } theForm.wishlistAction.value = "addStoreItem"; theForm.siId.value = siId; theForm.siQty.value = qty; theForm.method = "post"; theForm.submit(); } //This function is used to remove an item from the wishlist function removeItemFromWishlist(theForm, wishlistId, siId) { theForm.action = "/edealinv/servlet/ManageWishlist"; theForm.nurl.value = "control/ViewWishlist.vm"; theForm.eurl.value = "control/ViewWishlist.vm"; if (theForm.ourl) { theForm.ourl.value = "control/ViewWishlist.vm"; } theForm.wishlistAction.value = "removeStoreItem"; theForm.wishlistId.value = wishlistId; theForm.siId.value = siId; theForm.method = "post"; var agree=confirm("Are you sure you want to remove this item?"); if (agree) { theForm.submit(); } else { return false ; } } // WISH LIST Functions // This function should be used on all cached pages (ie. home page). function addItemToWishlistCached(form, siId, qty) { //validate quantity var num = new Number(parseInt(qty)); if(num.toString()=="NaN"){ alert(qty +" is not a valid quantity. Please double-check the quantity to add to your wish list."); return; }//if form.action = "/edealinv/servlet/ManageWishlist"; form.wishlistAction.value = "addStoreItem"; form.nurl.value = "control/ViewWishlist.vm"; form.eurl.value = "control/ViewWishlist.vm"; if (form.ourl) { form.ourl.value = "control/ViewWishlist.vm"; } form.siId.value = siId; form.siQty.value = qty; form.method = "get"; form.submit(); } function setMasterAttrValues(f, index) { for(var i=0; i<5; i++){ eval("var attrval = f.attr_val_"+i+"_"+index); if(attrval){ addUpdInput(f, "attr_val_"+i, attrval.value); }//if }//for addUpdInput(f, "csku_master", "Y"); } // setMasterAttrValues function addUpdInput(f, name, value){ eval("var input = f."+name+";") if(input){ input.value = value; }else{ input = document.createElement("INPUT"); input.setAttribute('type', "hidden"); input.setAttribute('name', name); input.setAttribute('value', value); f.appendChild(input); } } // this function should be used mainly for multi-variants with text lists function buyMultiVarItem(theForm) { var si_array = theForm.var_id; var qty_array = theForm.var_qty; var varSize = theForm.varSize.value; var hasQty = false; var si_list = ""; var qty_list = ""; var delim = ""; //alert("variant size: " + varSize); //alert("si_array: " + si_array); //alert("qty_array: " + qty_array); if(varSize == 0) { alert("There are no items available to add to your shopping cart."); return; } // loop through all the items and check the quantity for each else { if(si_array.length > 1) { for(var i=0; itrue; Digital-->false var notDigital = /[^\d]/.test(aDigital); return !notDigital; } function showOrHideCCissueAndStartDate() { var eleCardType = document.getElementById('cctype'); var valueCardType = eleCardType.options[eleCardType.selectedIndex].value; var eleDIV = document.getElementById("divCCissueStartDate"); // Show the div if the card type is "delta" or "solo" if(valueCardType == "delta" || valueCardType == "solo"){ eleDIV.style.display="block"; } // Hide the div and also clean the values else{ eleDIV.style.display="none"; setTextValue("ccissuenum", ""); setComboBoxSelected("ccstartmonth", -1); setComboBoxSelected("ccstartyear", -1); } } function showMaskedAfterBlur(){ // It's a really number not masked var valueNOTMasked = document.getElementById('ccnumberMasked').value; //1. copy real number to hidden field ccnumber document.getElementById('ccnumber').value = valueNOTMasked; //2. mask input field ccnumberMasked's value document.getElementById('ccnumberMasked').value = convertReal2Masked(valueNOTMasked); } function showRealAfterFocus(theForm){ // It's a really number not masked var valueNOTMasked = document.getElementById('ccnumber').value; //1. copy real number to input field ccnumberMasked document.getElementById('ccnumberMasked').value = valueNOTMasked; } function convertReal2Masked(realNum){ if(realNum == null || realNum == "" || realNum.length <= 4){ return realNum; } var length = realNum.length; var maskedNum = ""; for (var i=0; i=37 && currentKey<=40) && // not arrows !(currentKey>=48 && currentKey<=57) && // not main keyboard numbers !(currentKey>=96 && currentKey<=105))){// not numpad numbers if(window.event){//window.event is NOT undefined(IE) event.returnValue=false; } else{//window.event IS undefined(FireFox) event.preventDefault(); } } } //ML Oct 2011: Block dash when type into textfield function blockDashOnInput(theEvent){ //189: dash on main keyboard //109: dash on numpad numbers var event = theEvent || window.event; //IE: theEvent is the same with window.event; Firefox: window.event is undefind var currentKey = event.charCode||event.keyCode;//IE: event.charCode is undefined if(currentKey==189 || // dash on main keyboard currentKey == 109){ // dash on numpad numbers if(window.event){//window.event is NOT undefined(IE) event.returnValue=false; } else{//window.event IS undefined(FireFox) event.preventDefault(); } } } //SL Dec 2006: Allow a link to add a bookmark to the current page function AddBookmark() { var url = document.location.href; var title = document.title; if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel(title, url,""); } else if( window.external ) { // IE Favorite window.external.AddFavorite( url, title); } else if(window.opera && window.print) { // Opera Hotlist return true; } } //SL Dec 2006: Generic SHOW or HIDE DIV to display content function showAndHideContent(contentID, buttonID) { // Check if the content AND button ID exists if(document.getElementById(contentID) && document.getElementById(buttonID)) { // If the content DIV has a class name of hide switch it to show // Else switch it back to hide if(document.getElementById(contentID).className == "hide") { document.getElementById(contentID).className = "show"; document.getElementById(buttonID).className = "standardExpandSectionButtonMinus"; } else { document.getElementById(contentID).className = "hide"; document.getElementById(buttonID).className = "standardExpandSectionButtonPlus"; } } } //SL Dec 2006: Switch generic tabbed display content var prevTab = "tab1"; var prevTabContent = "tab1Content"; function showTab(tabName, tabContent) { // turn the previous tab and its content viewed off document.getElementById(prevTab).className = "standardTabOff"; document.getElementById(prevTabContent).className = "standardTabContent"; // turn the current tab and its content viewed on document.getElementById(tabName).className = "standardTabOn"; document.getElementById(tabContent).className = "standardTabContentShow"; prevTab = tabName; prevTabContent = tabContent; } //SL Dec 2006: Function to swap large image when mousing over thumnail images function show(name,src,href) { var i; var lastvalue_link; for (var i=0; i < document.links.length; i++){ if(document.links[i].id.indexOf("prodimage") != -1){ lastvalue_link = i; break; } } if (document.images) { document.images[name].src = src; for (var i=0; i < document.links.length; i++){ document.links[lastvalue_link].href = "javascript:openWin('" + href + "');"; document.links[lastvalue_link].onclick = "javascript:openWin('" + href + "');"; } } } function out() { } //SL Dec 2006: Function to pop up a window and resize to the destination image size function openWin(img) { winId = window.open('','newwin','menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=yes'); winId.document.write(''); winId.document.write('