function showcartitems() {
calctotal();
}
function calctotal() {
}
var is_submitted = false;
function validateForm(theform)
{
if(is_submitted) return; //block addition submits until refreshes
var sErrorText = "";
var OptionSelected = false;
if ($('#FirstName').val() == "")
{
sErrorText = sErrorText + "
First Name
";
document.getElementById("highlightname").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlightname1").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlightname").style.backgroundImage='';
document.getElementById("highlightname1").style.backgroundImage='';
}
if ( $("#termsofuse").prop("checked")==false )
{
sErrorText = sErrorText + "You must agree to the terms of use
";
}
if ($('#LastName').val() == "")
{
sErrorText = sErrorText + "Last Name
";
document.getElementById("highlightname2").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlightname3").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlightname2").style.backgroundImage='';
document.getElementById("highlightname3").style.backgroundImage='';
}
if ($('#ADDRESS1').val() == "")
{
sErrorText = sErrorText + "Address
";
document.getElementById("highlight_address1").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_address11").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_address1").style.backgroundImage='';
document.getElementById("highlight_address11").style.backgroundImage='';
}
if ($('#CITY').val() == "")
{
sErrorText = sErrorText + "City
";
document.getElementById("highlight_city").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_city1").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_city").style.backgroundImage='';
document.getElementById("highlight_city1").style.backgroundImage='';
}
if ($('#customerphone').val() == "")
{
sErrorText = sErrorText + "Phone Number
";
//document.getElementById("highlightname").style.backgroundImage='url(picts/filler2.jpg)';
//document.getElementById("highlightname1").style.backgroundImage='url(picts/filler2.jpg)';
} else {
//document.getElementById("highlightname").style.backgroundImage='';
//document.getElementById("highlightname1").style.backgroundImage='';
}
/*if ($('#customerphone').val().length < 10)
{
sErrorText = sErrorText + "Phone Number must be at least 10 digits
";
}
*/
var checkOK = "0123456789-.+";
var checkStr = $('#customerphone').val();
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else
allNum += ch;
}
if (!allValid)
{
sErrorText = sErrorText + "Phone Number must only contain numbers or '- + .' No spaces
";
}
document.getElementById("highlight_province").style.backgroundImage='';
document.getElementById("highlight_province1").style.backgroundImage='';
document.getElementById("highlightstate1").style.backgroundImage='';
document.getElementById("highlightstate2").style.backgroundImage='';
if ($('#STATE').val() == "select")
{ sErrorText = sErrorText + "State
";
document.getElementById("highlightstate1").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlightstate2").style.backgroundImage='url(picts/filler2.jpg)';
}
if ($('#STATE').val() == "")
{
if ($('#PROVINCE').val() == "" )
{
sErrorText = sErrorText + "Province
";
document.getElementById("highlight_province").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_province1").style.backgroundImage='url(picts/filler2.jpg)';
}
}
if ($('#ZIP').val() == "")
{
sErrorText = sErrorText + "Zip
";
document.getElementById("highlight_zip").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_zip1").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_zip").style.backgroundImage='';
document.getElementById("highlight_zip1").style.backgroundImage='';
}
if ($('#EMAIL').val() == "")
{
sErrorText = sErrorText + "Email Address
";
document.getElementById("highlight_email").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_email1").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_email").style.backgroundImage='';
document.getElementById("highlight_email1").style.backgroundImage='';
}
//check if paying by PayPal
if ( $("#pmt5").prop("checked")==false ) {
if ($("#pmt1").prop("checked") == false && $("#pmt2").prop("checked") == false && $("#pmt3").prop("checked") == false && $("#pmt4").prop("checked") == false && $("#pmt5").prop("checked") == false )
{
sErrorText = sErrorText + "Payment Type
";
document.getElementById("highlight_paymenttype").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_paymenttype").style.backgroundImage='';
}
if ($('#card1').val() == "")
{
sErrorText = sErrorText + "Credit Card Number
";
document.getElementById("highlight_card1").style.backgroundImage='url(picts/filler2.jpg)';
document.getElementById("highlight_card11").style.backgroundImage='url(picts/filler2.jpg)';
} else {
document.getElementById("highlight_card1").style.backgroundImage='';
document.getElementById("highlight_card11").style.backgroundImage='';
}
if ($('#CVC').val() == "")
{
sErrorText = sErrorText + "Credit Card Security Code Required
";
}
}
if (sErrorText.length == 0) {
is_submitted=true;
document.getElementById("processing_image").src="/homepageimages/2013/processing.jpg";
$( "#OrderForm" ).submit();
} else {
//move page to top
window.scrollTo(0,0);
//update errtext
document.getElementById("error").innerHTML ="
Oops! The following minor error(s) blocked this transaction from
being processed, which you can easily fix in the field(s) below:
";
alert('Missing information. Please read top of page for instructions.');
return (false);
}
}
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
if(document.layers) //NN4+
{
document.layers[szDivID].visibility = iState ? "show" : "hide";
}
else if(document.getElementById) //gecko(NN6) + IE 5+
{ var obj = document.getElementById(szDivID);
obj.style.display = iState ? "inline" : "none";
}
else if(document.all) // IE 4
{
document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
}
}
function cc(iState)
{
toggleBox('creditcardarea88',iState);
toggleBox('creditcardarea4',iState);
toggleBox('creditcardarea3',iState);
toggleBox('creditcardarea2',iState);
//toggleBox('creditcardarea1',iState);
}
function openWindow(url, name) {
var winloc = url
var w = 600
var h = 400
var winname = name
var winl =(screen.width - w) / 2
var wint =(screen.height - h) / 2
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=0,location=0,toolbar=0,status=0,fullscreen=o,titlebar=0,top=0,left=25'
win = window.open(winloc, winname, winprops)
win.focus();
}
function emailCheck (emailStr) {
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD. 1 means check it, 0 means don't. */
var checkTLD=1;
/* The following is the list of known TLDs that an e-mail address must end with. */
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
/* The following pattern is used to check if the entered e-mail address
fits the user@domain format. It also is used to separate the username
from the domain. */
var emailPat=/^(.+)@(.+)$/;
/* The following string represents the pattern for matching all special
characters. We don't want to allow special characters in the address.
These characters include ( ) < > @ , ; : \ " . [ ] */
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
/* The following string represents the range of characters allowed in a
username or domainname. It really states which chars aren't allowed.*/
var validChars="\[^\\s" + specialChars + "\]";
/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes). E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")";
/* The following pattern applies for domains that are IP addresses,
rather than symbolic names. E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
/* The following string represents an atom (basically a series of non-special characters.) */
var atom=validChars + '+';
/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")";
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
/* Finally, let's start trying to figure out if the supplied address is valid. */
/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
// Start by checking that only basic ASCII characters are in the strings (0-127).
for (i=0; i127) {
alert("Ths username contains invalid characters.");
return false;
}
}
for (i=0; i127) {
alert("Ths domain name contains invalid characters.");
return false;
}
}
// See if "user" is valid
if (user.match(userPat)==null) {
// user is not valid
alert("The username doesn't seem to be valid.");
return false;
}
/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */
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("Destination IP address is invalid!");
return false;
}
}
return true;
}
// Domain is symbolic name. Check if it's valid.
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i