var sent=0;
var currentForm;
var req;
function CopyValues() {
	if (document.getElementById("billingTable").style.display == "block") {
			document.getElementById("billingTable").style.display = "none";
		}
		else {
			document.getElementById("billingTable").style.display = "block";
	}
	
	

}

function CopyValues_landing2b() {
	if (document.getElementById("billingTable").style.display == "block") {
		document.getElementById("billingTable").style.display = "none";
	}
	else {
		document.getElementById("billingTable").style.display = "block";
	}
	
	
	//added to recalc shipping
	

}

function CopyValues_landing3b() {
	if (document.getElementById("billingTable").style.display == "block") {
		document.getElementById("billingTable").style.display = "none";
	}
	else {
		//set all the fields 2 blank
		document.form2.billphonearea.value="";
document.form2.billphoneprefix.value="";
document.form2.billphonepostfix.value="";
document.form2.billadd1.value="";
document.form2.billcity.value="";
document.form2.billstate.value="";
document.form2.billadd2.value="";
document.form2.billzip1.value="";
document.form2.lname.value="";
document.form2.fname.value="";
		document.getElementById("billingTable").style.display = "block";
	}
	
	
	//added to recalc shipping
	

}

function alertWin(x, err) 
{
    var lsError = "<font color=red size=2><b>Errors (The following fields are required):</b></font><hr><font size=2>";
    for (i = 0; i < x; i++){
        lsError += ((i+1) + ". " + err[i] + "<br>");
    }
    document.getElementById("errs").innerHTML = lsError + "</font>";
    document.getElementById("LandingPagePopupBox").style.display = "block";
    
    
}

function closeWin(x, err) 
{
    document.getElementById("LandingPagePopupBox").style.display = "none";
    
    
}

function resetTextboxes(theForm) {
	theForm.checkbox3.style.backgroundColor = "#FFFFFF";
	theForm.checkbox3.style.borderColor = "#000000";
        theForm.fname.style.backgroundColor = "#FFFFFF";
        theForm.fname.style.borderColor = "#000000";
        theForm.lname.style.backgroundColor = "#FFFFFF";
        theForm.lname.style.borderColor = "#000000";
        theForm.shipFirst.style.backgroundColor = "#FFFFFF";
        theForm.shipFirst.style.borderColor = "#000000";
        theForm.shipLast.style.backgroundColor = "#FFFFFF";
        theForm.shipLast.style.borderColor = "#000000";
        theForm.shipadd1.style.backgroundColor = "#FFFFFF";
        theForm.shipadd1.style.borderColor = "#000000";
	theForm.shipzip1.style.backgroundColor = "#FFFFFF";
	theForm.shipzip1.style.borderColor = "#000000";
	theForm.shipcity.style.backgroundColor = "#FFFFFF";
	theForm.shipcity.style.borderColor = "#000000";
	theForm.shipstate.style.backgroundColor = "#FFFFFF";
	theForm.shipstate.style.borderColor = "#000000";
	theForm.shipphonearea.style.borderColor = "#000000";
	theForm.shipphonearea.style.backgroundColor = "#FFFFFF";
	theForm.shipphoneprefix.style.borderColor = "#000000";
	theForm.shipphoneprefix.style.backgroundColor = "#FFFFFF";
	theForm.shipphonepostfix.style.borderColor = "#000000";
	theForm.shipphonepostfix.style.backgroundColor = "#FFFFFF";
	theForm.email.style.backgroundColor = "#FFFFFF";
        theForm.email.style.borderColor = "#000000";
        //theForm.productID.style.backgroundColor = "#FFFFFF";
        //theForm.productID.style.borderColor = "#000000";
        
        
        if (theForm.shipinfo.checked) {
		theForm.billphonearea.style.backgroundColor = "#FFFFFF";
		theForm.billphonearea.style.borderColor = "#000000";
		theForm.shipphoneprefix.style.borderColor = "#000000";
		theForm.billphoneprefix.style.backgroundColor = "#FFFFFF";
		theForm.billphonepostfix.style.borderColor = "#000000";
		theForm.billphonepostfix.style.backgroundColor = "#FFFFFF";
		theForm.billadd1.style.backgroundColor = "#FFFFFF";
		theForm.billadd2.style.backgroundColor = "#FFFFFF";
		theForm.billzip1.style.backgroundColor = "#FFFFFF";
		theForm.billcity.style.backgroundColor = "#FFFFFF";
		theForm.billstate.style.backgroundColor = "#FFFFFF";
		theForm.billadd1.style.borderColor = "#000000";

		theForm.billadd2.style.borderColor = "#000000";
		theForm.billzip1.style.borderColor = "#000000";
		theForm.billcity.style.borderColor = "#000000";
		theForm.billstate.style.borderColor = "#000000";
		theForm.shippingType.style.backgroundColor = "#FFFFFF";
		theForm.shippingType.style.borderColor = "#000000";
        }
        
        //payment fields
        
	    theForm.ccnumber.style.backgroundColor = "#FFFFFF";
	    theForm.ccnumber.style.borderColor = "#000000";   
	    theForm.cctype.style.backgroundColor = "#FFFFFF";
	    theForm.cctype.style.borderColor = "#000000";   
	    theForm.cccode.style.backgroundColor = "#FFFFFF";
	    theForm.cccode.style.borderColor = "#000000";   
	    theForm.ccname.style.backgroundColor = "#FFFFFF";
	    theForm.ccname.style.borderColor = "#000000"; 
        
        //new fields
        try {
		theForm.productStrength.style.backgroundColor = "#FFFFFF";
		theForm.productStrength.style.borderColor = "#000000";
        	theForm.typeselected[0].style.backgroundColor = "#FFFFFF";
        }
        catch (E) {
        	//ignore the fields not existing.
        }
}

