function load_function(page){ if(page == "order.php"){ if(document.theform != null && document.theform.recipient_name != null){ document.theform.recipient_name.focus(); } } else if(page == "refer.php"){ if(document.theform != null && document.theform.email != null){ document.theform.email.focus(); } } } function nostatus(){ window.status = company_name; return true } document.onmouseover = nostatus document.onmouseout = nostatus document.onmousedown = nostatus function textCounter(area,maxlength){ if(area.value.length >= maxlength){ alert("You've reached the " + maxlength + " character limit."); area.value = area.value.substring(0, maxlength); event.returnValue = false; } } function promptLogin(){ var x = confirm("This is a password protected area.\nWould you like to continue?"); if(x){ document.location.href = "admin/index.php"; } else { return; } } //Order Form function validate_order_form(){ clear_order_form(); var required = ""; if (document.theform.name.value.length == 0) { required += "\n - From Name"; document.theform.name.className='textBoxRequired'; } if (document.theform.phone1.value.length == 0 || document.theform.phone2.value.length == 0 || document.theform.phone3.value.length == 0) { required += "\n - Phone Number"; document.theform.phone1.className='textBoxRequired'; document.theform.phone2.className='textBoxRequired'; document.theform.phone3.className='textBoxRequired'; } if (document.theform.email.value.length == 0) { required += "\n - Email"; document.theform.email.className='textBoxRequired'; } else if (document.theform.email.value.search(/(\w+[\w|\.|-]*\w+)(@\w+[\w|\.|-]*\w+\.\w{2,4})/) == -1) { required += "\n - Please specify a valid email address"; document.theform.email.className='textBoxRequired'; } if (required != "") { alert("Please fill in the required fields:" + required); return false; } } function reset_order_form(){ var x = confirm("Are you sure you want to erase all of your data and start over?"); if(x){ clear_order_form(); document.theform.reset(); document.theform.recipient_name.focus(); } else { return; } } function clear_order_form(){ document.theform.name.className='textBox'; document.theform.email.className='textBox'; document.theform.phone1.className='textBox'; document.theform.phone2.className='textBox'; document.theform.phone3.className='textBox'; } function updateTotals(num){ //Calculate Line Total var amount = parseFloat(document.getElementById("item_"+num).options[document.getElementById("item_"+num).selectedIndex].id); var quantity = parseFloat(document.getElementById("quantity_"+num).options[document.getElementById("quantity_"+num).selectedIndex].value); var total = amount * quantity; if(total != 0 && total != "" && !isNaN(total)){ document.getElementById("total_"+num).value = total.toFixed(2); } else { document.getElementById("total_"+num).value = ""; } //Calculate Grand Total var grand_total = 0; for(var i=1; i<=3; i++){ var temp_total = parseFloat(document.getElementById("total_"+i).value); if(temp_total != 0 && temp_total != "" && !isNaN(temp_total)){ grand_total += temp_total; } } if(grand_total > 0){ document.theform.grand_total.value = grand_total.toFixed(2); } else { document.theform.grand_total.value = ""; } } //Testimonials Page function validate_testimonials_form(){ clear_testimonials_form(); var required = ""; if (document.theform.name.value.length == 0) { required += "\n - Name"; document.theform.name.className='textBoxRequired'; } if (document.theform.comment.value.length == 0) { required += "\n - Comment"; document.theform.comment.className='textBoxRequired'; } if (document.theform.email.value.length == 0) { required += "\n - Email"; document.theform.email.className='textBoxRequired'; } else if (document.theform.email.value.search(/(\w+[\w|\.|-]*\w+)(@\w+[\w|\.|-]*\w+\.\w{2,4})/) == -1) { required += "\n - Please specify a valid email address"; document.theform.email.className='textBoxRequired'; } if (document.theform.confirm1.value != document.theform.confirm2.value) { required += "\n - Re-type Word"; document.theform.confirm2.className='textBoxRequired'; } if (required != "") { alert("Please fill in the required fields:" + required); return false; } } function reset_testimonials_form(){ var x = confirm("Are you sure you want to erase all of your data?"); if(x){ clear_testimonials_form(); document.theform.reset(); document.theform.name.focus(); } } function clear_testimonials_form(){ document.theform.name.className='textBox'; document.theform.email.className='textBox'; document.theform.comment.className='textBox'; document.theform.confirm2.className='textBox'; } function show_form(){ document.getElementById("comment_output").style.height = "132px"; document.getElementById("comment_output").style.width = "475px"; document.getElementById("comment_form").style.display = ""; document.getElementById("comment_header").style.display = "none"; document.theform.name.focus(); } //Refer A Friend Page function validate_refer_form(){ clear_refer_form(); var required = ""; if (document.theform.email.value.length == 0) { required += "\n - Email"; document.theform.email.className='textBoxRequired'; } else if (document.theform.email.value.search(/(\w+[\w|\.|-]*\w+)(@\w+[\w|\.|-]*\w+\.\w{2,4})/) == -1) { required += "\n - Please specify a valid email address"; document.theform.email.className='textBoxRequired'; } if (document.theform.confirm1.value != document.theform.confirm2.value) { required += "\n - Re-type Word"; document.theform.confirm2.className='textBoxRequired'; } if (required != "") { alert("Please fill in the required fields:" + required); return false; } } function reset_refer_form(){ var x = confirm("Are you sure you want to erase all of your data?"); if(x){ clear_refer_form(); document.theform.reset(); document.theform.email.focus(); } } function clear_refer_form(){ document.theform.email.className='textBox'; document.theform.comment.className='textBox'; document.theform.confirm2.className='textBox'; }