function clearForms() { var type = null; for (var x=0; x 0 && isNaN(textBox.value)) { textBox.value = textBox.value.substring(0, textBox.value.length - 1) } textBox.value = trim(textBox.value); /* if (textBox.value.length == 0) { textBox.value = 0; } else { textBox.value = parseInt(textBox.value); }*/ } /* Check if a form element is empty. If it is display an alert box and focus on the element */ function isEmpty(formElement, message) { formElement.value = trim(formElement.value); _isEmpty = false; if (formElement.value == '') { _isEmpty = true; alert(message); formElement.focus(); } return _isEmpty; } /* Set one value in combo box as the selected value */ function setSelect(listElement, listValue) { for (i=0; i < listElement.options.length; i++) { if (listElement.options[i].value == listValue) { listElement.selectedIndex = i; } } } function setPaymentInfo(isChecked) { with (window.document.frmCheckout) { if (isChecked) { txtPaymentFirstName.value = txtShippingFirstName.value; txtPaymentLastName.value = txtShippingLastName.value; txtPaymentAddress1.value = txtShippingAddress1.value; txtPaymentAddress2.value = txtShippingAddress2.value; txtPaymentPhone.value = txtShippingPhone.value; txtPaymentState.value = txtShippingState.value; txtPaymentCity.value = txtShippingCity.value; txtPaymentPostalCode.value = txtShippingPostalCode.value; txtPaymentCountry.value = txtShippingCountry.value; txtPaymentFirstName.readOnly = true; txtPaymentLastName.readOnly = true; txtPaymentAddress1.readOnly = true; txtPaymentAddress2.readOnly = true; txtPaymentPhone.readOnly = true; txtPaymentState.readOnly = true; txtPaymentCity.readOnly = true; txtPaymentPostalCode.readOnly = true; txtPaymentCountry.readOnly = true; } else { txtPaymentFirstName.readOnly = false; txtPaymentLastName.readOnly = false; txtPaymentAddress1.readOnly = false; txtPaymentAddress2.readOnly = false; txtPaymentPhone.readOnly = false; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; txtPaymentCountry.readOnly = false; } } } function setPaymentInfo1(isChecked) { with (window.document.frmCheckout) { if (isChecked) { txtShippingFirstName.value = txtFirstName.value; txtShippingLastName.value = txtLastName.value; txtShippingAddress1.value = txtAddress1.value; txtShippingAddress2.value = txtAddress2.value; txtShippingPhone.value = txtPhone.value; txtShippingState.value = txtState.value; txtShippingCity.value = txtCity.value; txtShippingPostalCode.value = txtPostalCode.value; txtShippingCountry.value = txtCountry.value; txtShippingFirstName.readOnly = true; txtShippingLastName.readOnly = true; txtShippingAddress1.readOnly = true; txtShippingAddress2.readOnly = true; txtShippingPhone.readOnly = true; txtShippingState.readOnly = true; txtShippingCity.readOnly = true; txtShippingPostalCode.readOnly = true; txtShippingCountry.readOnly = true; } else { txtShippingFirstName.readOnly = false; txtShippingLastName.readOnly = false; txtShippingAddress1.readOnly = false; txtShippingAddress2.readOnly = false; txtShippingPhone.readOnly = false; txtShippingState.readOnly = false; txtShippingCity.readOnly = false; txtShippingPostalCode.readOnly = false; txtShippingCountry.readOnly = false; } } } function unlockPay() { if(window.document.frmCheckout.chkSame) { window.document.frmCheckout.chkSame.checked = false; with (window.document.frmCheckout) { txtPaymentFirstName.readOnly = false; txtPaymentLastName.readOnly = false; txtPaymentAddress1.readOnly = false; txtPaymentAddress2.readOnly = false; txtPaymentPhone.readOnly = false; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; txtPaymentCountry.readOnly = false; }//with }//function }//function function checkShippingAndPaymentInfo() { if(window.document.frmCheckout.txtUsername) { if (isEmpty(window.document.frmCheckout.txtUsername, 'Enter Username')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPasswd) { if (isEmpty(window.document.frmCheckout.txtPasswd, 'Enter Password')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtEmail) { if (isEmpty(window.document.frmCheckout.txtEmail, 'Enter Email')) { unlockPay(); return false; } else { isEmail = email_validate(window.document.frmCheckout.txtEmail.value); if(!isEmail) { alert("Invalid Email-id"); window.document.frmCheckout.txtEmail.focus(); unlockPay(); return false; }//if }//else }//else if(window.document.frmCheckout.txtConfirmEmail) { if (isEmpty(window.document.frmCheckout.txtConfirmEmail, 'Enter Confirm Email')) { unlockPay(); return false; } else { isEmail = email_validate(window.document.frmCheckout.txtConfirmEmail.value); if(!isEmail) { alert("Invalid Email-id"); window.document.frmCheckout.txtConfirmEmail.focus(); unlockPay(); return false; }//if }//else if (window.document.frmCheckout.txtConfirmEmail.value != window.document.frmCheckout.txtEmail.value) { alert("Email and Confirm Email-id should be same"); window.document.frmCheckout.txtEmail.focus(); unlockPay(); return false; }//if }//if if(window.document.frmCheckout.txtShippingFirstName) { if (isEmpty(window.document.frmCheckout.txtShippingFirstName, 'Enter first name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingLastName) { if (isEmpty(window.document.frmCheckout.txtShippingLastName, 'Enter last name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingAddress1) { if (isEmpty(window.document.frmCheckout.txtShippingAddress1, 'Enter shipping address')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingPhone) { if (isEmpty(window.document.frmCheckout.txtShippingPhone, 'Enter phone number')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingState) { if (isEmpty(window.document.frmCheckout.txtShippingState, 'Enter shipping address state')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingCity) { if (isEmpty(window.document.frmCheckout.txtShippingCity, 'Enter shipping address city')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingPostalCode) { if (isEmpty(window.document.frmCheckout.txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentFirstName) { if (isEmpty(window.document.frmCheckout.txtPaymentFirstName, 'Enter first name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentLastName) { if (isEmpty(window.document.frmCheckout.txtPaymentLastName, 'Enter last name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentAddress1) { if (isEmpty(window.document.frmCheckout.txtPaymentAddress1, 'Enter Payment address')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentPhone) { if (isEmpty(window.document.frmCheckout.txtPaymentPhone, 'Enter phone number')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentState) { if (isEmpty(window.document.frmCheckout.txtPaymentState, 'Enter Payment address state')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentCity) { if (isEmpty(window.document.frmCheckout.txtPaymentCity, 'Enter Payment address city')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentPostalCode) { if (isEmpty(window.document.frmCheckout.txtPaymentPostalCode, 'Enter the Payment address postal/zip code')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtTermsAgreed) { if (!window.document.frmCheckout.txtTermsAgreed.checked) { alert("Please Accept Terms & Conditions"); window.document.frmCheckout.txtTermsAgreed.focus(); //unlockPay(); return false; } }//if return true; }//function function isValidCourse(form1) { if(form1.sdate.value == "") { alert("Please specify course start date "); form1.sdate.focus(); return false; }//if if(form1.edate.value == "") { alert("Please specify course finish date "); form1.edate.focus(); return false; }//if return true; }//function function isValidCourseAE(form1) { if(form1.location1.value == "") { alert("Please enter location "); form1.location1.focus(); return false; }//if if(form1.shortname.value == "") { alert("Please enter shortname "); form1.shortname.focus(); return false; }//if if(form1.addr.value == "") { alert("Please enter address "); form1.addr.focus(); return false; }//if if(form1.totalstudents.value == "") { alert("Please enter total students "); form1.totalstudents.focus(); return false; }//if if(form1.loccolorcode.value == "") { alert("Please enter select location color code "); form1.loccolorcode.focus(); return false; }//if return true; }//function function isValidTestimonial(form1) { if(form1.name.value == "") { alert("Please enter Name "); form1.name.focus(); return false; }//if if(form1.course_details.value == "") { alert("Please enter course details "); form1.course_details.focus(); return false; }//if if(form1.testimonials_det.value == "") { alert("Please enter testimonials "); form1.testimonials_det.focus(); return false; }//if return true; }//function /************enroll course***************/ function changeLoc(form1) { form1.cloc[0].selected = true; form1.course_dates_id[0].selected = true; }//location function isValidEnrollCourse(form1) { if(form1.mdlcrsedrp.value == -99) { alert("Please choose course "); form1.mdlcrsedrp.focus(); return false; }//if if(form1.cloc.value == -99) { alert("Please choose location "); form1.cloc.focus(); return false; }//if if(form1.course_dates_id.value == -99) { alert("Please choose schedule "); form1.course_dates_id.focus(); return false; }//if if(form1.saluation.value == "") { alert("Please select saluation "); form1.saluation.focus(); return false; }//if if(form1.name.value == "") { alert("Please enter name "); form1.name.focus(); return false; }//if if(form1.phoneno.value == "") { alert("Please enter phone no "); form1.phoneno.focus(); return false; }//if if(form1.email.value == "") { alert("Please enter email"); form1.email.focus(); return false; }//if if(form1.email.value != "") { isEmail = email_validate(form1.email.value); if(!isEmail) { alert("Invalid Email-id"); form1.email.focus(); return false; }//if }//if if(form1.billname.value == "") { alert("Please enter billing name "); form1.billname.focus(); return false; }//if if(form1.billaddress.value == "") { alert("Please enter billing address "); form1.billaddress.focus(); return false; }//if if(form1.billcity.value == "") { alert("Please enter billing city "); form1.billcity.focus(); return false; }//if if(form1.billstate.value == "") { alert("Please enter billing state "); form1.billstate.focus(); return false; }//if if(form1.billcountry.value == "") { alert("Please enter billing country "); form1.billcountry.focus(); return false; }//if if(form1.billpostalcode.value == "") { alert("Please enter billing postal code "); form1.billpostalcode.focus(); return false; }//if return true; }//function