function isValidForm2(theForm) 
{
    document.getElementById("errs").innerHTML = "";
    var err = new Array();
    var x=0;
	var selValue=0;
    
    resetTextboxes(theForm);
    
    if (theForm.checkbox3.checked == false) {
    	err[x] = 'Please check the box that you agree to the terms & conditions..';
	        theForm.checkbox3.style.backgroundColor = "#FCB1B1";
	        theForm.checkbox3.style.borderColor = "#7D1111";
	        theForm.checkbox3.focus();
        x=x+1;
    }
    
    if (theForm.email.value == "" || theForm.email.value.indexOf('@', 0) == -1 || theForm.email.value.indexOf('.', 0) == -1)
        {
            err[x] = 'Valid email address.';
            theForm.email.style.backgroundColor = "#FCB1B1";
            theForm.email.style.borderColor = "#7D1111";
            x=x+1;
    	}
    
	//new for order-more.asp  AJC 06/02/08
	//loop through rbs for document.form2.typeselected.value
	if(typeof(document.form2.typeselected)!='undefined') {
		var rdoVal = getMonthlySupply();
		if(rdoVal == ""){
			err[x] = 'Please select your monthly supply.';
			theForm.typeselected[0].style.backgroundColor = "#FCB1B1";
			x=x+1;
		}
	}
	
	if(typeof(document.form2.typeselected)!='undefined') {
	if (theForm.productStrength.selectedIndex == "0")
	{
	    err[x] = 'Please select the Strength of Dormanex SR.';
	    theForm.productStrength.style.backgroundColor = "#FCB1B1";
	    theForm.productStrength.style.borderColor = "#7D1111";
	    theForm.productStrength.focus();
	    x=x+1;
	}
	}
	else {
        if (theForm.productID.value == "") {
	    err[x] = 'Please select a valid product.';
	    theForm.productID.style.backgroundColor = "#FCB1B1";
	    theForm.productID.style.borderColor = "#7D1111";
            x=x+1;
        }
	}
	
    if (theForm.shipinfo.checked) {
	    if (theForm.fname.value == "")
	    {
		err[x] = 'Please enter a value for the \"first name\" field.';
		theForm.fname.style.backgroundColor = "#FCB1B1";
		theForm.fname.style.borderColor = "#7D1111";
		theForm.fname.focus();
		x=x+1;
	    }
	    if (theForm.fname.value.length < 2)
	    {
		err[x] = 'Please enter at least 2 characters in the \"first name\" field.';
		theForm.fname.style.backgroundColor = "#FCB1B1";
		theForm.fname.style.borderColor = "#7D1111";
		theForm.fname.focus();
		x=x+1;
	    }
	    if (theForm.fname.value.length > 25)
	    {
		err[x] = 'Please enter at most 25 characters in the \"first name\" field.';
		theForm.fname.style.backgroundColor = "#FCB1B1";
		theForm.fname.style.borderColor = "#7D1111";
		theForm.fname.focus();
		x=x+1;
	    }
	    if (theForm.lname.value == "")
	    {
		err[x] = 'Please enter a value for the \"last name\" field.';
		theForm.lname.style.backgroundColor = "#FCB1B1";
		theForm.lname.style.borderColor = "#7D1111";
		theForm.lname.focus();
		x=x+1;
	    }
	    if (theForm.lname.value.length < 2)
	    {
		err[x] = 'Please enter at least 2 characters in the \"last name\" field.';
		theForm.lname.style.backgroundColor = "#FCB1B1";
		theForm.lname.style.borderColor = "#7D1111";
		theForm.lname.focus();
		x=x+1;
	    }
	    if (theForm.lname.value.length > 50)
	    {
		err[x] = 'Please enter at most 50 characters in the \"last name\" field.';
		theForm.lname.style.backgroundColor = "#FCB1B1";
		theForm.lname.style.borderColor = "#7D1111";
		theForm.lname.focus();
		x=x+1;
	    }

	    if (theForm.billadd1.value == "")
	    {
		err[x] = 'Please enter a value for the \"Bill Address\" field.';
		theForm.billadd1.style.backgroundColor = "#FCB1B1";
		theForm.billadd1.style.borderColor = "#7D1111";
		theForm.billadd1.focus();
		x=x+1;
	    }
	    if (theForm.billadd1.value.length < 5)
	    {
		err[x] = 'Please enter at least 5 characters in the \"Bill Address\" field.';
		theForm.billadd1.style.backgroundColor = "#FCB1B1";
		theForm.billadd1.style.borderColor = "#7D1111";
		theForm.billadd1.focus();
		x=x+1;
	    }
	    if (theForm.billadd1.value.length > 50)
	    {
		err[x] = 'Please enter at most 50 characters in the \"Bill Address\" field.';
		theForm.billadd1.style.backgroundColor = "#FCB1B1";
		theForm.billadd1.style.borderColor = "#7D1111";
		theForm.billadd1.focus();
		x=x+1;
	    }
	    if (theForm.billcity.value == "")
	    {
		err[x] = 'Please enter a value for the \"bill city\" field.';
		theForm.billcity.style.backgroundColor = "#FCB1B1";
		theForm.billcity.style.borderColor = "#7D1111";
		theForm.billcity.focus();
		x=x+1;
	    }
	    if (theForm.billcity.value.length <= 1)
	    {
		err[x] = 'Please enter at least 2 characters in the \"bill city\" field.';
		theForm.billcity.style.backgroundColor = "#FCB1B1";
		theForm.billcity.style.borderColor = "#7D1111";
		theForm.billcity.focus();
		x=x+1;
	    }
	    if (theForm.billcity.value.length >= 51)
	    {
		err[x] = 'Please enter at most 50 characters in the \"bill city\" field.';
		theForm.billcity.style.backgroundColor = "#FCB1B1";
		theForm.billcity.style.borderColor = "#7D1111";
		theForm.billcity.focus();
		x=x+1;
	    }
	    if (theForm.billstate.selectedIndex == "0")
	    {
		err[x] = 'Please enter a valid state or province field.';
		    theForm.billstate.style.backgroundColor = "#FCB1B1";
		    theForm.billstate.style.borderColor = "#7D1111";
		    theForm.billstate.focus();
		    x=x+1;

	    }


	    if (theForm.billzip1.value == "")
	    {
		err[x] = 'Please enter a value for the \"Billing Postal Code\" field.';
		theForm.billzip1.style.backgroundColor = "#FCB1B1";
		theForm.billzip1.style.borderColor = "#7D1111";
		theForm.billzip1.focus();
		x=x+1;
	    }
	    if (theForm.billzip1.value.length < 4)
	    {
		err[x] = 'Please enter at least 4 characters in the \"Billing Postal Code\" field.';
		theForm.billzip1.style.backgroundColor = "#FCB1B1";
		theForm.billzip1.style.borderColor = "#7D1111";
		theForm.billzip1.focus();
		x=x+1;
	    }
	    if (theForm.billzip1.value.length > 10)
	    {
		err[x] = 'Please enter at most 10 characters in the \"bill zip\" field.';
		theForm.billzip1.style.backgroundColor = "#FCB1B1";
		theForm.billzip1.style.borderColor = "#7D1111";
		theForm.billzip1.focus();
		x=x+1;
	    }
	    
	    if (!numericOnly(theForm.billzip1.value))
	                {
	                    err[x] = 'Please enter a valid value in the \"Billing Zip Code\" field.';
	                    theForm.billzip1.style.backgroundColor = "#FCB1B1";
	                    theForm.billzip1.style.borderColor = "#7D1111";
	                    theForm.billzip1.focus();
	                    x=x+1;
    	    }
    
	    if (theForm.billphonearea.value == "")
	    {
		err[x] = 'Please enter a value for the \"bill phone area code\" field.';
		theForm.billphonearea.style.backgroundColor = "#FCB1B1";
		theForm.billphonearea.style.borderColor = "#7D1111";
		theForm.billphonearea.focus();
		x=x+1;
	    }
	    if (theForm.billphonearea.value.length < 3)
	    {
		err[x] = 'Please enter at least 3 characters in the \"bill phone area \" field.';
		theForm.billphonearea.style.backgroundColor = "#FCB1B1";
		theForm.billphonearea.style.borderColor = "#7D1111";
		theForm.billphonearea.focus();
		x=x+1;
	    }

        if (!numericOnly(theForm.billphonearea.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Area Code\" field.';
		theForm.billphonearea.style.backgroundColor = "#FCB1B1";
		theForm.billphonearea.style.borderColor = "#7D1111";
		theForm.billphonearea.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.billphoneprefix.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Prefix\" field.';
		theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
		theForm.billphoneprefix.style.borderColor = "#7D1111";
		theForm.billphoneprefix.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.billphonepostfix.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Postfix\" field.';
		theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
		theForm.billphonepostfix.style.borderColor = "#7D1111";
		theForm.billphonepostfix.focus();
		x=x+1;
	}
	
	    if (theForm.billphoneprefix.value == "")
		{
		    err[x] = 'Please enter a value for the \"bill phone prefix\" field.';
		    theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
		    theForm.billphoneprefix.style.borderColor = "#7D1111";
		    theForm.billphoneprefix.focus();
		    x=x+1;
		}
		if (theForm.billphoneprefix.value.length < 3)
		{
		    err[x] = 'Please enter at least 3 characters in the \"bill phone prefix \" field.';
		    theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
		    theForm.billphoneprefix.style.borderColor = "#7D1111";
		    theForm.billphoneprefix.focus();
		    x=x+1;
	    }

	    if (theForm.billphonepostfix.value == "")
		{
		    err[x] = 'Please enter a value for the \"bill phone s\" field.';
		    theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
		    theForm.billphonepostfix.style.borderColor = "#7D1111";
		    theForm.billphonepostfix.focus();
		    x=x+1;
		}
		if (theForm.billphonepostfix.value.length < 4)
		{
		    err[x] = 'Please enter at least 3 characters in the \"bill phone suffix \" field.';
		    theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
		    theForm.billphonepostfix.style.borderColor = "#7D1111";
		    theForm.billphonepostfix.focus();
		    x=x+1;
	    }

	    theForm.billphone.value = theForm.billphonearea.value + theForm.billphoneprefix.value + theForm.billphonepostfix.value
    }
    //shipping
    theForm.shipattn.value = theForm.shipFirst.value + " " + theForm.shipLast.value;
    if (theForm.shipattn.value == "")
    {
        err[x] = 'Please enter a value for the \"ship first and last name\" fields.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipattn.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"ship first and last name\" field.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipattn.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"ship first and last name\" field.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipadd1.value == "")
    {
        err[x] = 'Please enter a value for the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipadd1.value.length < 5)
    {
        err[x] = 'Please enter at least 5 characters in the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipadd1.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipcity.value == "")
    {
        err[x] = 'Please enter a value for the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipcity.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipcity.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipstate.selectedIndex == "0")
    {
            err[x] = 'Please enter a state or province field.';
            theForm.shipstate.style.backgroundColor = "#FCB1B1";
            theForm.shipstate.style.borderColor = "#7D1111";
            theForm.shipstate.focus();
            x=x+1;
    
    }
    
    if (theForm.shipzip1.value == "")
    {
        err[x] = 'Please enter a value for the \"shipping Zip code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    if (theForm.shipzip1.value.length < 4)
    {
        err[x] = 'Please enter at least 4 characters in the \"Shipping Zip Code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    if (theForm.shipzip1.value.length > 10)
    {
        err[x] = 'Please enter at most 10 characters in the \"Shipping Zip Code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    
    if (!numericOnly(theForm.shipzip1.value))
            {
                err[x] = 'Please enter a valid value in the \"Shipping Zip Code\" field.';
                theForm.shipzip1.style.backgroundColor = "#FCB1B1";
                theForm.shipzip1.style.borderColor = "#7D1111";
                theForm.shipzip1.focus();
                x=x+1;
    }
    
    
    
    
    if (theForm.shipphonearea.value == "")
        {
            err[x] = 'Please enter a value for the \"ship phone area code\" field.';
            theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
            theForm.shipphonearea.style.borderColor = "#7D1111";
            theForm.shipphonearea.focus();
            x=x+1;
        }
        if (theForm.shipphonearea.value.length < 3)
        {
            err[x] = 'Please enter at least 3 characters in the \"ship phone area \" field.';
            theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
            theForm.shipphonearea.style.borderColor = "#7D1111";
            theForm.shipphonearea.focus();
            x=x+1;
        }
        
        if (!numericOnly(theForm.shipphonearea.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Area Code\" field.';
		theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
		theForm.shipphonearea.style.borderColor = "#7D1111";
		theForm.shipphonearea.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.shipphoneprefix.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Prefix\" field.';
		theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
		theForm.shipphoneprefix.style.borderColor = "#7D1111";
		theForm.shipphoneprefix.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.shipphonepostfix.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Postfix\" field.';
		theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
		theForm.shipphonepostfix.style.borderColor = "#7D1111";
		theForm.shipphonepostfix.focus();
		x=x+1;
	}

        
        if (theForm.shipphoneprefix.value == "")
            {
                err[x] = 'Please enter a value for the \"ship phone prefix\" field.';
                theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
                theForm.shipphoneprefix.style.borderColor = "#7D1111";
                theForm.shipphoneprefix.focus();
                x=x+1;
            }
            if (theForm.shipphoneprefix.value.length < 3)
            {
                err[x] = 'Please enter at least 3 characters in the \"ship phone prefix \" field.';
                theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
                theForm.shipphoneprefix.style.borderColor = "#7D1111";
                theForm.shipphoneprefix.focus();
                x=x+1;
        }
        
        if (theForm.shipphonepostfix.value == "")
            {
                err[x] = 'Please enter a value for the \"ship phone s\" field.';
                theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
                theForm.shipphonepostfix.style.borderColor = "#7D1111";
                theForm.shipphonepostfix.focus();
                x=x+1;
            }
            if (theForm.shipphonepostfix.value.length < 4)
            {
                err[x] = 'Please enter at least 3 characters in the \"ship phone suffix \" field.';
                theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
                theForm.shipphonepostfix.style.borderColor = "#7D1111";
                theForm.shipphonepostfix.focus();
                x=x+1;
    }
    
    theForm.shipphone.value = theForm.shipphonearea.value + theForm.shipphoneprefix.value + theForm.shipphonepostfix.value
    
    if (theForm.shippingType.selectedIndex < 1) {
    	err[x] = 'Please select a valid shipping type.';
		    theForm.shippingType.style.backgroundColor = "#FCB1B1";
		    theForm.shippingType.style.borderColor = "#7D1111";
		    theForm.shippingType.focus();
	    x=x+1;
    }    
    
    if (theForm.cctype.value == "")
	{
	    err[x] = 'Please select the credit card type from the menu.';
	    theForm.cctype.style.backgroundColor = "#FCB1B1";
	    theForm.cctype.style.borderColor = "#7D1111";
	    theForm.cctype.focus();
	    x=x+1;
	}
	if (theForm.ccnumber.value == "")
	{
	    err[x] = 'Please enter a valid credit card number.';
	    theForm.ccnumber.style.backgroundColor = "#FCB1B1";
	    theForm.ccnumber.style.borderColor = "#7D1111";
	    theForm.ccnumber.focus();
	    x=x+1;
	}
	if (theForm.cctype.value == "AmericanExpress")
	{
	    if (theForm.ccnumber.value.length < 15)
	    {
		err[x] = 'American Express cards have 15 digits.  Please enter only 15 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	    if (theForm.ccnumber.value.length > 17)
	    {
		err[x] = 'American Express cards have 15 digits.  Please enter only 15 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	}
	if (theForm.cctype.selectedIndex > 1)
	{
	    if (theForm.ccnumber.value.length < 16)
	    {
		err[x] = 'Visa, Mastercard and Discover cards have 16 digits.  Please enter only 16 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	    if (theForm.ccnumber.value.length > 19)
	    {
		err[x] = 'Visa, Mastercard and Discover cards have 16 digits.  Please enter only 16 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	}
	if (theForm.cccode.value == "")
	{
	    err[x] = 'Please enter your credit card security code. This helps to prevent fraud.';
	    theForm.cccode.style.backgroundColor = "#FCB1B1";
	    theForm.cccode.style.borderColor = "#7D1111";
	    theForm.cccode.focus();
	    x=x+1;
	}
	if (theForm.ccname.value == "")
	{
	    err[x] = 'Please enter card holders full name.';
	    theForm.ccname.style.backgroundColor = "#FCB1B1";
	    theForm.ccname.style.borderColor = "#7D1111";
	    theForm.ccname.focus();
	    x=x+1;
	}
            
    if (x > 0)
    {
        alertWin(x, err);
    }
    else
    {
        if (sent==0)
        { 
            if (!theForm.shipinfo.checked) {
            	document.form2.billadd1.value=document.form2.shipadd1.value;
				document.form2.billadd2.value=document.form2.shipadd2.value;
				document.form2.billzip1.value=document.form2.shipzip1.value;
				document.form2.billcity.value=document.form2.shipcity.value;
				document.form2.billstate.value=document.form2.shipstate.value;
		
				document.form2.billphonearea.value=document.form2.shipphonearea.value;
				document.form2.billphoneprefix.value=document.form2.shipphoneprefix.value;
				document.form2.billphonepostfix.value=document.form2.shipphonepostfix.value;
				document.form2.fname.value = document.form2.shipFirst.value;
				document.form2.lname.value = document.form2.shipLast.value;
				theForm.billphone.value = theForm.shipphone.value;
            }
            document.getElementById("results").innerHTML = "<BR><B><I>Processing Order, Please Be Patient...</I></B><BR>";
			//this.options[this.selectedIndex].value
	    if(typeof(document.form2.typeselected)!='undefined') {	    					
            	document.form2.productID.value = eval("document.form2." + document.form2.productStrength.value + rdoVal + ".value");
            }

			theForm.submit();
            sent=1;
        }
    }
}

function getMonthlySupply() {
	var selValue="";
	for (var i=0; i < document.form2.typeselected.length; i++) {
	   if (document.form2.typeselected[i].checked) {
		  selValue = document.form2.typeselected[i].value;
	   }
	}
	
	return(selValue);
	
}

//this is for landing3 page.
function resetTextboxes_landing3(theForm) {
	theForm.shipFirst.style.backgroundColor = "#FFFFFF";
	theForm.shipFirst.style.borderColor = "#000000";
	theForm.shipLast.style.backgroundColor = "#FFFFFF";
	theForm.shipLast.style.borderColor = "#000000";
	
	theForm.shipadd1.style.backgroundColor = "#FFFFFF";
	theForm.shipadd1.style.borderColor = "#000000";
	theForm.shipzip1.style.backgroundColor = "#FFFFFF";
	theForm.shipzip1.style.borderColor = "#000000";
	theForm.shipcity.style.backgroundColor = "#FFFFFF";
	theForm.shipcity.style.borderColor = "#000000";
	theForm.shipstate.style.backgroundColor = "#FFFFFF";
	theForm.shipstate.style.borderColor = "#000000";
	theForm.shipphonearea.style.borderColor = "#000000";
	theForm.shipphonearea.style.backgroundColor = "#FFFFFF";
	theForm.shipphoneprefix.style.borderColor = "#000000";
	theForm.shipphoneprefix.style.backgroundColor = "#FFFFFF";
	theForm.shipphonepostfix.style.borderColor = "#000000";
	theForm.shipphonepostfix.style.backgroundColor = "#FFFFFF";
	theForm.email.style.backgroundColor = "#FFFFFF";
	theForm.email.style.borderColor = "#000000"; 
}


function isValidForm3_landing3(theForm) 
{
	currentForm = theForm;
    //check zip and phone 1st.  If they pass, then call web service
    //if web service passes, then move on to the zip code and area code checker.
    resetTextboxes_landing3(theForm);
    
    //call service...
    validateZipAreaCode(theForm.shipzip1.value,theForm.shipphonearea.value);
    return(false);
}

function finalizeValidation() {
	document.getElementById("errs").innerHTML = "";
	        var err = new Array();
	    var x=0;
	    
	    if (currentForm.shipFirst.value == "")
	    {
	        err[x] = 'Please enter a value for the \"first name\" field.';
	        currentForm.shipFirst.style.backgroundColor = "#FCB1B1";
	        currentForm.shipFirst.style.borderColor = "#7D1111";
	        currentForm.shipFirst.focus();
	        x=x+1;
	    }
	    if (currentForm.shipFirst.value.length < 2)
	    {
	        err[x] = 'Please enter at least 2 characters in the \"first name\" field.';
	        currentForm.shipFirst.style.backgroundColor = "#FCB1B1";
	        currentForm.shipFirst.style.borderColor = "#7D1111";
	        currentForm.shipFirst.focus();
	        x=x+1;
	    }
	    if (currentForm.shipFirst.value.length > 25)
	    {
	        err[x] = 'Please enter at most 25 characters in the \"first name\" field.';
	        currentForm.shipFirst.style.backgroundColor = "#FCB1B1";
	        currentForm.shipFirst.style.borderColor = "#7D1111";
	        currentForm.shipFirst.focus();
	        x=x+1;
	    }
	    if (currentForm.shipLast.value == "")
	    {
	        err[x] = 'Please enter a value for the \"last name\" field.';
	        currentForm.shipLast.style.backgroundColor = "#FCB1B1";
	        currentForm.shipLast.style.borderColor = "#7D1111";
	        currentForm.shipLast.focus();
	        x=x+1;
	    }
	    if (currentForm.shipLast.value.length < 2)
	    {
	        err[x] = 'Please enter at least 2 characters in the \"last name\" field.';
	        currentForm.shipLast.style.backgroundColor = "#FCB1B1";
	        currentForm.shipLast.style.borderColor = "#7D1111";
	        currentForm.shipLast.focus();
	        x=x+1;
	    }
	    if (currentForm.shipLast.value.length > 50)
	    {
	        err[x] = 'Please enter at most 50 characters in the \"last name\" field.';
	        currentForm.shipLast.style.backgroundColor = "#FCB1B1";
	        currentForm.shipLast.style.borderColor = "#7D1111";
	        currentForm.shipLast.focus();
	        x=x+1;
	    }
	    if (currentForm.email.value == "" || currentForm.email.value.indexOf('@', 0) == -1 || currentForm.email.value.indexOf('.', 0) == -1)
	    {
	        err[x] = 'Valid email address.';
	        currentForm.email.style.backgroundColor = "#FCB1B1";
	        currentForm.email.style.borderColor = "#7D1111";
	        x=x+1;
	    }
	
	    //shipping
	    //currentForm.shipattn.value = currentForm.shipFirst.value + " " + currentForm.shipLast.value;
	    if (currentForm.shipadd1.value == "")
	    {
	        err[x] = 'Please enter a value for the \"ship address\" field.';
	        currentForm.shipadd1.style.backgroundColor = "#FCB1B1";
	        currentForm.shipadd1.style.borderColor = "#7D1111";
	        currentForm.shipadd1.focus();
	        x=x+1;
	    }
	    if (currentForm.shipadd1.value.length < 5)
	    {
	        err[x] = 'Please enter at least 5 characters in the \"ship address\" field.';
	        currentForm.shipadd1.style.backgroundColor = "#FCB1B1";
	        currentForm.shipadd1.style.borderColor = "#7D1111";
	        currentForm.shipadd1.focus();
	        x=x+1;
	    }
	    if (currentForm.shipadd1.value.length > 50)
	    {
	        err[x] = 'Please enter at most 50 characters in the \"ship address\" field.';
	        currentForm.shipadd1.style.backgroundColor = "#FCB1B1";
	        currentForm.shipadd1.style.borderColor = "#7D1111";
	        currentForm.shipadd1.focus();
	        x=x+1;
	    }
	    if (currentForm.shipcity.value == "")
	    {
	        err[x] = 'Please enter a value for the \"ship city\" field.';
	        currentForm.shipcity.style.backgroundColor = "#FCB1B1";
	        currentForm.shipcity.style.borderColor = "#7D1111";
	        currentForm.shipcity.focus();
	        x=x+1;
	    }
	    if (currentForm.shipcity.value.length < 2)
	    {
	        err[x] = 'Please enter at least 2 characters in the \"ship city\" field.';
	        currentForm.shipcity.style.backgroundColor = "#FCB1B1";
	        currentForm.shipcity.style.borderColor = "#7D1111";
	        currentForm.shipcity.focus();
	        x=x+1;
	    }
	    if (currentForm.shipcity.value.length > 50)
	    {
	        err[x] = 'Please enter at most 50 characters in the \"ship city\" field.';
	        currentForm.shipcity.style.backgroundColor = "#FCB1B1";
	        currentForm.shipcity.style.borderColor = "#7D1111";
	        currentForm.shipcity.focus();
	        x=x+1;
	    }
	    if (currentForm.shipstate.selectedIndex == "0")
	    {
	            err[x] = 'Please enter a state or province field.';
	            currentForm.shipstate.style.backgroundColor = "#FCB1B1";
	            currentForm.shipstate.style.borderColor = "#7D1111";
	            currentForm.shipstate.focus();
	            x=x+1;
	    
	    }
	    
	    
	
		if (!numericOnly(currentForm.shipphoneprefix.value))
		{
			err[x] = 'Please enter a valid value in the \"Ship Phone Prefix\" field.';
			currentForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
			currentForm.shipphoneprefix.style.borderColor = "#7D1111";
			currentForm.shipphoneprefix.focus();
			x=x+1;
		}
	
		if (!numericOnly(currentForm.shipphonepostfix.value))
		{
			err[x] = 'Please enter a valid value in the \"Ship Phone Postfix\" field.';
			currentForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
			currentForm.shipphonepostfix.style.borderColor = "#7D1111";
			currentForm.shipphonepostfix.focus();
			x=x+1;
		}
	        
	        if (currentForm.shipphoneprefix.value == "")
	            {
	                err[x] = 'Please enter a value for the \"ship phone prefix\" field.';
	                currentForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
	                currentForm.shipphoneprefix.style.borderColor = "#7D1111";
	                currentForm.shipphoneprefix.focus();
	                x=x+1;
	            }
	            if (currentForm.shipphoneprefix.value.length < 3)
	            {
	                err[x] = 'Please enter at least 3 characters in the \"ship phone prefix \" field.';
	                currentForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
	                currentForm.shipphoneprefix.style.borderColor = "#7D1111";
	                currentForm.shipphoneprefix.focus();
	                x=x+1;
	        }
	        
	        if (currentForm.shipphonepostfix.value == "")
	            {
	                err[x] = 'Please enter a value for the \"ship phone s\" field.';
	                currentForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
	                currentForm.shipphonepostfix.style.borderColor = "#7D1111";
	                currentForm.shipphonepostfix.focus();
	                x=x+1;
	            }
	            if (currentForm.shipphonepostfix.value.length < 4)
	            {
	                err[x] = 'Please enter at least 3 characters in the \"ship phone suffix \" field.';
	                currentForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
	                currentForm.shipphonepostfix.style.borderColor = "#7D1111";
	                currentForm.shipphonepostfix.focus();
	                x=x+1;
	    }
	    
	    currentForm.shipphone.value = currentForm.shipphonearea.value + currentForm.shipphoneprefix.value + currentForm.shipphonepostfix.value
	    
	    if (x > 0)
	    {
			alertWin(x, err);
			return(false);
	    }
	    else
	    {
	        if (sent==0)
	        {
				currentForm.fname.value = currentForm.shipFirst.value
				currentForm.lname.value = currentForm.shipLast.value
				currentForm.billadd1.value = currentForm.shipadd1.value
				currentForm.billadd2.value = currentForm.shipadd2.value
				currentForm.billcity.value = currentForm.shipcity.value
				currentForm.billstate.value = currentForm.shipstate.value
				currentForm.billzip1.value = currentForm.shipzip1.value
				currentForm.billphonearea.value = currentForm.shipphonearea.value
				currentForm.billphoneprefix.value = currentForm.shipphoneprefix.value
				currentForm.billphonepostfix.value = currentForm.shipphonepostfix.value
		
		    document.getElementById("errs").innerHTML = "<BR><B><I>Processing Order, Please Be Patient...</I></B><BR>";
	            currentForm.submit();
				
				

	            sent=1;
	        }
    }
	
}


function isValidForm2_landing2(theForm) 
{
    document.getElementById("errs").innerHTML = "";
    var err = new Array();
    var x=0;
    
    resetTextboxes_landing2(theForm);
    
   
    if (theForm.shipFirst.value == "")
    {
        err[x] = 'Please enter a value for the \"first name\" field.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipFirst.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"first name\" field.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipFirst.value.length > 25)
    {
        err[x] = 'Please enter at most 25 characters in the \"first name\" field.';
        theForm.shipFirst.style.backgroundColor = "#FCB1B1";
        theForm.shipFirst.style.borderColor = "#7D1111";
        theForm.shipFirst.focus();
        x=x+1;
    }
    if (theForm.shipLast.value == "")
    {
        err[x] = 'Please enter a value for the \"last name\" field.';
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipLast.focus();
        x=x+1;
    }
    if (theForm.shipLast.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"last name\" field.';
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipLast.focus();
        x=x+1;
    }
    if (theForm.shipLast.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"last name\" field.';
        theForm.shipLast.style.backgroundColor = "#FCB1B1";
        theForm.shipLast.style.borderColor = "#7D1111";
        theForm.shipLast.focus();
        x=x+1;
    }
    if (theForm.email.value == "" || theForm.email.value.indexOf('@', 0) == -1 || theForm.email.value.indexOf('.', 0) == -1)
    {
        err[x] = 'Valid email address.';
        theForm.email.style.backgroundColor = "#FCB1B1";
        theForm.email.style.borderColor = "#7D1111";
        x=x+1;
    }

    //shipping
    //theForm.shipattn.value = theForm.shipFirst.value + " " + theForm.shipLast.value;
    if (theForm.shipadd1.value == "")
    {
        err[x] = 'Please enter a value for the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipadd1.value.length < 5)
    {
        err[x] = 'Please enter at least 5 characters in the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipadd1.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"ship address\" field.';
        theForm.shipadd1.style.backgroundColor = "#FCB1B1";
        theForm.shipadd1.style.borderColor = "#7D1111";
        theForm.shipadd1.focus();
        x=x+1;
    }
    if (theForm.shipcity.value == "")
    {
        err[x] = 'Please enter a value for the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipcity.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipcity.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"ship city\" field.';
        theForm.shipcity.style.backgroundColor = "#FCB1B1";
        theForm.shipcity.style.borderColor = "#7D1111";
        theForm.shipcity.focus();
        x=x+1;
    }
    if (theForm.shipstate.selectedIndex == "0")
    {
            err[x] = 'Please enter a state or province field.';
            theForm.shipstate.style.backgroundColor = "#FCB1B1";
            theForm.shipstate.style.borderColor = "#7D1111";
            theForm.shipstate.focus();
            x=x+1;
    
    }
    
    if (theForm.shipzip1.value == "")
    {
        err[x] = 'Please enter a value for the \"shipping postal code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    if (theForm.shipzip1.value.length < 4)
    {
        err[x] = 'Please enter at least 4 characters in the \"Shipping Postal Code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    if (theForm.shipzip1.value.length > 10)
    {
        err[x] = 'Please enter at most 10 characters in the \"Shipping Postal Code\" field.';
        theForm.shipzip1.style.backgroundColor = "#FCB1B1";
        theForm.shipzip1.style.borderColor = "#7D1111";
        theForm.shipzip1.focus();
        x=x+1;
    }
    
    if (!numericOnly(theForm.shipzip1.value))
                {
                    err[x] = 'Please enter a valid value in the \"Shipping Zip Code\" field.';
                    theForm.shipzip1.style.backgroundColor = "#FCB1B1";
                    theForm.shipzip1.style.borderColor = "#7D1111";
                    theForm.shipzip1.focus();
                    x=x+1;
    }
    
    
    if (theForm.shipphonearea.value == "")
        {
            err[x] = 'Please enter a value for the \"ship phone area code\" field.';
            theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
            theForm.shipphonearea.style.borderColor = "#7D1111";
            theForm.shipphonearea.focus();
            x=x+1;
        }
        if (theForm.shipphonearea.value.length < 3)
        {
            err[x] = 'Please enter at least 3 characters in the \"ship phone area \" field.';
            theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
            theForm.shipphonearea.style.borderColor = "#7D1111";
            theForm.shipphonearea.focus();
            x=x+1;
        }

        if (!numericOnly(theForm.shipphonearea.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Area Code\" field.';
		theForm.shipphonearea.style.backgroundColor = "#FCB1B1";
		theForm.shipphonearea.style.borderColor = "#7D1111";
		theForm.shipphonearea.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.shipphoneprefix.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Prefix\" field.';
		theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
		theForm.shipphoneprefix.style.borderColor = "#7D1111";
		theForm.shipphoneprefix.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.shipphonepostfix.value))
	{
		err[x] = 'Please enter a valid value in the \"Ship Phone Postfix\" field.';
		theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
		theForm.shipphonepostfix.style.borderColor = "#7D1111";
		theForm.shipphonepostfix.focus();
		x=x+1;
	}

        if (theForm.shipphoneprefix.value == "")
            {
                err[x] = 'Please enter a value for the \"ship phone prefix\" field.';
                theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
                theForm.shipphoneprefix.style.borderColor = "#7D1111";
                theForm.shipphoneprefix.focus();
                x=x+1;
            }
            if (theForm.shipphoneprefix.value.length < 3)
            {
                err[x] = 'Please enter at least 3 characters in the \"ship phone prefix \" field.';
                theForm.shipphoneprefix.style.backgroundColor = "#FCB1B1";
                theForm.shipphoneprefix.style.borderColor = "#7D1111";
                theForm.shipphoneprefix.focus();
                x=x+1;
        }
        
        if (theForm.shipphonepostfix.value == "")
            {
                err[x] = 'Please enter a value for the \"ship phone s\" field.';
                theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
                theForm.shipphonepostfix.style.borderColor = "#7D1111";
                theForm.shipphonepostfix.focus();
                x=x+1;
            }
            if (theForm.shipphonepostfix.value.length < 4)
            {
                err[x] = 'Please enter at least 3 characters in the \"ship phone suffix \" field.';
                theForm.shipphonepostfix.style.backgroundColor = "#FCB1B1";
                theForm.shipphonepostfix.style.borderColor = "#7D1111";
                theForm.shipphonepostfix.focus();
                x=x+1;
    }
    
    theForm.shipphone.value = theForm.shipphonearea.value + theForm.shipphoneprefix.value + theForm.shipphonepostfix.value
    
    if (x > 0)
    {
		alertWin(x, err);
		return(false);
    }
    else
    {
        if (sent==0)
        {
            theForm.fname.value = theForm.shipFirst.value
		theForm.lname.value = theForm.shipLast.value
		theForm.billadd1.value = theForm.shipadd1.value
		theForm.billadd2.value = theForm.shipadd2.value
		theForm.billcity.value = theForm.shipcity.value
		theForm.billstate.value = theForm.shipstate.value
		theForm.billzip1.value = theForm.shipzip1.value
		theForm.billphonearea.value = theForm.shipphonearea.value
		theForm.billphoneprefix.value = theForm.shipphoneprefix.value
		theForm.billphonepostfix.value = theForm.shipphonepostfix.value
	
	    document.getElementById("results").innerHTML = "<BR><B><I>Processing Order, Please Be Patient...</I></B><BR>";
            theForm.submit();
            sent=1;
        }
    }
}

function resetTextboxes_landing2(theForm) {
	theForm.shipFirst.style.backgroundColor = "#FFFFFF";
	theForm.shipFirst.style.borderColor = "#000000";
	theForm.shipLast.style.backgroundColor = "#FFFFFF";
	theForm.shipLast.style.borderColor = "#000000";
	
	theForm.shipadd1.style.backgroundColor = "#FFFFFF";
	theForm.shipadd1.style.borderColor = "#000000";
	theForm.shipzip1.style.backgroundColor = "#FFFFFF";
	theForm.shipzip1.style.borderColor = "#000000";
	theForm.shipcity.style.backgroundColor = "#FFFFFF";
	theForm.shipcity.style.borderColor = "#000000";
	theForm.shipstate.style.backgroundColor = "#FFFFFF";
	theForm.shipstate.style.borderColor = "#000000";
	theForm.shipphonearea.style.borderColor = "#000000";
	theForm.shipphonearea.style.backgroundColor = "#FFFFFF";
	theForm.shipphoneprefix.style.borderColor = "#000000";
	theForm.shipphoneprefix.style.backgroundColor = "#FFFFFF";
	theForm.shipphonepostfix.style.borderColor = "#000000";
	theForm.shipphonepostfix.style.backgroundColor = "#FFFFFF";
	theForm.email.style.backgroundColor = "#FFFFFF";
	theForm.email.style.borderColor = "#000000"; 
}




//landing2b
function isValidForm2_landing2b(theForm) 
{
    document.getElementById("errs").innerHTML = "";
    var err = new Array();
    var x=0;
    
    resetTextboxes_landing2b(theForm);
    
    if (theForm.checkbox3.checked == false) {
        	err[x] = 'Please check the box that you agree to the terms & conditions..';
    	        theForm.checkbox3.style.backgroundColor = "#FCB1B1";
    	        theForm.checkbox3.style.borderColor = "#7D1111";
    	        theForm.checkbox3.focus();
            x=x+1;
    }
    
    
    
    if (theForm.productID.value == "") {
    
    	    err[x] = 'Please select a valid product.';
    	    theForm.productID.style.backgroundColor = "#FCB1B1";
    	    theForm.productID.style.borderColor = "#7D1111";
                x=x+1;
    }
    
	 if (theForm.fname.value == "")
    {
        err[x] = 'Please enter a value for the \"first name\" field.';
        theForm.fname.style.backgroundColor = "#FCB1B1";
        theForm.fname.style.borderColor = "#7D1111";
        theForm.fname.focus();
        x=x+1;
    }
    if (theForm.fname.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"first name\" field.';
        theForm.fname.style.backgroundColor = "#FCB1B1";
        theForm.fname.style.borderColor = "#7D1111";
        theForm.fname.focus();
        x=x+1;
    }
    if (theForm.fname.value.length > 25)
    {
        err[x] = 'Please enter at most 25 characters in the \"first name\" field.';
        theForm.fname.style.backgroundColor = "#FCB1B1";
        theForm.fname.style.borderColor = "#7D1111";
        theForm.fname.focus();
        x=x+1;
    }
    if (theForm.lname.value == "")
    {
        err[x] = 'Please enter a value for the \"last name\" field.';
        theForm.lname.style.backgroundColor = "#FCB1B1";
        theForm.lname.style.borderColor = "#7D1111";
        theForm.lname.focus();
        x=x+1;
    }
    if (theForm.lname.value.length < 2)
    {
        err[x] = 'Please enter at least 2 characters in the \"last name\" field.';
        theForm.lname.style.backgroundColor = "#FCB1B1";
        theForm.lname.style.borderColor = "#7D1111";
        theForm.lname.focus();
        x=x+1;
    }
    if (theForm.lname.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"last name\" field.';
        theForm.lname.style.backgroundColor = "#FCB1B1";
        theForm.lname.style.borderColor = "#7D1111";
        theForm.lname.focus();
        x=x+1;
    }
	
	if (theForm.billadd1.value == "")
    {
        err[x] = 'Please enter a value for the \"Bill Address\" field.';
        theForm.billadd1.style.backgroundColor = "#FCB1B1";
        theForm.billadd1.style.borderColor = "#7D1111";
        theForm.billadd1.focus();
        x=x+1;
    }
    if (theForm.billadd1.value.length < 5)
    {
        err[x] = 'Please enter at least 5 characters in the \"Bill Address\" field.';
        theForm.billadd1.style.backgroundColor = "#FCB1B1";
        theForm.billadd1.style.borderColor = "#7D1111";
        theForm.billadd1.focus();
        x=x+1;
    }
    if (theForm.billadd1.value.length > 50)
    {
        err[x] = 'Please enter at most 50 characters in the \"Bill Address\" field.';
        theForm.billadd1.style.backgroundColor = "#FCB1B1";
        theForm.billadd1.style.borderColor = "#7D1111";
        theForm.billadd1.focus();
        x=x+1;
    }
    if (theForm.billcity.value == "")
    {
        err[x] = 'Please enter a value for the \"bill city\" field.';
        theForm.billcity.style.backgroundColor = "#FCB1B1";
        theForm.billcity.style.borderColor = "#7D1111";
        theForm.billcity.focus();
        x=x+1;
    }
    if (theForm.billcity.value.length <= 1)
    {
        err[x] = 'Please enter at least 2 characters in the \"bill city\" field.';
        theForm.billcity.style.backgroundColor = "#FCB1B1";
        theForm.billcity.style.borderColor = "#7D1111";
        theForm.billcity.focus();
        x=x+1;
    }
    if (theForm.billcity.value.length >= 51)
    {
        err[x] = 'Please enter at most 50 characters in the \"bill city\" field.';
        theForm.billcity.style.backgroundColor = "#FCB1B1";
        theForm.billcity.style.borderColor = "#7D1111";
        theForm.billcity.focus();
        x=x+1;
    }
    if (theForm.billstate.selectedIndex == "0")
    {
        err[x] = 'Please enter a valid state or province field.';
	    theForm.billstate.style.backgroundColor = "#FCB1B1";
	    theForm.billstate.style.borderColor = "#7D1111";
	    theForm.billstate.focus();
	    x=x+1;
        
    }
    
    
    if (theForm.billzip1.value == "")
    {
        err[x] = 'Please enter a value for the \"Billing Postal Code\" field.';
        theForm.billzip1.style.backgroundColor = "#FCB1B1";
        theForm.billzip1.style.borderColor = "#7D1111";
        theForm.billzip1.focus();
        x=x+1;
    }
    if (theForm.billzip1.value.length < 4)
    {
        err[x] = 'Please enter at least 4 characters in the \"Billing Postal Code\" field.';
        theForm.billzip1.style.backgroundColor = "#FCB1B1";
        theForm.billzip1.style.borderColor = "#7D1111";
        theForm.billzip1.focus();
        x=x+1;
    }
    if (theForm.billzip1.value.length > 10)
    {
        err[x] = 'Please enter at most 10 characters in the \"bill zip\" field.';
        theForm.billzip1.style.backgroundColor = "#FCB1B1";
        theForm.billzip1.style.borderColor = "#7D1111";
        theForm.billzip1.focus();
        x=x+1;
    }
    
    if (!numericOnly(theForm.billzip1.value))
	{
	    err[x] = 'Please enter a valid value in the \"Billing Zip Code\" field.';
	    theForm.billzip1.style.backgroundColor = "#FCB1B1";
	    theForm.billzip1.style.borderColor = "#7D1111";
	    theForm.billzip1.focus();
	    x=x+1;
	}
	
	if (theForm.shippingType.selectedIndex < 1) {
    	err[x] = 'Please select a valid shipping type.';
		    theForm.shippingType.style.backgroundColor = "#FCB1B1";
		    theForm.shippingType.style.borderColor = "#7D1111";
		    theForm.shippingType.focus();
	    x=x+1;
    }  
	
     if (theForm.billphonearea.value == "")
    {
        err[x] = 'Please enter a value for the \"bill phone area code\" field.';
        theForm.billphonearea.style.backgroundColor = "#FCB1B1";
        theForm.billphonearea.style.borderColor = "#7D1111";
        theForm.billphonearea.focus();
        x=x+1;
    }
    if (theForm.billphonearea.value.length < 3)
    {
        err[x] = 'Please enter at least 3 characters in the \"bill phone area \" field.';
        theForm.billphonearea.style.backgroundColor = "#FCB1B1";
        theForm.billphonearea.style.borderColor = "#7D1111";
        theForm.billphonearea.focus();
        x=x+1;
    }
   
        if (!numericOnly(theForm.billphonearea.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Area Code\" field.';
		theForm.billphonearea.style.backgroundColor = "#FCB1B1";
		theForm.billphonearea.style.borderColor = "#7D1111";
		theForm.billphonearea.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.billphoneprefix.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Prefix\" field.';
		theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
		theForm.billphoneprefix.style.borderColor = "#7D1111";
		theForm.billphoneprefix.focus();
		x=x+1;
	}
	
	if (!numericOnly(theForm.billphonepostfix.value))
	{
		err[x] = 'Please enter a valid value in the \"bill Phone Postfix\" field.';
		theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
		theForm.billphonepostfix.style.borderColor = "#7D1111";
		theForm.billphonepostfix.focus();
		x=x+1;
	}
	
    if (theForm.billphoneprefix.value == "")
        {
            err[x] = 'Please enter a value for the \"bill phone prefix\" field.';
            theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
            theForm.billphoneprefix.style.borderColor = "#7D1111";
            theForm.billphoneprefix.focus();
            x=x+1;
        }
        if (theForm.billphoneprefix.value.length < 3)
        {
            err[x] = 'Please enter at least 3 characters in the \"bill phone prefix \" field.';
            theForm.billphoneprefix.style.backgroundColor = "#FCB1B1";
            theForm.billphoneprefix.style.borderColor = "#7D1111";
            theForm.billphoneprefix.focus();
            x=x+1;
    }
    
    if (theForm.billphonepostfix.value == "")
        {
            err[x] = 'Please enter a value for the \"bill phone s\" field.';
            theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
            theForm.billphonepostfix.style.borderColor = "#7D1111";
            theForm.billphonepostfix.focus();
            x=x+1;
        }
        if (theForm.billphonepostfix.value.length < 4)
        {
            err[x] = 'Please enter at least 3 characters in the \"bill phone suffix \" field.';
            theForm.billphonepostfix.style.backgroundColor = "#FCB1B1";
            theForm.billphonepostfix.style.borderColor = "#7D1111";
            theForm.billphonepostfix.focus();
            x=x+1;
    }
    
    theForm.billphone.value = theForm.billphonearea.value + theForm.billphoneprefix.value + theForm.billphonepostfix.value
		
    
    if (theForm.cctype.value == "")
	{
	    err[x] = 'Please select the credit card type from the menu.';
	    theForm.cctype.style.backgroundColor = "#FCB1B1";
	    theForm.cctype.style.borderColor = "#7D1111";
	    theForm.cctype.focus();
	    x=x+1;
	}
	if (theForm.ccnumber.value == "")
	{
	    err[x] = 'Please enter a valid credit card number.';
	    theForm.ccnumber.style.backgroundColor = "#FCB1B1";
	    theForm.ccnumber.style.borderColor = "#7D1111";
	    theForm.ccnumber.focus();
	    x=x+1;
	}
	if (theForm.cctype.value == "AmericanExpress")
	{
	    if (theForm.ccnumber.value.length < 15)
	    {
		err[x] = 'American Express cards have 15 digits.  Please enter only 15 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	    if (theForm.ccnumber.value.length > 17)
	    {
		err[x] = 'American Express cards have 15 digits.  Please enter only 15 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	}
	if (theForm.cctype.selectedIndex > 1)
	{
	    if (theForm.ccnumber.value.length < 16)
	    {
		err[x] = 'Visa, Mastercard and Discover cards have 16 digits.  Please enter only 16 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	    if (theForm.ccnumber.value.length > 19)
	    {
		err[x] = 'Visa, Mastercard and Discover cards have 16 digits.  Please enter only 16 digits with no spaces or dashes.';
		theForm.ccnumber.style.backgroundColor = "#FCB1B1";
		theForm.ccnumber.style.borderColor = "#7D1111";
		theForm.ccnumber.focus();
		x=x+1;
	    }
	}
	if (theForm.cccode.value == "")
	{
	    err[x] = 'Please enter your credit card security code. This helps to prevent fraud.';
	    theForm.cccode.style.backgroundColor = "#FCB1B1";
	    theForm.cccode.style.borderColor = "#7D1111";
	    theForm.cccode.focus();
	    x=x+1;
	}
	if (theForm.ccname.value == "")
	{
	    err[x] = 'Please enter card holders full name.';
	    theForm.ccname.style.backgroundColor = "#FCB1B1";
	    theForm.ccname.style.borderColor = "#7D1111";
	    theForm.ccname.focus();
	    x=x+1;
	}
	
	if (theForm.ccMonth.selectedIndex < 1) {
    	err[x] = 'Please select a valid credit card expiration month.';
		    theForm.ccMonth.style.backgroundColor = "#FCB1B1";
		    theForm.ccMonth.style.borderColor = "#7D1111";
		    theForm.ccMonth.focus();
	    x=x+1;
    }
	
	if (theForm.ccYear.selectedIndex < 1) {
    	err[x] = 'Please select a valid credit card expiration year.';
		    theForm.ccYear.style.backgroundColor = "#FCB1B1";
		    theForm.ccYear.style.borderColor = "#7D1111";
		    theForm.ccYear.focus();
	    x=x+1;
    }
                    
            
   	if (x > 0) {
		alertWin(x, err);
		return(false);
    }
    else
    {
        if (sent==0)
        {
	    sent=1;
	    document.getElementById("results").innerHTML = "<BR><img src=secure/images/indicator.gif>&nbsp;<B><I>Processing Order, Please Be Patient...</I></B><BR>";
		//window.setTimeout(theForm.submit(),1250); 
		theForm.submit();
		
        }
    }
}


function resetTextboxes_landing2b(theForm) {
	//payment fields
	theForm.productID.style.backgroundColor = "#FFFFFF";
	theForm.productID.style.borderColor = "#000000"; 
	theForm.checkbox3.style.backgroundColor = "#FFFFFF";
	theForm.checkbox3.style.borderColor = "#000000"; 
	
	theForm.ccnumber.style.backgroundColor = "#FFFFFF";
	theForm.ccnumber.style.borderColor = "#000000"; 
	theForm.cctype.style.backgroundColor = "#FFFFFF";
	theForm.cctype.style.borderColor = "#000000";   
	theForm.cccode.style.backgroundColor = "#FFFFFF";
	theForm.cccode.style.borderColor = "#000000";   
	theForm.ccname.style.backgroundColor = "#FFFFFF";
	theForm.ccname.style.borderColor = "#000000"; 
	
	theForm.ccMonth.style.backgroundColor = "#FFFFFF";
	theForm.ccMonth.style.borderColor = "#000000";   
	theForm.ccYear.style.backgroundColor = "#FFFFFF";
	theForm.ccYear.style.borderColor = "#000000";   
	
	 theForm.shippingType.style.backgroundColor = "#FFFFFF";
        theForm.shippingType.style.borderColor = "#000000";
	
	theForm.billphonearea.style.backgroundColor = "#FFFFFF";
        theForm.billphonearea.style.borderColor = "#000000";
        theForm.shipphoneprefix.style.borderColor = "#000000";
	theForm.billphoneprefix.style.backgroundColor = "#FFFFFF";
	theForm.billphonepostfix.style.borderColor = "#000000";
	theForm.billphonepostfix.style.backgroundColor = "#FFFFFF";
        theForm.billadd1.style.backgroundColor = "#FFFFFF";
        theForm.billadd2.style.backgroundColor = "#FFFFFF";
        theForm.billzip1.style.backgroundColor = "#FFFFFF";
        theForm.billcity.style.backgroundColor = "#FFFFFF";
        theForm.billstate.style.backgroundColor = "#FFFFFF";
        theForm.billadd1.style.borderColor = "#000000";
        theForm.billadd2.style.borderColor = "#000000";
        theForm.billzip1.style.borderColor = "#000000";
        theForm.billcity.style.borderColor = "#000000";

        theForm.billstate.style.borderColor = "#000000";
		theForm.fname.style.backgroundColor = "#FFFFFF";
        theForm.fname.style.borderColor = "#000000";
        theForm.lname.style.backgroundColor = "#FFFFFF";
        theForm.lname.style.borderColor = "#000000";

}

var phone_field_length=0;
function TabNext(obj,event,len,next_field) {
	if (event == "down") {
		phone_field_length=obj.value.length;
		}
	else if (event == "up") {
		if (obj.value.length != phone_field_length) {
			phone_field_length=obj.value.length;
			if (phone_field_length == len) {
				next_field.focus();
			}
		}
	}
}

function numericOnly(strString) {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
	{
	strChar = strString.charAt(i);
	if (strValidChars.indexOf(strChar) == -1)
	 {
	 blnResult = false;
	 }
	}
	return blnResult;
}


//--------------THIS AREA CONTAINS WEB SERVICE CALLS-----------------------------

function validateZipAreaCode(zipcode,phone) {
      // branch for native XMLHttpRequest object
      finalizeValidation();  
      return;
      //skips the rest for now
      var url = "backadmin/netfunctions.asmx/getCityStateAreaCode?zipCode=" + zipcode + "&phone=" + phone;
      
      if (window.ActiveXObject) {
          isIE = true;
          req = new ActiveXObject("Microsoft.XMLHTTP");
          if (req) {
            req.onreadystatechange = processWSResponse;
	    req.open("GET", url, true);
            req.send();
          }
      }
      
      else if (window.XMLHttpRequest) {
          req = new XMLHttpRequest();
          req.onreadystatechange = processWSResponse;
          req.open("GET", url, true);
          req.send(null);                  
      } 
      
      
  }
  
   //JL AJAX Billing postal lookup
    function processWSResponse() {
    
        if (req.readyState == 4) {
            if (req.status == 200) {
              response  = req.responseXML.documentElement;
              //if the elements exist then populate, otherwise, blank the values out 
              try 
              {
              	  
                  areacode = response.getElementsByTagName('areacode')[0].firstChild.data;
                  state = response.getElementsByTagName('state')[0].firstChild.data;                  
                  
                  
              }
              catch (error) {
                    alert("Either your zip code or your area code are invalid.  Please enter a valid zip code and area code before continuing.");
                    return(false);
              }
              
              finalizeValidation();  
                         
            } 
            else 
            {
                finalizeValidation();
            }
        }
  }
