//- CopyBillingToShipping -// function CopyBillingToShipping(oForm) { oForm['ShippingName'].value = oForm.BillingName.value; oForm['ShippingAttention'].value = oForm.BillingAttention.value; oForm['ShippingStreet'].value = oForm.BillingStreet.value; oForm['ShippingStreet2'].value = oForm.BillingStreet2.value; oForm['ShippingCity'].value = oForm.BillingCity.value; var cState = oForm.BillingState.value; var o = oForm['ShippingState']; for (var h = 0; h < o.options.length; h++) { if (o.options[h].value == cState) { oForm['ShippingState'].selectedIndex = h; } } oForm['ShippingZip'].value = oForm.BillingZip.value; // oForm['ShippingPhone'].value = null; } //- CopyShippingToBilling -// function CopyShippingToBilling(oForm) { oForm['BillingStreet'].value = oForm.ShippingStreet.value; oForm['BillingStreet2'].value = oForm.ShippingStreet2.value; oForm['BillingCity'].value = oForm.ShippingCity.value; var cState = oForm.ShippingState.value; var o = oForm['BillingState']; for (var h = 0; h < o.options.length; h++) { if (o.options[h].value == cState) { oForm['BillingState'].selectedIndex = h; } } oForm['BillingZip'].value = ExportZip(oForm.ShippingZip.value); // oForm['BillingEmail'].value = null; } //- IfEnterAction -// function IfEnterAction(oEvent, oForm, cAction, cSelId){ if ((EventKeyCode(oEvent) == 13) || (EventKeyCode(oEvent) == 3)) { oForm.Action.value = cAction; oForm.SelId.value = cSelId; oForm.submit(); return false; } return true; } //- IfEnterScript -// function IfEnterScript(oEvent, cScript) { if ((EventKeyCode(oEvent) == 13) || (EventKeyCode(oEvent) == 3)) { eval(cScript); return false; } return true; } //- EventKeyCode -// function EventKeyCode(oEvent) { return ((oEvent != null) && (oEvent.which != null) ? oEvent.which : event.keyCode); } //- ExportZip -// function ExportZip(cStream) { var cZip = cStream.replace(/\?/g, ''); return cZip; } //- ExportFon -// function ExportFon(cStream) { var cFon = ''; if (cStream.length >= 10) { cFon = cStream.substr(0, 3) + '-' + cStream.substr(3, 3) + '-' + cStream.substr(6, 4) if ((cStream.length == 15) && (cStream.substr(10, 5) != '?????')) { cFon += ' x' + cStream.substr(10, 5).replace('?', '') } } return cFon; } //- IsNullLng -// function IsNullLng(cValue, nDefault) { cValue = parseInt(cValue); if ((cValue == null) || (isNaN(cValue) == true)) { return parseInt(nDefault); } return cValue; } //- IsNullDbl -// function IsNullDbl(cValue, nDefault) { cValue = JavaRound(parseFloat((cValue + '').replace(/,/g, '')), 2); if ((cValue == null) || (isNaN(cValue) == true)) { return parseFloat(nDefault); } return cValue; } //- JavaRound -// function JavaRound(cValue, nDecimal) { return Math.round(cValue*Math.pow(10,nDecimal))/Math.pow(10,nDecimal); } //- FormatComma -// function FormatComma(cValue) { bIsNegative = false; if (cValue < 0){ bIsNegative = true; cValue = (cValue+'').replace('-', ''); } cArray = (cValue+'').split('.'); cValue = ''; bIsHit = false; cArray[0] = Math.round(cArray[0]); while (cArray[0] > 999){ var nTemp = ('000' + (cArray[0] % 1000)); nTemp = nTemp.substring(nTemp.length-3, nTemp.length); if (bIsHit == true){ cValue = nTemp + ',' + cValue; }else{ cValue = nTemp; } cArray[0] = parseInt(cArray[0] / 1000); bIsHit = true; } if (bIsHit == true){ cValue = (cArray[0]+'') + ',' + cValue; }else{ cValue = cArray[0]; } if (cArray[1] != undefined){ if (IsNullDbl(cArray[1], 0) > 0){ if ((cArray[1]+'').charAt(0) == '0'){ cValue = cValue + '.0' + (IsNullDbl(cArray[1].charAt(1)) + ''); }else{ cValue = cValue + '.' + (IsNullDbl(cArray[1]) + '00').substring(0, 2); } } } if (bIsNegative == true){ cValue = '-' + cValue; } return cValue; } //- IsNullDbl2 -// function IsNullDbl2(cValue, nDefault) { cValue = JavaRound(parseFloat((cValue + '').replace(/,/g, '').replace('$', '')), 6); if ((cValue == null) || (isNaN(cValue) == true)) { return parseFloat(nDefault); } return cValue; } //- FormatCurrency -// function FormatCurrency(nNumber) { nNumber = nNumber.toString().replace(/\$|\,/g,''); if(isNaN(nNumber)) nNumber = "0"; cSign = (nNumber == (nNumber = Math.abs(nNumber))); nNumber = Math.floor(nNumber*100+0.50000000001); nCents = nNumber%100; nNumber = Math.floor(nNumber/100).toString(); if(nCents<10) nCents = "0" + nCents; for (var i = 0; i < Math.floor((nNumber.length-(1+i))/3); i++) nNumber = nNumber.substring(0,nNumber.length-(4*i+3))+','+ nNumber.substring(nNumber.length-(4*i+3)); return (((cSign)?'':'-') + '$' + nNumber + '.' + nCents); } //- FormatCurrencyNoCent -// function FormatCurrencyNoCent(nNumber) { nNumber = nNumber.toString().replace(/\$|\,/g,''); if(isNaN(nNumber)) nNumber = "0"; cSign = (nNumber == (nNumber = Math.abs(nNumber))); nNumber = Math.floor(nNumber*100+0.50000000001); nNumber = Math.floor(nNumber/100).toString(); for (var i = 0; i < Math.floor((nNumber.length-(1+i))/3); i++) nNumber = nNumber.substring(0,nNumber.length-(4*i+3))+','+ nNumber.substring(nNumber.length-(4*i+3)); return (((cSign)?'':'-') + '$' + nNumber); } //- Console_AddRemove -// function Console_AddRemove(oFromSet, oToSet, bIsAll) { //+ unselect for (var hOption = 0; hOption < oToSet.length; hOption++) { oToSet.options[hOption].selected = false; } //+ move for (hOption = oFromSet.length; hOption != 0; hOption--) { if ((bIsAll == true) || (oFromSet.options[hOption - 1].selected == true)) { oToSet.options[oToSet.length] = new Option(oFromSet.options[hOption - 1].text, oFromSet.options[hOption - 1].value, false, true); oFromSet.options[hOption - 1] = null; } } } //- Console_Pack -// function Console_Pack(oSet, oField) { var cPack = ''; for (var hOption = 0; hOption < oSet.length; hOption++) { cPack += ',' + oSet.options[hOption].value; } oField.value = cPack.substring(1); } //- CreateRequestObject -// function CreateRequestObject() { if (navigator.appName == "Microsoft Internet Explorer"){ return new ActiveXObject("Microsoft.XMLHTTP"); } return new XMLHttpRequest(); }