iMaxCount = "" bMaxItem = "" // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function checks whether the entered qty is correct or not. // @ Pages Affected : Index,Items, searchresult,Psearchresult // @ Function Name : preproc(frm,index,code,type) // @ Input Parameters: frm = Form Name, index = Index value, code = Item Code, type = Item Type // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function preproc(frm,index,code,type,eqCode,iWishList, iUnits) { var element, retval, qty, iItemqty, iTotalqty; element = "document." + frm + ".qty" + index + ".value"; qty = eval(element); retval=IsNumeric(qty) if(retval == 1) { alert(getMessage("iValidQuantity")); eval("document." + frm + ".qty" + index + ".value=iUnits"); eval("document." + frm + ".qty" + index + ".focus()"); return; } iItemqty = qty*1 if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){ iTotalqty = parseInt() if((iItemqty + iTotalqty)>parseInt(iMaxCount)){ alert(getMessage("iTotalQtyExceed") +" "+ iMaxCount); eval("document." + frm + ".qty" + index + ".value=iUnits"); //eval("document." + frm + ".qty" + index + ".focus()"); return; } } document.frmAdditem.qty.value = qty; document.frmAdditem.ic.value = code; document.frmAdditem.type.value=type; document.frmAdditem.EqCode.value=eqCode; document.frmAdditem.action = "includes/add_item.asp?CartId=&Tp=" document.frmAdditem.submit(); } // End of the function preproc(frm,index,code,type) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function gets the selected matrix attributes from the select box // @ and checks whether the particular combination is present or not. // @ Pages Affected : Items // @ Function Name : getattribute(frm,index,code,type) // @ Input Parameters: frm = Form Name, index = Index value, code = Item Code, type = Item Type // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function getattribute(frm,index,code,type) { var iIndex,matrix,arrTemp,strselected,len; iItemCount=index matrix = false; arrTemp = eval("arrSelItems" + iItemCount) strselected = eval("document.frmAdd.SelMatrixAtt1" + iItemCount + ".options[document.frmAdd.SelMatrixAtt1" + iItemCount + ".selectedIndex].value"); strselected = strselected + eval("document.frmAdd.SelMatrixAtt2" + iItemCount + ".options[document.frmAdd.SelMatrixAtt2" + iItemCount + ".selectedIndex].value"); len = document.frmAdd.elements.length; for(iCount=0;iCount <= parseInt(len)-1;iCount++){ if((document.frmAdd.elements[iCount].name.substring(0,13) == "SelMatrixAtt3") && (document.frmAdd.elements[iCount].name.substring(13,14) == iItemCount)) strselected = strselected + eval("document.frmAdd.SelMatrixAtt3" + iItemCount + ".options[document.frmAdd.SelMatrixAtt3" + iItemCount + ".selectedIndex].value"); } for(iIndex=0;iIndex <= arrTemp.length-1;iIndex++){ if(arrTemp[iIndex][1]==strselected){ code = arrTemp[iIndex][0]; matrix = true; break; } } if(matrix){ preproc(frm,index,code,type,"",0) return; } else{ alert(getMessage("iMatrixCombNotPresent")); return; } } // End of the function getattribute(frm,index,code,type) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function checks whether the attributes are unique // @ Pages Affected : Itemmatrix // @ Function Name : attribCheck() // @ Input Parameters: iAttrib3 = (returns 1 if 3rd attribute is present, else returns 0) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function attribCheck(iAttrib3){ var sAttrib1,sAttrib2,sAttrib3; sAttrib1=document.frmMatrix.Attrib1.options[document.frmMatrix.Attrib1.selectedIndex].value; sAttrib2=document.frmMatrix.Attrib2.options[document.frmMatrix.Attrib2.selectedIndex].value; if(sAttrib1==sAttrib2){ alert(getMessage("iUniqueAttributes")); return false; } if(iAttrib3=="1"){ sAttrib3=document.frmMatrix.Attrib3.options[document.frmMatrix.Attrib3.selectedIndex].value; if((sAttrib3==sAttrib1)||(sAttrib3==sAttrib2)){ alert(getMessage("iUniqueAttributes")); return false; } } document.frmMatrix.submit(); } // End of the function attribCheck(iAttrib3) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function gets the selected matrix Items // @ Pages Affected : Itemmatrix // @ Function Name : multiselect() // @ Input Parameters: type = Item type(matrix Item),attribcode3=attribcode3 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function multiselect(type,attribcode3) { var len, iIndex, attributes, qty, code, quantity, retval, attribute_codes,iTotalqty,iItemqty; iTotalqty=0; iItemqty=0; qty = ""; code = ""; attributes = ""; attribute_codes = ""; len = document.frmAdd.elements.length; for(iIndex=0;iIndex <= parseInt(len)-1;iIndex++){ if(document.frmAdd.elements[iIndex].type == "checkbox"){ if(document.frmAdd.elements[iIndex].checked){ arr = document.frmAdd.elements[iIndex].value.split("*"); quantity = eval("document.frmAdd.qty" + arr[0] + ".value") retval=IsNumeric(quantity) if(retval == 1){ alert(getMessage("iValidQuantity")); eval("document.frmAdd.qty" + arr[0] + ".value=1"); eval("document.frmAdd.qty" + arr[0] + ".focus()"); return; } qty = qty + quantity + "*"; code = arr[1]; attributes = attributes + arr[2] + "*"; iItemqty=iItemqty+parseInt(quantity); } } } if(code == ""){ alert(getMessage("iSelectItems")); return; } if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){ iTotalqty = parseInt() if((iItemqty + iTotalqty)>parseInt(iMaxCount)){ alert(getMessage("iTotalQtyExceed") + " " + iMaxCount); return; } } attribute_codes = attribute_codes + (document.frmMatrix.Attrib1.selectedIndex + 1) + "*"; attribute_codes = attribute_codes + (document.frmMatrix.Attrib2.selectedIndex + 1) + "*"; if(attribcode3 != "") attribute_codes = attribute_codes + (document.frmMatrix.Attrib3.selectedIndex + 1); else attribute_codes = attribute_codes + ""; document.frmAdditem.qty.value = qty; document.frmAdditem.ic.value = code; document.frmAdditem.type.value=type; document.frmAdditem.attributes.value = attributes; document.frmAdditem.attribute_codes.value = attribute_codes; document.frmAdditem.submit(); } // End of the function multiselect(type) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : Function IsNumeric checks whether the entered value is a // @ numeric and greater than Zero // @ Function Name : IsNumeric(value) // @ Input Parameters: value to be tested // @ Return Value : 0 - Success 1 - Failure // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function IsNumeric(value) { var validate=/(^\d+$)/ if ((validate.test(value)) && (value > 0)) return 0; else return 1; } // End of the function IsNumeric(value) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function used to format the contents in the field. // @ If value is 100.0 , this funciton will change it to 100.00. // @ Pages Affected : Shipcalculator.asp // @ Function Name : setFormat(field) // @ Input Parameters: field = name of the form and fieldto be formatted // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function setFormat(field){ var i, idiff,strval; var m_Field = eval("document." + field); if(m_Field.value.indexOf(".") < 0) m_Field.value = m_Field.value + ".00"; if(m_Field.value.length-m_Field.value.indexOf(".") == 2) m_Field.value = m_Field.value + "0"; else if(m_Field.value.length-m_Field.value.indexOf(".") > 3){ m_Field.value=m_Field.value.substring(0,m_Field.value.indexOf(".") +3) } idiff=10-m_Field.value.length strval="" for(i=0;i< 10;i++) { strval=strval+ " " if (i==idiff-1){ strval=strval+m_Field.value; break; } } m_Field.value=strval; } // End of the function setFormat(field) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function used to format numbers. // @ If we pass 100 , this funciton will return 100.00. // @ Pages Affected : Shipcalculator.asp // @ Function Name : formatValue(value) // @ Input Parameters: value = then number to be formatted // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function formatValue(value){ return Math.round(value*100)/100; } // End of the function formatValue(value) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function checks whether the entered qty is correct or not. // @ : If any related items is checked then it is passed thru hidden // @ : field called chkitems with ',' as seperator // @ Pages Affected : Itemdesc // @ Function Name : preprocess() // @ Input Parameters: Value to be tested // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function preprocess(iWishList, iUnits){ var retval, iItemqty, iTotalqty, qty, iIndex, iRelatedQty; qty=document.frmAdd.qty.value; retval=IsNumeric(qty); iRelatedQty = 0; if(retval == 1) { alert(getMessage("iValidQuantity")); document.frmAdd.qty.value=iUnits; document.frmAdd.qty.focus(); return; } iItemqty = qty*1 if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){ iTotalqty = parseInt() if (document.frmRelated){ if(document.frmRelated.chkItems.length > 1){ for (iIndex = 0; iIndex < document.frmRelated.chkItems.length; iIndex++){ if (document.frmRelated.chkItems[iIndex].checked){ iRelatedQty = iRelatedQty + parseInt(document.frmRelated.chkItems[iIndex].value.split(",")[1]); } } } else{ if (document.frmRelated.chkItems.checked){ iRelatedQty = parseInt(document.frmRelated.chkItems.value.split(",")[1]); } } } if (document.frmExtended){ if(document.frmExtended.chkItems2.value != "0"){ iRelatedQty = iRelatedQty + 1; } } if((iItemqty + iTotalqty + iRelatedQty)>parseInt(iMaxCount)){ alert(getMessage("iTotalQtyExceed") + " " + iMaxCount); document.frmAdd.qty.value=iUnits; document.frmAdd.qty.focus(); return; } } var sItemList=""; for (count=0;count < document.forms.length;count++){ if (document.forms[count].name=="frmExtended"){ if(document.frmExtended.chkItems2.value != "0"){ sItemList += document.frmExtended.chkItems2.value + "," ; } } if (document.forms[count].name=="frmRelated"){ for(index=0;index < (document.frmRelated.elements.length);index++) { if(document.frmRelated.elements[index].checked){ sItemList+=document.frmRelated.elements[index].value + "," ; iItemqty++; } } } } sItemList = sItemList.substring(0,sItemList.length-1) document.frmAdd.chkItems.value = sItemList; document.frmAdd.submit(); } // End of the function preprocess() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is used to submit the upgrade items form. // @ Pages Affected : Itemdesc // @ Function Name : UpgradeBuy(itemcode) // @ Input Parameters: itemcode = Item Code // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function UpgradeBuy(itemcode,iUnits) { iTotalqty = parseInt() if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){ if(iTotalqty >= parseInt(iMaxCount)){ alert(getMessage("iTotalQtyExceed") + " " + iMaxCount); return; } } document.frmUpgrade.ic.value = itemcode; document.frmUpgrade.qty.value = iUnits; document.frmUpgrade.submit(); } // End of the function UpgradeBuy(itemcode) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is used to delete a particular item from cart. // @ Pages Affected : Viewcart // @ Function Name : DeleteFromCart(itemcode, itemtype, tpcode) // @ Input Parameters: itemcode = Item Code, itemtype = Item Type, tpcode = TpCode // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function DeleteFromCart(itemcode, itemtype, tpcode, eqCode) { if(confirm(getMessage("iRemoveItemFromCart"))) { document.frmDelete.itemcode.value = itemcode; document.frmDelete.itemtype.value = itemtype; document.frmDelete.tpcode.value = tpcode; document.frmDelete.EqCode.value = eqCode; document.frmDelete.submit(); } } // End of the function DeleteFromCart(itemcode, itemtype, tpcode) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is used to empty the cart. // @ Pages Affected : Viewcart // @ Function Name : EmptyCart() // @ Input Parameters: Null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function EmptyCart() { if(confirm(getMessage("iEmptyCart"))) { document.frmDelete.todo.value = "empty"; document.frmDelete.submit(); } } // End of the function EmptyCart() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is used to update the cart contents, as changed // @ by the user. // @ Pages Affected : Viewcart // @ Function Name : UpdateCart(Index) // @ Input Parameters: Index = Total no. of items // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function UpdateCart(Index) { var count,qty,retval,iItemqty; iItemqty=0 for(count = 1;count <= Index;count++) { qty = eval("document.frmCartContents.qty" + count + ".value") var validate=/(^\d+$)/ if (validate.test(qty) == false) { alert(getMessage("iValidQuantity")); eval("document.frmCartContents.qty" + count + ".focus()"); return; } qty=qty*1 iItemqty=iItemqty+qty } if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){ if(iItemqty > parseInt(iMaxCount)){ alert(getMessage("iTotalQtyExceed") + " " + iMaxCount); return; } } document.frmCartContents.submit(); } // End of the function UpdateCart(Index) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called whenever user clicks prev or next navigation. // @ Pages Affected : pSearchresult // @ Function Name : submitSearch(iPageNo) // @ Input Parameters: iPageNo = PageNo // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function submitSearch(iPageNo){ document.frmPSearch.PageNo.value= iPageNo; document.frmPSearch.submit(); } // End of the function submitSearch(iPageNo) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called before submiting page, to validate // @ the min & max price. // @ Pages Affected : PowerSearch // @ Function Name : PowerSearchVal() // @ Input Parameters: null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function PowerSearchVal(sCustTypeInt, sCustTypeDate){ var len,iIndex,bCriteria,fMinval,fMaxval,value ; var validate=/(^\d+$)/ //The hidden variables are being reset to blank when user comes back to page using back button. document.frmPSearch.sManDesc.value = ""; document.frmPSearch.sBrandDesc.value = ""; document.frmPSearch.sCatDesc.value = ""; if(sCustTypeInt!=""){ sCustTypeInt = sCustTypeInt.substring(0,sCustTypeInt.length-1) arr = sCustTypeInt.split(","); for(iIndex=0;iIndex <= arr.length-1;iIndex++){ objField=eval("document.frmPSearch." + arr[iIndex]) if(objField.value!=""){ if(!(validate.test(objField.value))) { alert(getMessage("iValidInteger")); objField.focus(); objField.select(); return false; } } } } if(sCustTypeDate!=""){ sCustTypeDate = sCustTypeDate.substring(0,sCustTypeDate.length-1) arr = sCustTypeDate.split(","); for(iIndex=0;iIndex <= arr.length-1;iIndex++){ smonth=eval("document.frmPSearch." + arr[iIndex]+ "month.options[document.frmPSearch." + arr[iIndex]+ "month.selectedIndex].value") sday=eval("document.frmPSearch." + arr[iIndex]+ "day.options[document.frmPSearch." + arr[iIndex]+ "day.selectedIndex].value") syear=eval("document.frmPSearch." + arr[iIndex]+ "year.options[document.frmPSearch." + arr[iIndex]+ "year.selectedIndex].value") var sdate=new Date(syear, smonth ,sday) var sDefaultDate=new Date(2004,1,1) if((sdate-sDefaultDate)!=0) eval("document.frmPSearch.Txt" + arr[iIndex] + ".value=smonth+'/'+sday+'/'+syear") else eval("document.frmPSearch.Txt" + arr[iIndex] + ".value=''") } } bCriteria=false; len = document.frmPSearch.elements.length; for(iIndex=0;iIndex <= parseInt(len)-1;iIndex++){ if(document.frmPSearch.elements[iIndex].type == "text"){ if(document.frmPSearch.elements[iIndex].value != ""){ if(document.frmPSearch.elements[iIndex].value.charAt(0)==" "){ alert(getMessage("iSearchNoStartSpace")); document.frmPSearch.elements[iIndex].focus(); return false; } bCriteria = true; } } if(document.frmPSearch.elements[iIndex].type == "hidden"){ if(document.frmPSearch.elements[iIndex].value != "") bCriteria = true; } if(document.frmPSearch.elements[iIndex].type == "checkbox"){ if(document.frmPSearch.elements[iIndex].checked) bCriteria = true; } sFldname=document.frmPSearch.elements[iIndex].name if((sFldname == "selCategory")||(sFldname == "selBrand")||(sFldname == "selManufacturer")){ if(document.frmPSearch.elements[iIndex].options[document.frmPSearch.elements[iIndex].selectedIndex].value != "") bCriteria = true; } if(bCriteria) break; } if(! bCriteria) { alert(getMessage("iEnterSearchText")); document.frmPSearch.txtKey.focus(); return false; } fMinval=document.frmPSearch.txtMin.value fMaxval=document.frmPSearch.txtMax.value if(document.frmPSearch.txtMin.value.length > 0) { retval=IsFloat(fMinval); if(! retval) { alert(getMessage("iValidPrice")); document.frmPSearch.txtMin.focus(); document.frmPSearch.txtMin.select(); return false; } fMinval=parseFloat(fMinval); } if(document.frmPSearch.txtMax.value.length > 0) { retval=IsFloat(fMaxval); if(! retval) { alert(getMessage("iValidPrice")); document.frmPSearch.txtMax.focus(); document.frmPSearch.txtMax.select(); return false; } fMaxval=parseFloat(fMaxval); } if(fMaxval < fMinval) { alert(getMessage("iMaxPriceGTMinPrice")); document.frmPSearch.txtMax.focus(); document.frmPSearch.txtMax.select(); return false; } document.frmPSearch.sManDesc.value = document.frmPSearch.selManufacturer.options[document.frmPSearch.selManufacturer.selectedIndex].text; document.frmPSearch.sBrandDesc.value = document.frmPSearch.selBrand.options[document.frmPSearch.selBrand.selectedIndex].text; document.frmPSearch.sCatDesc.value = document.frmPSearch.selCategory.options[document.frmPSearch.selCategory.selectedIndex].text; document.frmPSearch.submit(); } // End of the function powersearchval() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called before submiting page, to validate // @ float value. // @ Pages Affected : PowerSearch // @ Function Name : IsFloat() // @ Input Parameters: price value(Minimum or Maximum) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function IsFloat(value) { var pattern1 = /^(\d+)(\.){0,1}(\d*)$/ var pattern2 = /^(\d*)(\.){0,1}(\d+)$/ return pattern1.test(value) || pattern2.test(value); } // End of the function IsFloat() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called when Delete or Retrieve link is clicked. // @ It is used to change the action depending on the link clicked. // @ Pages Affected : Retreivecart // @ Function Name : RetrieveCart(getcart,todo) // @ Input Parameters: getcart = cartid,todo = 1(Delete) or 0(Retrieve) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function RetrieveCart(getcart,todo) { if(todo=="1") if(confirm(getMessage("iDelSavedCart"))) document.frmRetrieveCart.action = "retrievecart.asp?CartId=&action=DEL"; else return; else document.frmRetrieveCart.action = "retrievecart.asp?CartId=&action=RET"; document.frmRetrieveCart.PrevCartID.value = getcart; document.frmRetrieveCart.submit(); } // End of the function RetrieveCart(getcart,todo) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called when New cart name and Email id is entered. // @ It validates the Name and the Email id. // @ Pages Affected : SaveCart // @ Function Name : SaveCart() // @ Input Parameters: null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function SaveCart(){ if (document.frmSaveCart.CARTNAME.value == ""){ alert(getMessage("iEnterCartName")); document.frmSaveCart.CARTNAME.focus(); return; } if (document.frmSaveCart.CARTNAME.value.charAt(0)==" "){ alert(getMessage("iCartSpaces")); document.frmSaveCart.CARTNAME.focus(); return; } if(document.frmSaveCart.CARTNAME.value.indexOf('"')!=-1) { alert(getMessage("iInvalidCartname")); document.frmSaveCart.CARTNAME.focus(); return; } document.frmSaveCart.action = "savecart.asp?CartId=&action=SN&saved=1" document.frmSaveCart.submit(); } // End of the function SaveCart() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called when New cart name and Email id is entered. // @ It validates the Name and the Email id. // @ Pages Affected : SaveEmail() // @ Function Name : SaveEmail() // @ Input Parameters: null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function SaveEmail(){ // ### Validating email. ret_val = IsEmail(document.frmSaveEmail.EMAIL.value); if (ret_val == 1){ document.frmSaveEmail.EMAIL.focus(); document.frmSaveEmail.EMAIL.select(); return; } document.frmSaveEmail.action = "EmailidReq.asp?CartId=" document.frmSaveEmail.submit(); } // End of the function SaveEmail() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called when when existing cart name is selected. // @ Pages Affected : SaveCart // @ Function Name : RestoreCart() // @ Input Parameters: null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function RestoreCart() { if (document.frmSaveCart.CARTLIST.options[document.frmSaveCart.CARTLIST.selectedIndex].value == 0 ) { alert(getMessage("iChooseCartName")); document.frmSaveCart.CARTLIST.focus(); } else { document.frmSaveCart.action = "savecart.asp?CartId=&action=SE&saved=1" document.frmSaveCart.submit(); } } // End of the function RestoreCart() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function is called to validate the zipcode. // @ Pages Affected : ShipCalculator // @ Function Name : ZipCode_validate() // @ Input Parameters: null // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function ZipCode_validate(bUseDestZone) { var retval; // ### Validating address type if (document.frmShip.RESI.options[document.frmShip.RESI.selectedIndex].value == 0) { alert(getMessage("iAddressType")); document.frmShip.RESI.focus(); return false; } if(document.frmShip.zipcode.value != ""){ if(bUseDestZone.toUpperCase() !="TRUE") { retval=IsNumeric(document.frmShip.zipcode.value) if(retval == 1) { alert(getMessage("iValidZipCode")); document.frmShip.zipcode.focus(); document.frmShip.zipcode.select(); return false; } } } if((bUseDestZone.toUpperCase()=="FALSE") && (document.frmShip.zipcode.value == "")) alert(getMessage("iEnterZipCode")); if(bUseDestZone.toUpperCase()=="TRUE"){ // ### Validating City if((document.frmShip.City.value != "") && (document.frmShip.City.value.charAt(0)==" ") ){ alert(getMessage("iValidText")) document.frmShip.City.focus(); document.frmShip.City.select(); return false; } // ### Validating State/ Province if((document.frmShip.State.value != "") && (document.frmShip.State.value.charAt(0)==" " )){ alert(getMessage("iValidText")) document.frmShip.State.focus(); document.frmShip.State.select(); return false; } } document.frmShip.submit(); } // End of the function ZipCode_validate() // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : Function is to validate the alphanumeric characters and string. // @ Pages Affected : Shipcalculator // @ Function Name : isAlphanumeric(str,cSpace) // @ Input Parameters : formname = name of the form // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function isAlphanumeric(str,cSpace){ var sSpacepat = /^(((\w+)[\s,\-*\.]*)+)$/ var sPat = /^(((\w+)[*,\-\.]*)+)$/ if (cSpace=="1"){ if(!(sSpacepat.test(str))) { alert(getMessage("iValidText")); return false; } } else{ if(!(sPat.test(str))) { alert(getMessage("iValidText")); return false; } } return true; } // End of the function isAlphanumeric(str,cSpace) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : This function changes the no. of days dynamically according to // @ the month and the year. // @ Pages Affected : powersearch.asp // @ Function Name : DateValidate(which) // @ Input Parameters: which = field // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function DateValidate(which) { var sel = eval("document.frmPSearch." + which + "day.selectedIndex"); var i=eval("document.frmPSearch." + which + "month.options[document.frmPSearch." + which + "month.selectedIndex].value"); var j=eval("document.frmPSearch." + which + "year.options[document.frmPSearch." + which + "year.selectedIndex].value"); var k; if(i=="1" || i=="3" || i=="5" || i=="7" || i=="8" || i=="10" || i=="12") { eval("document.frmPSearch." + which + "day.length=31"); for(k=28;k <= 30;k++) { eval("document.frmPSearch." + which + "day.options[" + k + "].value=" + parseInt(k+1)); eval("document.frmPSearch." + which + "day.options[" + k + "].text=" + parseInt(k+1)); } } if(i=="4" || i=="6" || i=="9" || i=="11") { eval("document.frmPSearch." + which + "day.length=30"); for(k=28;k <= 29;k++) { eval("document.frmPSearch." + which + "day.options[" + k + "].value=" + parseInt(k+1)); eval("document.frmPSearch." + which + "day.options[" + k + "].text=" + parseInt(k+1)); } } var mydate = new Date(); if(i==2) { mydate.setDate(1); mydate.setYear(j); mydate.setMonth(1); mydate.setDate(31); var k=31-mydate.getDate(); eval("document.frmPSearch." + which + "day.length=" + k); if((k==29) || (k==28)) { eval("document.frmPSearch." + which + "day.options[" + (k-1) + "].value=" + k); eval("document.frmPSearch." + which + "day.options[" + (k-1) + "].text=" + k); } } if((sel+1) > eval("document.frmPSearch." + which + "day.length")) { eval("document.frmPSearch." + which + "day.selectedIndex=document.frmPSearch." + which + "day.length-1"); } } // End of the function DateValidate(which) // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @ Description : Validation for EMail @ // @ Function Name : IsEmail() @ // @ Input Parameters : Value to be tested @ // @ Return Value : 0 - Success @ // @ 1 - Failure @ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ function IsEmail(strEmail) { var intReturn =1; var emailPat=/^(.+)@(.+)$/ var specialChars="\\(\\)<>'@,;:\\\\\\\"\\.\\[\\]'" var validChars="\[^\\s" + specialChars + "\]" var quotedUser="(\"[^\"]*\")" var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/ var atom=validChars + '+' var word="(" + atom + "|" + quotedUser + ")" var userPat=new RegExp("^" + word + "(\\." + word + ")*$") var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$") var matchArray=strEmail.match(emailPat) if (matchArray==null ) { alert(getMessage("iValidEmail")); return intReturn; } var user=matchArray[1] var domain=matchArray[2] if (user.match(userPat)==null) { alert(getMessage("iValidEmail")); return intReturn; } var IPArray=domain.match(ipDomainPat) if (IPArray!=null) { // this is an IP address for (var i=1;i <= 4;i++) { if (IPArray[i]>255) { alert(getMessage("iValidEmail")); return intReturn; } } intReturn=0; return intReturn; } var domainArray=domain.match(domainPat) if (domainArray==null) { alert(getMessage("iValidEmail")); return intReturn; } var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) if (domArr[domArr.length-1].length < 2 || domArr[domArr.length-1].length > 4) { alert(getMessage("iValidEmail")); return intReturn; } var len=domArr.length if (len < 2) { var errStr = getMessage("iValidEmail"); alert(errStr) return intReturn; } intReturn=0; return intReturn; } // End of the function IsEmail(strEmail)