// Error validation for cuffed pants var currSwatch; // Clears Error Message for products and cross sale products function clearError(index) { var errorMsgDiv = 'Perror_' + index; var colorInput = 'Pcolor_' + index; errorMsgDiv=document.getElementById(errorMsgDiv); errorMsgDiv.innerHTML = ''; document.getElementById(colorInput).value = ''; } // *** Main Product Detail Functions Only // Rolling over or setting the alternate views function PaltView(image, index, action) { var imageID = 'Pimage_' + index; document.getElementById(imageID).src=image.src; if (action == "set") { eval('PdefImage_' + index).src = image.src; } } function ltrimrtrim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } // *** Cross Sale Functions Only function ProlloverSwatch(image, color, index, swatchObj) { var imageID = 'Pimage_' + index; var colorDiv = 'Pcolor_' + index; document.getElementById(imageID).src=image.src; mainColorDiv=document.getElementById(colorDiv); mainColorDiv.innerHTML=color; swatchObj.border = 2; } function ProlloutImage(index) { var imageID = 'Pimage_' + index; var colorDiv = 'Pcolor_' + index; var defColor = document.getElementById('PdefColor_' + index).value; document.getElementById(imageID).src=eval('PdefImage_' + index).src; mainImageDiv=document.getElementById(colorDiv); mainImageDiv.innerHTML=defColor; } function ProlloutSwatch(swatch, index) { var imageID = 'Pimage_' + index; var colorDiv = 'Pcolor_' + index; var defColor = document.getElementById('PdefColor_' + index).value; var defSwatch = document.getElementById('PdefSwatch_' + index).value; document.getElementById(imageID).src=eval('PdefImage_' + index).src; mainImageDiv=document.getElementById(colorDiv); mainImageDiv.innerHTML=defColor; if (swatch.id != defSwatch){ swatch.border = 1; } } function setSkuId(skuId){ return; // theHiddenSkuId = document.getElementById("productSelSku"); // theHiddenSkuId.value = skuId; } var inventoryErrorHTML = ""; function resetInventoryError() { if (document.getElementById('inventory_error_0')) { document.getElementById('inventory_error_0').innerHTML = ""; document.getElementById('inventory_error_0').style.display = 'none'; } //dynamicDivPopulate('inventory_error_0', inventoryErrorHTML); } function removeMonogramCritter(index) { var gotoPage="/browse/ajax/refresh_product_details.jsp"; divTagIds=new Array(2); divTagIds[0]="product_details_form"; sendAjaxRequest(true, gotoPage, document.forms['add_to_cart'], divTagIds, true, "delete_monogram_detail"); } function swapClass(catLink,newClass) { catLink.className=newClass; var onOff=newClass.substring(4, newClass.length); if(catLink.parentNode.parentNode.getElementsByTagName('img').length > 0) { catLink.parentNode.parentNode.getElementsByTagName('img')[0].src="/media/images/mens"+onOff+".gif"; } } function setViewImg(imgName){ if (imgName != null) { img=imgName.substring(0, imgName.lastIndexOf('&tmp=')); currImg = img + "&tmp=prdDtIm"; document.getElementById('mainImg').src=currImg; } } function changeViewImg(imgName){ img=imgName.substring(0, imgName.lastIndexOf('&tmp=')); document.getElementById('mainImg').src=img + "&tmp=prdDtIm"; } function resetImg(){ // alert("Current Image is " + currImg); document.getElementById('mainImg').src=currImg; } function popBlowup(productCode, imgSrc, divId,isFeatureColor){ var mainImgPos=findPos(document.getElementById(divId)); var a = window.open('/browse/popup_single_product_detail.jsp?jproduct=' + productCode + '&imgSrc=' + imgSrc + '&isFeatureColor=' + isFeatureColor, 'popup', 'toolbars=no,scrollbars=no,menubar=no,width=698,height=720,top='+mainImgPos[1]+',left='+mainImgPos[0]+',screenX='+mainImgPos[0]+',screenY='+mainImgPos[1]); if (a) { if (a.closed) { alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); } else { if (window.focus) { a.focus() } } } else { alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); } } function popSizeChart(chartName){ var a = window.open('/sizecharts/main.jsp?sizeChart='+chartName, 'sizeChart', 'toolbars=no,scrollbars=no,menubar=no,width=920,height=580'); if (a) { if (a.closed){ alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); }else{ if (window.focus){ a.focus() } } }else{ alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); } } function changeMainImage(changeImageUrl){ document.getElementById('mainImg').src=changeImageUrl; } function changeColorName(selectedColorName){ document.getElementById('featureColor').innerHTML = selectedColorName; } function setMonoDetail(index) { var fName = "add_monogram"; divTagId="product_details_form"; var gotoPage = "/browse/ajax/refresh_product_details.jsp?selectedIndex="+index; document.forms[fName].elements['bmForm'].value = "add_to_cart"; sendAjaxRequest(true,gotoPage, document.forms[fName],divTagId, true, "refresh_product_detail"); } function submitMono(index){ if (validFormMong(index)){ setMonoDetail(index); var divObj=document.getElementById('monogramPopUp'+index); divObj.style.display='none'; closePopUp('monogramPopUp0', index); return false; }else{ return false; } } function getMonoDetail(obj,popName ,index) { var gotoPage = "/browse/ajax/refresh_multi_product_mono_detail.jsp?selectedIndex="+index; divTagId=popName+'0'; sendAjaxRequest(false,gotoPage, document.forms["add_to_cart"],divTagId, true, "refresh_product_detail"); showPopup(obj,divTagId, index); } function setCritterDetail(index) { var fName = "critter0"; divTagId="product_details_form"; var gotoPage = "/browse/ajax/refresh_product_details.jsp?selectedIndex="+index; document.forms[fName].elements['bmForm'].value = "add_to_cart"; sendAjaxRequest(true,gotoPage, document.forms[fName],divTagId, true, "refresh_product_detail"); } function submitCritter(index){ if (validFormCrit(index)){ setCritterDetail(index); var divObj=document.getElementById('critterPopUp'+index); divObj.style.display='none'; closePopUp('critterPopUp0', index); return false; }else{ return false; } } function getCritterDetail(obj,popName ,index) { var gotoPage = "/browse/ajax/refresh_multi_product_critter_detail.jsp?selectedIndex="+index; divTagId=popName+'0'; sendAjaxRequest(false,gotoPage, document.forms["add_to_cart"],divTagId, true, "refresh_product_detail"); showPopup(obj,divTagId, index); } var newwindow; function OpenNamedWin(url){ newwindow=window.open(url,'name','height=500,width=500'); if (newwindow) { if (newwindow.closed) { alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); } else { if (window.focus) { newwindow.focus() } } } else { alert('Popup window opened to fail, if you have popup blocker enabled, please disable it.'); } }