function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,toolbar=no'
win = window.open(mypage, myname, winprops)
/* if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } */
}

function popup_null() {
}


function do_submit1() {
// Verify that required data exists prior
// to submitting review to server.

var buttonwaspressed = false;

   	// MUST ENTER DATE
	if (theform.currentdate.value.length == 0) {
		alert( "Please enter Date");
		theform.currentdate.focus();
		return;
	}

   	// MUST ENTER ACCOUNT NUMBER
	if (theform.account_no.value.length == 0) {
		alert( "Please enter Account Number");
		theform.account_no.focus();
		return;
	}

   	// MUST ENTER ACCOUNT NAME
	if (theform.account_name.value.length == 0) {
		alert( "Please enter Account Name");
		theform.account_name.focus();
		return;
	}

   	// MUST ENTER YOUR NAME
	if (theform.your_name.value.length == 0) {
		alert( "Please enter Your Name");
		theform.your_name.focus();
		return;
	}

   	// MUST ENTER YOUR E-MAIL
	if (theform.your_email.value.length == 0) {
		alert( "Please enter Your E-mail Address");
		theform.your_email.focus();
		return;
	}

    //CHECK EMAIL FORMAT
    var input_str=theform.your_email.value;
    var input_len1=input_str.length;
    var iserror=0;
    input_len1=input_str.length;
    var lastdot=-1;
    var lastat=-1;
    var numberat=0;

    if (theform.your_email.value.length != 0) {

        for (var j = 0; j < input_len1; j++) {
             var ch2 = input_str.substring(j, j + 1);
             if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
                 alert("Please enter a valid email address.\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
                 iserror=1;
             }
             if (ch2==".") {
                 if ( j == lastdot + 1) {
                     alert("Please enter a valid email address.\nYou can't have two dots next to\neach other'..'.");
                     iserror=1;
                 }
                 lastdot=j;
             }
             if (ch2=="@") {
                 lastat=j;
                 numberat=numberat+1
             }
             if (ch2==" ") {
                 alert("Please enter a valid email address.\nYou can't have any spaces in the address.");
                 iserror=1;
             }
        }
        if (lastat == -1) {
             alert("Please enter a valid email address.\nYou don't have an '@'.");
             iserror=1;
        }
        if (lastat == 0) {
             alert("Please enter a valid email address.\nYou don't have a name before the '@'.");
             iserror=1;
        }
        if (numberat > 1) {
             alert("Please enter a valid email address.\nYou may have only one '@'.");
             iserror=1;
        }
        if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
             alert("Please enter a valid email address.\nYou don't have a proper domain name.\nUse .com, .org, .net, .us, etc");
             iserror=1;
        }
        if (lastdot == lastat + 1) {
             alert("Please enter a valid email address.\nYou don't have a proper organization name.\nUse name@organization.domain");
             iserror=1;
        }
        if (iserror==1) {
             theform.your_email.focus();
             return;
        }

    }

   	// MUST ENTER PATIENT NAME
	if (theform.patient_name.value.length == 0) {
		alert( "Please enter Patient Name");
		theform.patient_name.focus();
		return;
	}

	// MUST ENTER ORDER TYPE
    if ((theform.ordertype[0].checked == false) && (theform.ordertype[1].checked == false)) {
        alert("Please select Order Type");
        return;
    }

	// EXCHANGE CHECKED, MUST ENTER ORIGINAL INVOICE NUMBER
    if ((theform.ordertype[1].checked == true) && (theform.invoice_no.value.length == 0)) {
        alert("Please enter Original Invoice Number");
        theform.invoice_no.focus();
        return;
    }

	// MUST ENTER SHIPPING LOCATION
    if ((theform.ship_location[0].checked == false) && (theform.ship_location[1].checked == false)) {
        alert("Please select Shipping Location");
        return;
    }

   	// DIRECT TO PATIENT CHECKED, MUST ENTER SHIP METHOD
	if ((theform.ship_location[1].checked == true) && (theform.ship_method[0].selected == true)) {
		alert( "Please selected Ship Method");
		theform.ship_method.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER STREET ADDRESS
	if ((theform.ship_location[1].checked == true) && (theform.street.value.length == 0)) {
		alert( "Please enter Street Address");
		theform.street.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER CITY
	if ((theform.ship_location[1].checked == true) && (theform.city.value.length == 0)) {
		alert( "Please enter City");
		theform.city.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER STATE
	if ((theform.ship_location[1].checked == true) && (theform.state[0].selected == true)) {
		alert( "Please select a State");
		theform.state.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER ZIP CODE
	if ((theform.ship_location[1].checked == true) && (theform.zip.value.length == 0)) {
		alert( "Please enter Zip Code");
		theform.zip.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER PHONE
	if ((theform.ship_location[1].checked == true) && (theform.patient_phone.value.length == 0)) {
		alert( "Please enter Patient Phone");
		theform.patient_phone.focus();
		return;
	}

	buttonwaspressed = true;
	theform.submit();
}

function ValidateStep2(theform) {

	// MUST ENTER LENS TYPE
	if ((theform._browser_out1[0].checked == false) && (theform._browser_out1[1].checked == false) && (theform._browser_out1[2].checked == false)) {
        alert("Please select Lens Type");
        return false
    }

    return true
}

function ValidateStep3(theform) {

	// MUST ENTER LENS TYPE
	if ((theform._browser_out2[0].checked == false) && (theform._browser_out2[1].checked == false) && (theform._browser_out2[2].checked == false)) {
        alert("Please select Eye(s)");
        return false
    }

    return true
}

function ValidateStep4crtright(theform) {

	// MUST ENTER CERTIFICATION NUMBER
	if (theform.rcert_no.value.length == 0) {
        alert("Please enter Certification Number");
		theform.rcert_no.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.rbasecurve.value.length == 0) {
        alert("Please enter Base Curve");
		theform.rbasecurve.focus();
        return false
    }

	// MUST ENTER RZD
	if (theform.rrzd.value.length == 0) {
        alert("Please enter RZD");
		theform.rrzd.focus();
        return false
    }

	// MUST ENTER LZA
	if (theform.rlza.value.length == 0) {
        alert("Please enter LZA");
		theform.rlza.focus();
        return false
    }

	// MUST ENTER NEWSPARE
    if ((theform.rnewspare[0].checked == false) && (theform.rnewspare[1].checked == false)) {
        alert("Please select New/Spare");
        return false
    }

	// SPARE CHECKED, MUST ENTER SERIAL NUMBER
    if ((theform.rnewspare[1].checked == true) && (theform.rserial_no.value.length == 0)) {
        alert("Please enter Serial Number");
        theform.rserial_no.focus();
        return false
    }

    return true
}

function ValidateStep4crtleft(theform) {

	// MUST ENTER CERTIFICATION NUMBER
	if (theform.lcert_no.value.length == 0) {
        alert("Please enter Certification Number");
		theform.lcert_no.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.lbasecurve.value.length == 0) {
        alert("Please enter Base Curve");
		theform.lbasecurve.focus();
        return false
    }

	// MUST ENTER RZD
	if (theform.lrzd.value.length == 0) {
        alert("Please enter RZD");
		theform.lrzd.focus();
        return false
    }

	// MUST ENTER LZA
	if (theform.llza.value.length == 0) {
        alert("Please enter LZA");
		theform.llza.focus();
        return false
    }

	// MUST ENTER NEWSPARE
    if ((theform.lnewspare[0].checked == false) && (theform.lnewspare[1].checked == false)) {
        alert("Please select New/Spare");
        return false
    }

	// SPARE CHECKED, MUST ENTER SERIAL NUMBER
    if ((theform.lnewspare[1].checked == true) && (theform.lserial_no.value.length == 0)) {
        alert("Please enter Serial Number");
        theform.lserial_no.focus();
        return false
    }

    return true
}





function ValidateStep4crtboth(theform) {

	// MUST ENTER CERTIFICATION NUMBER
	if (theform.rcert_no.value.length == 0) {
        alert("Please enter Certification Number (Right Eye)");
		theform.rcert_no.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.rbasecurve.value.length == 0) {
        alert("Please enter Base Curve (Right Eye)");
		theform.rbasecurve.focus();
        return false
    }

	// MUST ENTER RZD
	if (theform.rrzd.value.length == 0) {
        alert("Please enter RZD (Right Eye)");
		theform.rrzd.focus();
        return false
    }

	// MUST ENTER LZA
	if (theform.rlza.value.length == 0) {
        alert("Please enter LZA (Right Eye)");
		theform.rlza.focus();
        return false
    }

	// MUST ENTER NEWSPARE
    if ((theform.rnewspare[0].checked == false) && (theform.rnewspare[1].checked == false)) {
        alert("Please select New/Spare (Right Eye)");
        return false
    }

	// SPARE CHECKED, MUST ENTER SERIAL NUMBER
    if ((theform.rnewspare[1].checked == true) && (theform.rserial_no.value.length == 0)) {
        alert("Please enter Serial Number (Right Eye)");
        theform.rserial_no.focus();
        return false
    }

	// MUST ENTER CERTIFICATION NUMBER
	if (theform.lcert_no.value.length == 0) {
        alert("Please enter Certification Number (Left Eye)");
		theform.lcert_no.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.lbasecurve.value.length == 0) {
        alert("Please enter Base Curve (Left Eye)");
		theform.lbasecurve.focus();
        return false
    }

	// MUST ENTER RZD
	if (theform.lrzd.value.length == 0) {
        alert("Please enter RZD (Left Eye)");
		theform.lrzd.focus();
        return false
    }

	// MUST ENTER LZA
	if (theform.llza.value.length == 0) {
        alert("Please enter LZA (Left Eye)");
		theform.llza.focus();
        return false
    }

	// MUST ENTER NEWSPARE
    if ((theform.lnewspare[0].checked == false) && (theform.lnewspare[1].checked == false)) {
        alert("Please select New/Spare (Left Eye)");
        return false
    }

	// SPARE CHECKED, MUST ENTER SERIAL NUMBER
    if ((theform.lnewspare[1].checked == true) && (theform.lserial_no.value.length == 0)) {
        alert("Please enter Serial Number (Left Eye)");
        theform.lserial_no.focus();
        return false
    }

    return true
}













function ValidateForm(theform) {
// Verify that required data exists prior
// to submitting review to server.

   	// MUST ENTER NAME
	if (theform.name.value.length == 0) {
		alert( "Please enter your Name");
		theform.name.focus();
		return false
	}

    // IF AGE ENTERED, MUST BE VALID AGE
	if ((theform.age.value.length != 0) && ((theform.age.value <= 13) || (theform.age.value >= 101))) {
        alert("Please enter a valid Age (14-100)");
        theform.age.focus();
        return false
    }

	// WANTS E-MAIL CONTACT, MUST ENTER E-MAIL ADDRESS, WILL CHECK FOR RE-ENTRY AFTER VALIDATION
    if ((theform.update_email.checked == true) && (theform.emailaddress.value.length == 0)) {
        alert("Please enter your E-mail Address");
        theform.emailaddress.focus();
        return false
    }

	// WANTS PHONE CONTACT, MUST ENTER AT LEAST ONE PHONE NUMBER
    if ((theform.update_phone.checked == true) && ((theform.homephone.value.length == 0) && (theform.businessphone.value.length == 0))) {
        alert("Please enter a Phone Number");
        theform.homephone.focus();
        return false
    }

	// WANTS US MAIL CONTACT, MUST ENTER ADDRESS, CITY, STATE, ZIP

    if ((theform.update_regular.checked == true) && ((theform.address1.value.length == 0) && (theform.address2.value.length == 0))) {
        alert("Please enter your Street Address");
        theform.address1.focus();
        return false
    }

    if ((theform.update_regular.checked == true) && (theform.city.value.length == 0)) {
        alert("Please enter your City");
        theform.city.focus();
        return false
    }

    if ((theform.update_regular.checked == true) && (theform.state.selectedIndex == 0)) {
        alert("Please enter your State");
        theform.state.focus();
        return false
    }

    if ((theform.update_regular.checked == true) && (theform.zipcode.value.length == 0)) {
        alert("Please enter your Zip Code");
        theform.zipcode.focus();
        return false
    }


    //CHECK EMAIL FORMAT
    var input_str=theform.emailaddress.value;
    var input_len1=input_str.length;
    var iserror=0;
    input_len1=input_str.length;
    var lastdot=-1;
    var lastat=-1;
    var numberat=0;

    if (theform.emailaddress.value.length != 0) {

        for (var j = 0; j < input_len1; j++) {
             var ch2 = input_str.substring(j, j + 1);
             if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
                 alert("Please input a valid email address!\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
                 iserror=1;
             }
             if (ch2==".") {
                 if ( j == lastdot + 1) {
                     alert("Please input a valid email address!\nYou can't have two dots next to\neach other'..'.");
                     iserror=1;
                 }
                 lastdot=j;
             }
             if (ch2=="@") {
                 lastat=j;
                 numberat=numberat+1
             }
             if (ch2==" ") {
                 alert("Please input a valid email address!\nYou can't have any spaces in the address.");
                 iserror=1;
             }
        }
        if (lastat == -1) {
             alert("Please input a valid email address!\nYou don't have an '@'.");
             iserror=1;
        }
        if (lastat == 0) {
             alert("Please input a valid email address!\nYou don't have a name before the '@'.");
             iserror=1;
        }
        if (numberat > 1) {
             alert("Please input a valid email address!\nYou may have only one '@'.");
             iserror=1;
        }
        if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
             alert("Please input a valid email address!\nYou don't have a proper domain name!\nUse .com, .org, .net, .us, etc");
             iserror=1;
        }
        if (lastdot == lastat + 1) {
             alert("Please input a valid email address!\nYou don't have a proper organization name!\nUse name@organization.domain");
             iserror=1;
        }
        if (iserror==1) {
             theform.emailaddress.focus();
             return false;
        }

    }

	// WANTS E-MAIL CONTACT, MUST RE-ENTER E-MAIL ADDRESS
    if ((theform.update_email.checked == true) && (theform.emailaddress2.value.length == 0)) {
        alert("Please re-enter your E-mail Address");
        theform.emailaddress2.focus();
        return false
    }

	// REGARDLESS OF WHETHER WANTS E-MAIL CONTACT, IF E-MAIL ADDRESS ENTERED BOTH ENTRIES MUST MATCH
    if (theform.emailaddress.value != theform.emailaddress2.value) {
        alert("Your re-entered e-mail address doesn't match the one you entered originally");
        theform.emailaddress2.focus();
        return false
    }

	// BLOCK SPAININPAIN@AOL.COM
    if (theform.name.value == "spaininpain@aol.com") {
        alert("Submissions from your e-mail address have been blocked. For more information, please contact our office directly.");
        theform.name.focus();
        return false
    }

    if (theform.emailaddress.value == "spaininpain@aol.com") {
        alert("Submissions from your e-mail address have been blocked. For more information, please contact our office directly.");
        theform.emailaddress.focus();
        return false
    }

    if (theform.emailaddress2.value == "spaininpain@aol.com") {
        alert("Submissions from your e-mail address have been blocked. For more information, please contact our office directly.");
        theform.emailaddress2.focus();
        return false
    }

   	return true
}

function ValidateStep4softright(theform) {

	// MUST SELECT PRODUCT NAME
	if ((theform.rproduct_name[0].selected == true) && (theform.rproduct_other.value.length == 0)) {
        alert("Please select Product Name");
		theform.rproduct_name.focus();
        return false
    }

	// SELECTED OTHER, MUST ENTER PRODUCT NAME
	if ((theform.rproduct_name[11].selected == true) && (theform.rproduct_other.value.length == 0)) {
        alert("Please enter Product Name");
		theform.rproduct_other.focus();
        return false
    }

	// SELECTED PRODUCT NAME AND ENTERED OTHER, TMI
	if (((theform.rproduct_name[1].selected == true)
       ||(theform.rproduct_name[2].selected == true)
       ||(theform.rproduct_name[3].selected == true)
       ||(theform.rproduct_name[2].selected == true))
       && (theform.rproduct_other.value.length != 0)) {
        alert("When a product is selected in the Product Name drop-down, the Other field must be left blank.");
		theform.rproduct_other.focus();
        return false
    }

	// MUST ENTER REVENUE/TRIAL
	if (theform.rrevenue_trial[0].selected == true) {
        alert("Please select Revenue/Trial");
		theform.rrevenue_trial.focus();
        return false
    }

	// MUST BASE CURVE
	if (theform.rcurve.value.length == 0) {
        alert("Please enter Base Curve");
		theform.rcurve.focus();
        return false
    }

	// MUST ENTER POWER
	if (theform.rpower.value.length == 0) {
        alert("Please enter Power");
		theform.rpower.focus();
        return false
    }

	// MUST ENTER DIAMETER
	if (theform.rdiameter.value.length == 0) {
        alert("Please select Diameter");
		theform.rdiameter.focus();
        return false
    }

    return true
}

function ValidateStep4softleft(theform) {

	// MUST SELECT PRODUCT NAME
	if ((theform.lproduct_name[0].selected == true) && (theform.lproduct_other.value.length == 0)) {
        alert("Please select Product Name");
		theform.lproduct_name.focus();
        return false
    }

	// SELECTED OTHER, MUST ENTER PRODUCT NAME
	if ((theform.lproduct_name[11].selected == true) && (theform.lproduct_other.value.length == 0)) {
        alert("Please enter Product Name");
		theform.lproduct_other.focus();
        return false
    }

	// SELECTED PRODUCT NAME AND ENTERED OTHER, TMI
	if (((theform.lproduct_name[1].selected == true)
       ||(theform.lproduct_name[2].selected == true)
       ||(theform.lproduct_name[3].selected == true)
       ||(theform.lproduct_name[2].selected == true))
       && (theform.lproduct_other.value.length != 0)) {
        alert("When a product is selected in the Product Name drop-down, the Other field must be left blank.");
		theform.lproduct_other.focus();
        return false
    }

	// MUST SELECT REVENUE/TRIAL
	if (theform.lrevenue_trial[0].selected == true) {
        alert("Please select Revenue/Trial");
		theform.lrevenue_trial.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.lcurve.value.length == 0) {
        alert("Please enter Base Curve");
		theform.lcurve.focus();
        return false
    }

	// MUST ENTER POWER
	if (theform.lpower.value.length == 0) {
        alert("Please enter Power");
		theform.lpower.focus();
        return false
    }

	// MUST ENTER DIAMETER
	if (theform.ldiameter.value.length == 0) {
        alert("Please enter Diameter");
		theform.ldiameter.focus();
        return false
    }

    return true
}

function ValidateStep4softboth(theform) {

	// MUST SELECT PRODUCT NAME
	if ((theform.rproduct_name[0].selected == true) && (theform.rproduct_other.value.length == 0)) {
        alert("Please select Product Name (Right Eye)");
		theform.rproduct_name.focus();
        return false
    }

	// SELECTED OTHER, MUST ENTER PRODUCT NAME
	if ((theform.rproduct_name[11].selected == true) && (theform.rproduct_other.value.length == 0)) {
        alert("Please enter Product Name (Right Eye)");
		theform.rproduct_other.focus();
        return false
    }

	// SELECTED PRODUCT NAME AND ENTERED OTHER, TMI
	if (((theform.rproduct_name[1].selected == true)
       ||(theform.rproduct_name[2].selected == true)
       ||(theform.rproduct_name[3].selected == true)
       ||(theform.rproduct_name[2].selected == true))
       && (theform.rproduct_other.value.length != 0)) {
        alert("When a product is selected in the Product Name drop-down, the Other field must be left blank (Right Eye)");
		theform.rproduct_other.focus();
        return false
    }

	// MUST SELECT REVENUE/TRIAL
	if (theform.rrevenue_trial[0].selected == true) {
        alert("Please select Revenue/Trial (Right Eye)");
		theform.rrevenue_trial.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.rcurve.value.length == 0) {
        alert("Please enter Base Curve (Right Eye)");
		theform.rcurve.focus();
        return false
    }

	// MUST ENTER POWER
	if (theform.rpower.value.length == 0) {
        alert("Please enter Power (Right Eye)");
		theform.rpower.focus();
        return false
    }

	// MUST ENTER DIAMETER
	if (theform.rdiameter.value.length == 0) {
        alert("Please enter Diameter (Right Eye)");
		theform.rdiameter.focus();
        return false
    }

	// MUST SELECT PRODUCT NAME
	if ((theform.lproduct_name[0].selected == true) && (theform.lproduct_other.value.length == 0)) {
        alert("Please select Product Name (Left Eye)");
		theform.lproduct_name.focus();
        return false
    }

	// SELECTED OTHER, MUST ENTER PRODUCT NAME
	if ((theform.lproduct_name[11].selected == true) && (theform.lproduct_other.value.length == 0)) {
        alert("Please enter Product Name (Left Eye)");
		theform.lproduct_other.focus();
        return false
    }

	// SELECTED PRODUCT NAME AND ENTERED OTHER, TMI
	if (((theform.lproduct_name[1].selected == true)
       ||(theform.lproduct_name[2].selected == true)
       ||(theform.lproduct_name[3].selected == true)
       ||(theform.lproduct_name[2].selected == true))
       && (theform.lproduct_other.value.length != 0)) {
        alert("When a product is selected in the Product Name drop-down, the Other field must be left blank (Left Eye)");
		theform.lproduct_other.focus();
        return false
    }

	// MUST SELECT REVENUE/TRIAL
	if (theform.lrevenue_trial[0].selected == true) {
        alert("Please select Revenue/Trial (Left Eye)");
		theform.lrevenue_trial.focus();
        return false
    }

	// MUST ENTER BASE CURVE
	if (theform.lcurve.value.length == 0) {
        alert("Please enter Base Curve (Left Eye)");
		theform.lcurve.focus();
        return false
    }

	// MUST ENTER POWER
	if (theform.lpower.value.length == 0) {
        alert("Please enter Power (Left Eye)");
		theform.lpower.focus();
        return false
    }

	// MUST ENTER DIAMETER
	if (theform.ldiameter.value.length == 0) {
        alert("Please enter Diameter (Left Eye)");
		theform.ldiameter.focus();
        return false
    }

    return true
}

function ValidateStep4rigidright(theform) {

	// NEW ORDER, MUST SELECT WARRANTY
    if ((theform.ordertype.value == "New Order") && (theform.rwarranty[0].selected == true)) {
        alert("Please select Warranty");
		theform.rwarranty.focus();
        return false
    }

	// EXCHANGE, CAN NOT SELECT WARRANTY
    if ((theform.ordertype.value == "Exchange") && ((theform.rwarranty[1].selected == true) ||(theform.rwarranty[2].selected == true))) {
        alert("A Warranty not available as this is an Exchange order");
		theform.rwarranty.focus();
        return false
    }






	// MUST SELECT MATERIAL
	if (theform.rlens_material[0].selected == true) {
        alert("Please select Material");
		theform.rlens_material.focus();
        return false
    }

	// MUST SELECT COLOR
	if (theform.rcolor[0].selected == true) {
        alert("Please select Color");
		theform.rcolor.focus();
        return false
    }

	// MUST SELECT LENS DESIGN
	if (theform.rlens_design[0].selected == true) {
        alert("Please select Lens Design");
		theform.rlens_design.focus();
        return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER BASE CURVE
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER POWER
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rpower.value.length == 0)) {
       alert("Please enter Power");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER DIAMETER
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[10].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER POWER
	if ((theform.rlens_design[10].selected == true) && (theform.rpower.value.length == 0)) {
       alert("Please enter Power");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[10].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST SELECT BASE CURVE
	if ((theform.rlens_design[10].selected == true) && (theform.rperiphery[0].selected == true)) {
       alert("Please select Periphery");
       theform.rperiphery.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[11].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER POWER
	if ((theform.rlens_design[11].selected == true) && (theform.rpower.value.length == 0)) {
       alert("Please enter Power");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[11].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER SECONDARY CURVE
	if ((theform.rlens_design[11].selected == true) && (theform.rsecondarycurve.value.length == 0)) {
       alert("Please enter Secondary Curve");
       theform.rsecondarycurve.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #1
	if ((theform.rlens_design[12].selected == true) && (theform.rbasecurve1.value.length == 0)) {
       alert("Please enter Base Curve #1");
       theform.rbasecurve1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #2
	if ((theform.rlens_design[12].selected == true) && (theform.rbasecurve2.value.length == 0)) {
       alert("Please enter Base Curve #2");
       theform.rbasecurve2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #1
	if ((theform.rlens_design[12].selected == true) && (theform.rpower1.value.length == 0)) {
       alert("Please enter Power #1");
       theform.rpower1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #2
	if ((theform.rlens_design[12].selected == true) && (theform.rpower2.value.length == 0)) {
       alert("Please enter Power #2");
       theform.rpower2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST SELECT CYLINDER/LENSOMETER
	if ((theform.rlens_design[12].selected == true) && (theform.rcylinder_lensometer[0].selected == true)) {
       alert("Please select Cylinder/Lensometer");
       theform.rcylinder_lensometer.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[12].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[13].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER SPHERE POWER
	if ((theform.rlens_design[13].selected == true) && (theform.rsphere_power.value.length == 0)) {
       alert("Please enter Sphere Power");
       theform.rsphere_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER CYLINDER POWER
	if ((theform.rlens_design[13].selected == true) && (theform.rcylinder_power.value.length == 0)) {
       alert("Please enter Cylinder Power");
       theform.rcylinder_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER AXIS
	if ((theform.rlens_design[13].selected == true) && (theform.raxis.value.length == 0)) {
       alert("Please enter Axis");
       theform.raxis.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[13].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[14].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.rlens_design[14].selected == true) && (theform.rdistance_power.value.length == 0)) {
       alert("Please enter Distance Power");
       theform.rdistance_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER ADD POWER
	if ((theform.rlens_design[14].selected == true) && (theform.radd_power.value.length == 0)) {
       alert("Please enter Add Power");
       theform.radd_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[14].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER SEG SIZE
	if ((theform.rlens_design[14].selected == true) && (theform.rseg_size.value.length == 0)) {
       alert("Please enter Seg Size");
       theform.rseg_size.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[15].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.rlens_design[15].selected == true) && (theform.rdistance_power.value.length == 0)) {
       alert("Please enter Distance Power");
       theform.rdistance_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER ADD POWER
	if ((theform.rlens_design[15].selected == true) && (theform.radd_power.value.length == 0)) {
       alert("Please enter Add Power");
       theform.radd_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[15].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER SEG HEIGHT
	if ((theform.rlens_design[15].selected == true) && (theform.rseg_height.value.length == 0)) {
       alert("Please enter Seg Height");
       theform.rseg_height.focus();
       return false
    }

    return true
}

function ValidateStep4rigidleft(theform) {

	// NEW ORDER, MUST SELECT WARRANTY
    if ((theform.ordertype.value == "New Order") && (theform.lwarranty[0].selected == true)) {
        alert("Please select Warranty");
		theform.lwarranty.focus();
        return false
    }

	// EXCHANGE, CAN NOT SELECT WARRANTY
    if ((theform.ordertype.value == "Exchange") && ((theform.lwarranty[1].selected == true) ||(theform.lwarranty[2].selected == true))) {
        alert("A Warranty not available as this is an Exchange order");
		theform.lwarranty.focus();
        return false
    }

	// MUST SELECT MATERIAL
	if (theform.llens_material[0].selected == true) {
        alert("Please select Material");
		theform.llens_material.focus();
        return false
    }

	// MUST SELECT COLOR
	if (theform.lcolor[0].selected == true) {
        alert("Please select Color");
		theform.lcolor.focus();
        return false
    }

	// MUST SELECT LENS DESIGN
	if (theform.llens_design[0].selected == true) {
        alert("Please select Lens Design");
		theform.llens_design.focus();
        return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER BASE CURVE
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER POWER
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.lpower.value.length == 0)) {
       alert("Please enter Power");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER DIAMETER
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[10].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER POWER
	if ((theform.llens_design[10].selected == true) && (theform.lpower.value.length == 0)) {
       alert("Please enter Power");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[10].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST SELECT BASE CURVE
	if ((theform.llens_design[10].selected == true) && (theform.lperiphery[0].selected == true)) {
       alert("Please select Periphery");
       theform.lperiphery.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[11].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER POWER
	if ((theform.llens_design[11].selected == true) && (theform.lpower.value.length == 0)) {
       alert("Please enter Power");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[11].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER SECONDARY CURVE
	if ((theform.llens_design[11].selected == true) && (theform.lsecondarycurve.value.length == 0)) {
       alert("Please enter Secondary Curve");
       theform.lsecondarycurve.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #1
	if ((theform.llens_design[12].selected == true) && (theform.lbasecurve1.value.length == 0)) {
       alert("Please enter Base Curve #1");
       theform.lbasecurve1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #2
	if ((theform.llens_design[12].selected == true) && (theform.lbasecurve2.value.length == 0)) {
       alert("Please enter Base Curve #2");
       theform.lbasecurve2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #1
	if ((theform.llens_design[12].selected == true) && (theform.lpower1.value.length == 0)) {
       alert("Please enter Power #1");
       theform.lpower1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #2
	if ((theform.llens_design[12].selected == true) && (theform.lpower2.value.length == 0)) {
       alert("Please enter Power #2");
       theform.lpower2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST SELECT CYLINDER/LENSOMETER
	if ((theform.llens_design[12].selected == true) && (theform.lcylinder_lensometer[0].selected == true)) {
       alert("Please select Cylinder/Lensometer");
       theform.lcylinder_lensometer.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[12].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[13].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER SPHERE POWER
	if ((theform.llens_design[13].selected == true) && (theform.lsphere_power.value.length == 0)) {
       alert("Please enter Sphere Power");
       theform.lsphere_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER CYLINDER POWER
	if ((theform.llens_design[13].selected == true) && (theform.lcylinder_power.value.length == 0)) {
       alert("Please enter Cylinder Power");
       theform.lcylinder_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER AXIS
	if ((theform.llens_design[13].selected == true) && (theform.laxis.value.length == 0)) {
       alert("Please enter Axis");
       theform.laxis.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[13].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[14].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.llens_design[14].selected == true) && (theform.ldistance_power.value.length == 0)) {
       alert("Please enter Distance Power");
       theform.ldistance_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER ADD POWER
	if ((theform.llens_design[14].selected == true) && (theform.ladd_power.value.length == 0)) {
       alert("Please enter Add Power");
       theform.ladd_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[14].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER SEG SIZE
	if ((theform.llens_design[14].selected == true) && (theform.lseg_size.value.length == 0)) {
       alert("Please enter Seg Size");
       theform.lseg_size.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[15].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.llens_design[15].selected == true) && (theform.ldistance_power.value.length == 0)) {
       alert("Please enter Distance Power");
       theform.ldistance_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER ADD POWER
	if ((theform.llens_design[15].selected == true) && (theform.ladd_power.value.length == 0)) {
       alert("Please enter Add Power");
       theform.ladd_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[15].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER SEG HEIGHT
	if ((theform.llens_design[15].selected == true) && (theform.lseg_height.value.length == 0)) {
       alert("Please enter Seg Height");
       theform.lseg_height.focus();
       return false
    }

    return true
}

function ValidateStep4rigidboth(theform) {

	// NEW ORDER, MUST SELECT WARRANTY
    if ((theform.ordertype.value == "New Order") && (theform.rwarranty[0].selected == true)) {
        alert("Please select Warranty (Right Eye)");
		theform.rwarranty.focus();
        return false
    }

	// EXCHANGE, CAN NOT SELECT WARRANTY
    if ((theform.ordertype.value == "Exchange") && ((theform.rwarranty[1].selected == true) ||(theform.rwarranty[2].selected == true))) {
        alert("A Warranty not available as this is an Exchange order (Right Eye)");
		theform.rwarranty.focus();
        return false
    }

	// MUST SELECT MATERIAL
	if (theform.rlens_material[0].selected == true) {
        alert("Please select Material (Right Eye)");
		theform.rlens_material.focus();
        return false
    }

	// MUST SELECT COLOR
	if (theform.rcolor[0].selected == true) {
        alert("Please select Color (Right Eye)");
		theform.rcolor.focus();
        return false
    }

	// MUST SELECT LENS DESIGN
	if (theform.rlens_design[0].selected == true) {
        alert("Please select Lens Design (Right Eye)");
		theform.rlens_design.focus();
        return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER BASE CURVE
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER POWER
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rpower.value.length == 0)) {
       alert("Please enter Power (Right Eye)");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER DIAMETER
	if (((theform.rlens_design[1].selected == true)
       || (theform.rlens_design[2].selected == true)
       || (theform.rlens_design[3].selected == true)
       || (theform.rlens_design[4].selected == true)
       || (theform.rlens_design[5].selected == true)
       || (theform.rlens_design[6].selected == true)
       || (theform.rlens_design[7].selected == true)
       || (theform.rlens_design[8].selected == true)
       || (theform.rlens_design[9].selected == true))
       && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[10].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER POWER
	if ((theform.rlens_design[10].selected == true) && (theform.rpower.value.length == 0)) {
       alert("Please enter Power (Right Eye)");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[10].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST SELECT BASE CURVE
	if ((theform.rlens_design[10].selected == true) && (theform.rperiphery[0].selected == true)) {
       alert("Please select Periphery (Right Eye)");
       theform.rperiphery.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[11].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER POWER
	if ((theform.rlens_design[11].selected == true) && (theform.rpower.value.length == 0)) {
       alert("Please enter Power (Right Eye)");
       theform.rpower.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[11].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER SECONDARY CURVE
	if ((theform.rlens_design[11].selected == true) && (theform.rsecondarycurve.value.length == 0)) {
       alert("Please enter Secondary Curve (Right Eye)");
       theform.rsecondarycurve.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #1
	if ((theform.rlens_design[12].selected == true) && (theform.rbasecurve1.value.length == 0)) {
       alert("Please enter Base Curve #1 (Right Eye)");
       theform.rbasecurve1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #2
	if ((theform.rlens_design[12].selected == true) && (theform.rbasecurve2.value.length == 0)) {
       alert("Please enter Base Curve #2 (Right Eye)");
       theform.rbasecurve2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #1
	if ((theform.rlens_design[12].selected == true) && (theform.rpower1.value.length == 0)) {
       alert("Please enter Power #1 (Right Eye)");
       theform.rpower1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #2
	if ((theform.rlens_design[12].selected == true) && (theform.rpower2.value.length == 0)) {
       alert("Please enter Power #2 (Right Eye)");
       theform.rpower2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST SELECT CYLINDER/LENSOMETER
	if ((theform.rlens_design[12].selected == true) && (theform.rcylinder_lensometer[0].selected == true)) {
       alert("Please select Cylinder/Lensometer (Right Eye)");
       theform.rcylinder_lensometer.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[12].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[13].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER SPHERE POWER
	if ((theform.rlens_design[13].selected == true) && (theform.rsphere_power.value.length == 0)) {
       alert("Please enter Sphere Power (Right Eye)");
       theform.rsphere_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER CYLINDER POWER
	if ((theform.rlens_design[13].selected == true) && (theform.rcylinder_power.value.length == 0)) {
       alert("Please enter Cylinder Power (Right Eye)");
       theform.rcylinder_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER AXIS
	if ((theform.rlens_design[13].selected == true) && (theform.raxis.value.length == 0)) {
       alert("Please enter Axis (Right Eye)");
       theform.raxis.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[13].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[14].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.rlens_design[14].selected == true) && (theform.rdistance_power.value.length == 0)) {
       alert("Please enter Distance Power (Right Eye)");
       theform.rdistance_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER ADD POWER
	if ((theform.rlens_design[14].selected == true) && (theform.radd_power.value.length == 0)) {
       alert("Please enter Add Power (Right Eye)");
       theform.radd_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[14].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER SEG SIZE
	if ((theform.rlens_design[14].selected == true) && (theform.rseg_size.value.length == 0)) {
       alert("Please enter Seg Size (Right Eye)");
       theform.rseg_size.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER BASE CURVE
	if ((theform.rlens_design[15].selected == true) && (theform.rbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Right Eye)");
       theform.rbasecurve.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.rlens_design[15].selected == true) && (theform.rdistance_power.value.length == 0)) {
       alert("Please enter Distance Power (Right Eye)");
       theform.rdistance_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER ADD POWER
	if ((theform.rlens_design[15].selected == true) && (theform.radd_power.value.length == 0)) {
       alert("Please enter Add Power (Right Eye)");
       theform.radd_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DIAMETER
	if ((theform.rlens_design[15].selected == true) && (theform.rdiameter.value.length == 0)) {
       alert("Please enter Diameter (Right Eye)");
       theform.rdiameter.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER SEG HEIGHT
	if ((theform.rlens_design[15].selected == true) && (theform.rseg_height.value.length == 0)) {
       alert("Please enter Seg Height (Right Eye)");
       theform.rseg_height.focus();
       return false
    }








	// NEW ORDER, MUST SELECT WARRANTY
    if ((theform.ordertype.value == "New Order") && (theform.lwarranty[0].selected == true)) {
        alert("Please select Warranty (Left Eye)");
		theform.lwarranty.focus();
        return false
    }

	// EXCHANGE, CAN NOT SELECT WARRANTY
    if ((theform.ordertype.value == "Exchange") && ((theform.lwarranty[1].selected == true) ||(theform.lwarranty[2].selected == true))) {
        alert("A Warranty not available as this is an Exchange order (Left Eye)");
		theform.lwarranty.focus();
        return false
    }

	// MUST SELECT MATERIAL
	if (theform.llens_material[0].selected == true) {
        alert("Please select Material (Left Eye)");
		theform.llens_material.focus();
        return false
    }

	// MUST SELECT COLOR
	if (theform.lcolor[0].selected == true) {
        alert("Please select Color (Left Eye)");
		theform.lcolor.focus();
        return false
    }

	// MUST SELECT LENS DESIGN
	if (theform.llens_design[0].selected == true) {
        alert("Please select Lens Design (Left Eye)");
		theform.llens_design.focus();
        return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER BASE CURVE
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER POWER
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.lpower.value.length == 0)) {
       alert("Please enter Power (Left Eye)");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGNS 1-9 SELECTED, MUST ENTER DIAMETER
	if (((theform.llens_design[1].selected == true)
       || (theform.llens_design[2].selected == true)
       || (theform.llens_design[3].selected == true)
       || (theform.llens_design[4].selected == true)
       || (theform.llens_design[5].selected == true)
       || (theform.llens_design[6].selected == true)
       || (theform.llens_design[7].selected == true)
       || (theform.llens_design[8].selected == true)
       || (theform.llens_design[9].selected == true))
       && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[10].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER POWER
	if ((theform.llens_design[10].selected == true) && (theform.lpower.value.length == 0)) {
       alert("Please enter Power (Left Eye)");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[10].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 10 SELECTED, MUST SELECT BASE CURVE
	if ((theform.llens_design[10].selected == true) && (theform.lperiphery[0].selected == true)) {
       alert("Please select Periphery (Left Eye)");
       theform.lperiphery.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[11].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER POWER
	if ((theform.llens_design[11].selected == true) && (theform.lpower.value.length == 0)) {
       alert("Please enter Power (Left Eye)");
       theform.lpower.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[11].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 11 SELECTED, MUST ENTER SECONDARY CURVE
	if ((theform.llens_design[11].selected == true) && (theform.lsecondarycurve.value.length == 0)) {
       alert("Please enter Secondary Curve (Left Eye)");
       theform.lsecondarycurve.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #1
	if ((theform.llens_design[12].selected == true) && (theform.lbasecurve1.value.length == 0)) {
       alert("Please enter Base Curve #1 (Left Eye)");
       theform.lbasecurve1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER BASE CURVE #2
	if ((theform.llens_design[12].selected == true) && (theform.lbasecurve2.value.length == 0)) {
       alert("Please enter Base Curve #2 (Left Eye)");
       theform.lbasecurve2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #1
	if ((theform.llens_design[12].selected == true) && (theform.lpower1.value.length == 0)) {
       alert("Please enter Power #1 (Left Eye)");
       theform.lpower1.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER POWER #2
	if ((theform.llens_design[12].selected == true) && (theform.lpower2.value.length == 0)) {
       alert("Please enter Power #2 (Left Eye)");
       theform.lpower2.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST SELECT CYLINDER/LENSOMETER
	if ((theform.llens_design[12].selected == true) && (theform.lcylinder_lensometer[0].selected == true)) {
       alert("Please select Cylinder/Lensometer (Left Eye)");
       theform.lcylinder_lensometer.focus();
       return false
    }

	// LENS DESIGN 12 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[12].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[13].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER SPHERE POWER
	if ((theform.llens_design[13].selected == true) && (theform.lsphere_power.value.length == 0)) {
       alert("Please enter Sphere Power (Left Eye)");
       theform.lsphere_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER CYLINDER POWER
	if ((theform.llens_design[13].selected == true) && (theform.lcylinder_power.value.length == 0)) {
       alert("Please enter Cylinder Power (Left Eye)");
       theform.lcylinder_power.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER AXIS
	if ((theform.llens_design[13].selected == true) && (theform.laxis.value.length == 0)) {
       alert("Please enter Axis (Left Eye)");
       theform.laxis.focus();
       return false
    }

	// LENS DESIGN 13 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[13].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[14].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.llens_design[14].selected == true) && (theform.ldistance_power.value.length == 0)) {
       alert("Please enter Distance Power (Left Eye)");
       theform.ldistance_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER ADD POWER
	if ((theform.llens_design[14].selected == true) && (theform.ladd_power.value.length == 0)) {
       alert("Please enter Add Power (Left Eye)");
       theform.ladd_power.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[14].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 14 SELECTED, MUST ENTER SEG SIZE
	if ((theform.llens_design[14].selected == true) && (theform.lseg_size.value.length == 0)) {
       alert("Please enter Seg Size (Left Eye)");
       theform.lseg_size.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER BASE CURVE
	if ((theform.llens_design[15].selected == true) && (theform.lbasecurve.value.length == 0)) {
       alert("Please enter Base Curve (Left Eye)");
       theform.lbasecurve.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DISTANCE POWER
	if ((theform.llens_design[15].selected == true) && (theform.ldistance_power.value.length == 0)) {
       alert("Please enter Distance Power (Left Eye)");
       theform.ldistance_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER ADD POWER
	if ((theform.llens_design[15].selected == true) && (theform.ladd_power.value.length == 0)) {
       alert("Please enter Add Power (Left Eye)");
       theform.ladd_power.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER DIAMETER
	if ((theform.llens_design[15].selected == true) && (theform.ldiameter.value.length == 0)) {
       alert("Please enter Diameter (Left Eye)");
       theform.ldiameter.focus();
       return false
    }

	// LENS DESIGN 15 SELECTED, MUST ENTER SEG HEIGHT
	if ((theform.llens_design[15].selected == true) && (theform.lseg_height.value.length == 0)) {
       alert("Please enter Seg Height (Left Eye)");
       theform.lseg_height.focus();
       return false
    }

    return true
}

function do_submit() {
// Verify that required data exists prior
// to submitting review to server.

var buttonwaspressed = false;


   	// MUST ENTER DATE
	if (theform.currentdate.value.length == 0) {
		alert( "Please enter Date");
		theform.currentdate.focus();
		return;
	}

   	// MUST ENTER ACCOUNT NUMBER
	if (theform.account_no.value.length == 0) {
		alert( "Please enter Account Number");
		theform.account_no.focus();
		return;
	}

   	// MUST ENTER ACCOUNT NAME
	if (theform.account_name.value.length == 0) {
		alert( "Please enter Account Name");
		theform.account_name.focus();
		return;
	}

   	// MUST ENTER YOUR NAME
	if (theform.your_name.value.length == 0) {
		alert( "Please enter Your Name");
		theform.your_name.focus();
		return;
	}

   	// MUST ENTER YOUR E-MAIL
	if (theform.your_email.value.length == 0) {
		alert( "Please enter Your E-mail Address");
		theform.your_email.focus();
		return;
	}

    //CHECK EMAIL FORMAT
    var input_str=theform.your_email.value;
    var input_len1=input_str.length;
    var iserror=0;
    input_len1=input_str.length;
    var lastdot=-1;
    var lastat=-1;
    var numberat=0;

    if (theform.your_email.value.length != 0) {

        for (var j = 0; j < input_len1; j++) {
             var ch2 = input_str.substring(j, j + 1);
             if (((ch2 < "a") ||  (ch2 > "z")) && ((ch2 < "A") || (ch2 > "Z")) && ((ch2 < "0") ||  (ch2 > "9")) && (ch2 != "@" ) && (ch2 != ".") && (ch2 != "_") && (ch2 != "-")){
                 alert("Please enter a valid email address.\nValid characters include A-Z, a-z, 0-9, -, _, . and @");
                 iserror=1;
             }
             if (ch2==".") {
                 if ( j == lastdot + 1) {
                     alert("Please enter a valid email address.\nYou can't have two dots next to\neach other'..'.");
                     iserror=1;
                 }
                 lastdot=j;
             }
             if (ch2=="@") {
                 lastat=j;
                 numberat=numberat+1
             }
             if (ch2==" ") {
                 alert("Please enter a valid email address.\nYou can't have any spaces in the address.");
                 iserror=1;
             }
        }
        if (lastat == -1) {
             alert("Please enter a valid email address.\nYou don't have an '@'.");
             iserror=1;
        }
        if (lastat == 0) {
             alert("Please enter a valid email address.\nYou don't have a name before the '@'.");
             iserror=1;
        }
        if (numberat > 1) {
             alert("Please enter a valid email address.\nYou may have only one '@'.");
             iserror=1;
        }
        if ((lastdot <= lastat) || (lastdot > input_len1 - 3 ) || (input_len1 - lastdot > 4)) {
             alert("Please enter a valid email address.\nYou don't have a proper domain name.\nUse .com, .org, .net, .us, etc");
             iserror=1;
        }
        if (lastdot == lastat + 1) {
             alert("Please enter a valid email address.\nYou don't have a proper organization name.\nUse name@organization.domain");
             iserror=1;
        }
        if (iserror==1) {
             theform.your_email.focus();
             return;
        }

    }
   	// MUST ENTER PATIENT NAME
	if (theform.patient_name.value.length == 0) {
		alert( "Please enter Patient Name");
		theform.patient_name.focus();
		return;
	}

	// MUST ENTER ORDER TYPE
    if ((theform.ordertype[0].checked == false) && (theform.ordertype[1].checked == false)) {
        alert("Please select Order Type");
        return;
    }

	// NEW ORDER CHECKED, MUST SELECT WARRANTY
    if ((theform.ordertype[0].checked == true) && (theform.warranty[0].selected == true)) {
        alert("Please select Warranty");
        theform.invoice_no.focus();
        return;
    }

	// EXCHANGE CHECKED, MUST ENTER ORIGINAL INVOICE NUMBER
    if ((theform.ordertype[1].checked == true) && (theform.invoice_no.value.length == 0)) {
        alert("Please enter Original Invoice Number");
        theform.invoice_no.focus();
        return;
    }

	// EXCHANGE CHECKED, CAN'T SELECT WARRANTY
    if ((theform.ordertype[1].checked == true) && 
       ((theform.warranty[1].selected == true) ||
       (theform.warranty[2].selected == true) ||
       (theform.warranty[3].selected == true))) {
        alert("Warranty not available with Exchange orders");
        theform.warranty.focus();
        return;
    }

	// MUST SELECT SHIPPING LOCATION
    if ((theform.ship_location[0].checked == false) && (theform.ship_location[1].checked == false)) {
        alert("Please select Shipping Location");
        return;
    }

   	// DIRECT TO PATIENT CHECKED, MUST SELECT SHIP METHOD
	if ((theform.ship_location[1].checked == true) && (theform.ship_method[0].selected == true)) {
		alert( "Please select Ship Method");
		theform.ship_method.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER STREET ADDRESS
	if ((theform.ship_location[1].checked == true) && (theform.street.value.length == 0)) {
		alert( "Please enter Street Address");
		theform.street.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER CITY
	if ((theform.ship_location[1].checked == true) && (theform.city.value.length == 0)) {
		alert( "Please enter City");
		theform.city.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER STATE
	if ((theform.ship_location[1].checked == true) && (theform.state[0].selected == true)) {
		alert( "Please select a State");
		theform.state.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER ZIP CODE
	if ((theform.ship_location[1].checked == true) && (theform.zip.value.length == 0)) {
		alert( "Please enter Zip Code");
		theform.zip.focus();
		return;
	}

   	// DIRECT TO PATIENT CHECKED, MUST ENTER PHONE
	if ((theform.ship_location[1].checked == true) && (theform.patient_phone.value.length == 0)) {
		alert( "Please enter Patient Phone");
		theform.patient_phone.focus();
		return;
	}

	buttonwaspressed = true;
	theform.submit();

}

function ValidateConsultantStep2(theform) {

	// MUST ENTER LENS TYPE
	if ((theform._browser_out1[0].checked == false) && (theform._browser_out1[1].checked == false) && (theform._browser_out1[2].checked == false)) {
        alert("Please select Lens Type");
        return false
    }

	// RIGID SELECTED, MUST SELECT SINGLE/BIFOCAL
	if ((theform._browser_out1[2].checked == true) && (theform.lens_type2[0].selected == true)) {
        alert("Please select Single/Bifocal");
        return false
    }

	// RIGID NOT SELECTED, CAN'T SELECT SINGLE/BIFOCAL
	if (((theform._browser_out1[0].checked == true) ||(theform._browser_out1[1].checked == true)) && ((theform.lens_type2[1].selected == true) ||(theform.lens_type2[2].selected == true))) {
        alert("Single/Bifocal only available for Rigid lens");
        return false
    }

    return true
}

function ValidateConsultantStep3(theform) {

	// MUST ENTER LENS TYPE
	if ((theform._browser_out2[0].checked == false) && (theform._browser_out2[1].checked == false) && (theform._browser_out2[2].checked == false)) {
        alert("Please select Eye(s)");
        return false
    }

    return true
}

function ValidateConsultantStep4crtright(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.raxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.rprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4crtleft(theform) {

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.laxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4crtboth(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Right Eye)");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Right Eye)");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis (Right Eye)");
		theform.raxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Right Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Right Eye)");
        theform.rprecond_explain.focus();
        return false
    }

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Left Eye)");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Left Eye)");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis (Left Eye)");
		theform.laxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Left Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Left Eye)");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4softright(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.raxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.rprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4softleft(theform) {

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.laxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4softboth(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Right Eye)");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Right Eye)");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis (Right Eye)");
		theform.raxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Right Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Right Eye)");
        theform.rprecond_explain.focus();
        return false
    }

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Left Eye)");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Left Eye)");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis (Left Eye)");
		theform.laxis.focus();
		return false
	}

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Left Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Left Eye)");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4rigidright(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.raxis.focus();
		return false
	}

	// BIFOCAL LENS, MUST ENTER ADD POWER
    if ((theform.lens_type2.value == "Bifocal") && (theform.radd_power.value.length == 0)) {
		alert( "Please enter Add Power");
		theform.radd_power.focus();
		return false
    }

	// SINGLE VISION LENS, SHOULD NOT ADD POWER
    if ((theform.lens_type2.value == "Single Vision") && (theform.radd_power.value.length != 0)) {
		alert( "Add Power only available for Bifocal lens only");
		theform.radd_power.focus();
		return false
    }

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.rprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4rigidleft(theform) {

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis");
		theform.laxis.focus();
		return false
	}

	// BIFOCAL LENS, MUST ENTER ADD POWER
    if ((theform.lens_type2.value == "Bifocal") && (theform.ladd_power.value.length == 0)) {
		alert( "Please enter Add Power");
		theform.ladd_power.focus();
		return false
    }

	// SINGLE VISION LENS, SHOULD NOT ADD POWER
    if ((theform.lens_type2.value == "Single Vision") && (theform.ladd_power.value.length != 0)) {
		alert( "Add Power only available for Bifocal lens only");
		theform.ladd_power.focus();
		return false
    }

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}

function ValidateConsultantStep4rigidboth(theform) {

   	// MUST ENTER FLAT K
	if (theform.rflatk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.rsteepk.value.length == 0) {
		alert( "Please enter Flat K (Right Eye)");
		theform.rsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.rspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Right Eye)");
		theform.rspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.rcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Right Eye)");
		theform.rcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.raxis.value.length == 0) {
		alert( "Please enter Axis (Right Eye)");
		theform.raxis.focus();
		return false
	}

	// BIFOCAL LENS, MUST ENTER ADD POWER
    if ((theform.lens_type2.value == "Bifocal") && (theform.radd_power.value.length == 0)) {
		alert( "Please enter Add Power (Right Eye)");
		theform.radd_power.focus();
		return false
    }

	// SINGLE VISION LENS, SHOULD NOT ADD POWER
    if ((theform.lens_type2.value == "Single Vision") && (theform.radd_power.value.length != 0)) {
		alert( "Add Power only available for Bifocal lens only (Right Eye)");
		theform.radd_power.focus();
		return false
    }

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.rprecond[0].checked == false) && (theform.rprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Right Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.rprecond[1].checked == true) && (theform.rprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Right Eye)");
        theform.rprecond_explain.focus();
        return false
    }

   	// MUST ENTER FLAT K
	if (theform.lflatk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lflatk.focus();
		return false
	}

   	// MUST ENTER STEEP K
	if (theform.lsteepk.value.length == 0) {
		alert( "Please enter Flat K (Left Eye)");
		theform.lsteepk.focus();
		return false
	}

   	// MUST ENTER SPHERICAL POWER
	if (theform.lspherical_power.value.length == 0) {
		alert( "Please enter Spherical Power (Left Eye)");
		theform.lspherical_power.focus();
		return false
	}

   	// MUST ENTER CYLINDER POWER
	if (theform.lcylinder_power.value.length == 0) {
		alert( "Please enter Cylinder Power (Left Eye)");
		theform.lcylinder_power.focus();
		return false
	}

   	// MUST ENTER AXIS
	if (theform.laxis.value.length == 0) {
		alert( "Please enter Axis (Left Eye)");
		theform.laxis.focus();
		return false
	}

	// BIFOCAL LENS, MUST ENTER ADD POWER
    if ((theform.lens_type2.value == "Bifocal") && (theform.ladd_power.value.length == 0)) {
		alert( "Please enter Add Power (Left Eye)");
		theform.ladd_power.focus();
		return false
    }

	// SINGLE VISION LENS, SHOULD NOT ADD POWER
    if ((theform.lens_type2.value == "Single Vision") && (theform.ladd_power.value.length != 0)) {
		alert( "Add Power only available for Bifocal lens only (Left Eye)");
		theform.ladd_power.focus();
		return false
    }

	// MUST INDICATE WHETHER PREEXISTING CONDITIONS EXIST
    if ((theform.lprecond[0].checked == false) && (theform.lprecond[1].checked == false)) {
        alert("Please indicate whether Preexisting Conditions exist (Left Eye)");
        return false
    }

	// PREEXISTING CONDITIONS CHECKED, MUST ENTER EXPLANATION
    if ((theform.lprecond[1].checked == true) && (theform.lprecond_explain.value.length == 0)) {
        alert("Please enter Explanation (Left Eye)");
        theform.lprecond_explain.focus();
        return false
    }

    return true
}
