function n2d(num) { var tmp1 = cents = dollars = ""; var dec = -1; num=String(num) num = num.split(",") num=num.join("") num=parseFloat(num) num = "" + (Math.round(num * 100)/100); dec = num.indexOf("."); cents = ((dec > 0) ? num.substring(dec,num.length) : ".00"); if (cents.length == 2) cents += "0"; dollars = "" + parseInt(num); tmp1 = insComma(dollars); num = ""; for (i = tmp1.length-1; i >= 0; i--) num += tmp1.charAt(i);; num += cents; return num; } function insComma(data) { var count = i = 0; var tmpStr = ""; var comma = ","; for (i = data.length-1; i >= 0; i--) { if (count == 3) { tmpStr += comma; count = 1; } else count ++; tmpStr += data.charAt(i); } return(tmpStr); } function extractDigits(mixedString) { digitsOnly = ''; thisDigit = ''; for (i = 0; i < mixedString.length; i++) { thisDigit = mixedString.charAt(i); if (thisDigit >= '0' && thisDigit <= '9') digitsOnly = digitsOnly + thisDigit; } return digitsOnly; } function checkMod10(ccNumber) { translateMap = '0246813579'; digitSum = 0; translateFlag = ((ccNumber.length % 2) == 0); for (i = 0; i < ccNumber.length; i++) { digitSum += parseInt(translateFlag ? translateMap.charAt(ccNumber.charAt(i)) : ccNumber.charAt(i) , 10) translateFlag = !translateFlag; } return (digitSum % 10) == 0; } function validCardType(ccNumber) { cardLengths = new Array ( 'v', 13, 'v', 16, 'm', 16, 'a', 15, 'c', 14, 'd', 16); cardDigits = new Array ( 'v', '4', 'm', '51', 'm', '52', 'm', '53' , 'm', '54', 'm', '55', 'a', '34', 'a', '37', 'c', '300', 'c', '301', 'c', '302', 'c', '303', 'c', '304', 'c', '305', 'c', '36', 'c', '38', 'd', '6011'); validCard = false; correctLength = false; cardType = '' ; for (i = 0; i < cardDigits.length - 1; i += 2) { if (cardDigits[i + 1] == ccNumber.substr(0, cardDigits[i + 1].length)) { validCard = true; cardType = cardDigits[i]; break; } } if (validCard) { cardLen = ccNumber.length; for (i = 0; i < cardLengths.length - 1; i += 2) { if ((cardType == cardLengths[i]) && (cardLen == cardLengths[i + 1])) { correctLength = true; break; } } validCard = correctLength; } return validCard; } function ccCheck(ccNumber) { ccDigits = extractDigits(ccNumber); if (checkMod10(ccDigits) && validCardType(ccDigits)) { return true; } else { alert('Invalid credit card number') return false } } digits = "0123456789"; phoneNumberDelimiters = "()- "; validWorldPhoneChars = phoneNumberDelimiters; minDigitsInIPhoneNumber = 10; function isInteger(s) { i; for (i = 0; i < s.length; i++) { c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } return true; } function stripCharsInBag(s, bag) { // i; returnString = ""; for (i = 0; i < s.length; i++) { c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function checkInternationalPhone(strPhone){ s=stripCharsInBag(strPhone,validWorldPhoneChars); return (isInteger(s) && s.length == minDigitsInIPhoneNumber); } function checkzip(strzip){ z=stripCharsInBag(strzip,validWorldPhoneChars); return (isInteger(z) && (z.length <= 9 && z.length>4)); } function echeck(str) { at="@" dot="." lat=str.indexOf(at) lstr=str.length ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid Email Address") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid Email Address") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid Email Address") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid Email Address") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid Email Address") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid Email Address") return false } if (str.indexOf(" ")!=-1){ alert("Invalid Email Address") return false } return true } dtCh= "/"; minYear=1900; maxYear=2100; function isInteger(s){ i; for (i = 0; i < s.length; i++){ // Check that current character is number. c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ i; returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr){ daysInMonth = DaysArray(12) pos1=dtStr.indexOf(dtCh) pos2=dtStr.indexOf(dtCh,pos1+1) strMonth=dtStr.substring(0,pos1) strDay=dtStr.substring(pos1+1,pos2) strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ alert("The event date format should be : mm/dd/yyyy") return false } if (strMonth.length<1 || month<1 || month>12){ alert("Please enter a valid event date month") return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ alert("Please enter a valid event date day") return false } if (strYear.length != 4 || year==0 || yearmaxYear){ alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear+" for event date.") return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ alert("Please enter a valid event date") return false } return true } function Mod10(ccNumb) { // v2.0 var valid = "0123456789" // Valid digits in a credit card number var len = ccNumb.length; // The length of the submitted cc number var iCCN = parseInt(ccNumb); // integer of ccNumb var sCCN = ccNumb.toString(); // string of ccNumb sCCN = sCCN.replace (/^s+|s+$/g,''); // strip spaces var iTotal = 0; // integer total set at zero var bNum = true; // by default assume it is a number var bResult = false; // by default assume it is NOT a valid cc var temp; // temp variable for parsing string var calc; // used for calculation of each digit // Determine if the ccNumb is in fact all numbers for (var j=0; j= 15){ // 15 or 16 for Amex or V/MC for(var i=len;i>0;i--){ // LOOP throught the digits of the card calc = parseInt(iCCN) % 10; // right most digit calc = parseInt(calc); // assure it is an integer iTotal += calc; // running total of the card number as we loop - Do Nothing to first digit i--; // decrement the count - move to the next digit in the card iCCN = iCCN / 10; // subtracts right most digit from ccNumb calc = parseInt(iCCN) % 10 ; // NEXT right most digit calc = calc *2; // multiply the digit by two // Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7, // I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple. switch(calc){ case 10: calc = 1; break; //5*2=10 & 1+0 = 1 case 12: calc = 3; break; //6*2=12 & 1+2 = 3 case 14: calc = 5; break; //7*2=14 & 1+4 = 5 case 16: calc = 7; break; //8*2=16 & 1+6 = 7 case 18: calc = 9; break; //9*2=18 & 1+8 = 9 default: calc = calc; //4*2= 8 & 8 = 8 -same for all lower numbers } iCCN = iCCN / 10; // subtracts right most digit from ccNum iTotal += calc; // running total of the card number as we loop } // END OF LOOP if ((iTotal%10)==0){ // check to see if the sum Mod 10 is zero bResult = true; // This IS (or could be) a valid credit card number. } else { bResult = false; // This could NOT be a valid credit card number } } } // change alert to on-page display or other indication as needed. if(bResult) { return true } if(!bResult){ alert("Please enter a valid credit card number."); } return bResult; // Return the results } function formVerify(){ var reqfields=document.form3.req.value.split(",") var x=0 while(x-1){ if(document.form3.cship.value=="" || document.form3.cshipnum.value=="" || document.form3.cshipname.value=="" || document.form3.cshipaddress.value=="" ) {alert('Please enter your shipping account information.');return false}} if($('#needshipping').val()=="1"){ if(document.form3.sadd1.value==""){alert('You must enter a shipping street address.');return false} if(document.form3.scity.value==""){alert('You must enter a shipping City.');return false} if(document.form3.sstate.value=="0"){alert('You must enter a shipping State.');return false} zip=document.form3.szip if ((zip.value==null)||(zip.value=="")){alert("Please Enter your Zipcode"+" "+zip.value);return false} }} var radioObj=document.form3.pmethod for(var i = 0; i < radioObj.length; i++) { if(radioObj[i].checked) { var pmethod= radioObj[i].value; }} if (String(pmethod)=="undefined" && String(document.form3.pmethod.value)!="on" && parseFloat($('#needbilling').val())>0) { alert("Please select a payment method."); return false } if (pmethod=="1" && parseFloat($('#needbilling').val())>0) { if(document.form3.bfirst.value==""){alert('You must enter a billing first name.');return false} if(document.form3.blast.value==""){alert('You must enter a billing last name.'+document.form3.blast.value);return false} if(document.form3.badd1.value==""){alert('You must enter a billing street address.');return false} if(document.form3.bcity.value==""){alert('You must enter a billing City.');return false} if(document.form3.bstate.value=="0"){alert('You must enter a billing State.');return false} zip=document.form3.bzip if ((zip.value==null)||(zip.value=="")){alert("Please Enter your Zipcode");return false} today=new Date() thisyear=today.getYear() thismonth=today.getMonth()+1 sentmonth=document.form3.ccmonth.value sentyear=document.form3.ccyear.value if(sentmonth=="0"){alert("Please Enter your Card's Expiration Date");return false} if(sentyear==""){alert("Please Enter your Card's Expiration Date");return false} if(sentyear= len && !containsElement(filter,keyCode)) { input.value = input.value.slice(0, len); input.form[(getIndex(input)+1) % input.form.length].focus(); } function containsElement(arr, ele) { found = false, index = 0; while(!found && index < arr.length) if(arr[index] == ele) found = true; else index++; return found; } function getIndex(input) { index = -1, i = 0, found = false; while (i < input.form.length && index == -1) if (input.form[i] == input)index = i; else i++; return index; } return true; } function copybill(){ if(document.form3.billsame.value=="Yes"){ billstates(document.form3.scountry.value) document.form3.bfirst.value=document.form3.sfirst.value document.form3.blast.value=document.form3.slast.value document.form3.badd1.value=document.form3.sadd1.value document.form3.badd2.value=document.form3.sadd2.value document.form3.bcity.value=document.form3.scity.value document.form3.bcountry.value=document.form3.scountry.value $("#bcountry").val($("#bcountry").val()) setTimeout('$("#bstate").val($("#sstate").val())' , 1000) document.form3.bzip.value=document.form3.szip.value } } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } function resourcepoptg(id){ document.getElementById("overlaytg").style.display = ""; document.getElementById("dialoguetg").style.display = ""; } function popdowntg(){ document.getElementById("overlaytg").style.display = "none"; document.getElementById("dialoguetg").style.display = "none"; } function resourcepop(id){ document.getElementById("overlay").style.display = ""; document.getElementById("dialogue").style.display = ""; window.scrollTo(0,0); } function resourcepopb(id){ document.getElementById("overlayb").style.display = ""; document.getElementById("dialogueb").style.display = ""; window.scrollTo(0,0); } function popdownb(){ document.getElementById("overlayb").style.display = "none"; document.getElementById("dialogueb").style.display = "none"; } function resourcepopc(){ document.getElementById("overlayc").style.display = ""; document.getElementById("dialoguec").style.display = ""; window.scrollTo(0,0); } function popdownc(){ document.getElementById("overlayc").style.display = "none"; document.getElementById("dialoguec").style.display = "none"; } function resourcepopd(){ document.getElementById("overlayd").style.display = ""; document.getElementById("dialogued").style.display = ""; window.scrollTo(0,0); } function popdownd(){ document.getElementById("overlayd").style.display = "none"; document.getElementById("dialogued").style.display = "none"; } function getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = xScroll; } else { pageWidth = windowWidth; } return [pageWidth,pageHeight]; } function killcart(){ document.getElementById('txtHint').innerHTML="" //document.getElementById('txtHint').innerHTML="





" } function stateChanged() { if (xmlHttp.readyState==4){ $("#txtHint").html(xmlHttp.responseText); }} function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } $(function() { $( ".ddate" ).datepicker(); });