
<!--
var lastnotify2, notify;

function confirmClass( NumDays, StartTime ){
	//alert(classInfo + ":" + StartTime);
	if(NumDays == 0) {
		var c = confirm("Class starts today @ " + StartTime + ". Are you sure you want to attend this class?" );
	} else {
		var c = confirm("Are you sure you want to attend this class?" );
	}
	if (c) document.form1.submit();
}

function checkForm(){
var thedate=new Date();
var nyear=thedate.getYear();
var nmonth=thedate.getMonth();
var ndate=thedate.getDate();
var fm;
var err = 0 ;
alertMsg = "Please correct the following entries: \n";

//Miscellaneous error
if ((document.form1.violationcode.value.substring(0,9) == '28-70102A') || (document.form1.violationcode.value.substring(0,5) == 'OTHER')){
	alert("You may not register online for violations 28-70102A1, 28-70102A2, or 28-70102A3. Please contact Arizona Traffic Schools at 1-866-877-2724 for more information.");
	return false;
}


//Form field entry errors
if(document.form1.iss_agency.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n ARIZONA TRAFFIC TICKET AND COMPLAINT:  Please tell us which agency filed the ticket.";
}

if(document.form1.ticketnum.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n COMPLAINT (Citation #):  Please provide your complaint number.";
}

if(document.form1.photo.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n PHOTO CITATION:  Please indicate whether this was a photo citation.";
}

if(document.form1.deliveredby.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n CITATION DELIVERED BY:  Please indicate how the citation was delivered.";
}

if(document.form1.accident.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n ACCIDENT INVOLVED:  Please indicate if an accident was involved.";
}

if(document.form1.injury.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n SERIOUS INJURY IN ACCIDENT:  Please indicate if an accident involving a serious injury occurred.";
}

if(document.form1.fatality.value.length < 1){
	err=1;
	alertMsg = alertMsg + "\n FATALITY/DEATH IN ACCIDENT:  Please indicate if an accident involving a fatality occurred.";
}

if(document.form1.courtordered.value.length < 1){
		err=1;
		alertMsg = alertMsg + "\n COURT ORDERED:  Please indicate if a court order was issued to you to attend the class.";
}

if(document.form1.dlnum.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n DRIVER'S LICENSE NUMBER:  Please enter your driver's license number.";
}

if(document.form1.dlstate.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n STATE (Drivers License State):  Please tell us in which state your drivers licence was issued.";
}

if(document.form1.cdl.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n CLASS:  Please indicate if you are classed to drive commercial vehicles.";
}

if(document.form1.fname.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n NAME: FIRST:  Please enter your first name.";
}

if(document.form1.lname.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n LAST:  Please enter your last name.";
}

if(document.form1.phone_ac.value.length<3 || document.form1.phone_1.value.length<3 || document.form1.phone_2.value.length<4){
	err=1;
	alertMsg = alertMsg + "\n PHONE:  Please check if your phone number is correct.";
}	

if(document.form1.street.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n RESIDENTIAL ADDRESS:  Please enter your street address.";
}	

if(document.form1.city.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n CITY:  Please enter your city.";
}	

if(document.form1.state.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n STATE (Your Home Address):  Please enter your state.";
}	

if(document.form1.zip.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n ZIP CODE:  Please enter your zip code.";
}	

if(document.form1.dob_m.value<1 || document.form1.dob_d.value<1 || document.form1.dob_y.value<1){
	err=1;
	alertMsg = alertMsg + "\n DATE OF BIRTH:  Please check if your date of birth is correct.";
}

if(document.form1.issuedate_m.value<1 || document.form1.issuedate_d.value<1 || document.form1.issuedate_y.value<1){
	err=1;
	alertMsg = alertMsg + "\n DATE (MO/DAY/YR):  Please check if the issue date of the ticket is correct.";
}

if(document.form1.violationcode.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n SECTION:  Please enter a Citation Section Number (Violation Code).";
}

if(document.form1.newcourtid.value.length<1){
	err=1;
	alertMsg = alertMsg + "\n COURT NUMBER:  Please enter to which Court you were to appear.";
}

if(document.form1.courtdate_m.value<1 || document.form1.courtdate_d.value<1 || document.form1.courtdate_y.value<1){
	err=1;
	alertMsg = alertMsg + "\n AT THE DATE AND TIME INDICATED:  Please check if the court date is correct.";
}


//Error Response
if(err>0){
	alert(alertMsg);
	return false;
}
else{
	return true;
}
}

function checkAccident()
{
	if (document.form1.accident.value == '0') {
		document.forms.form1.fatality.value=0;
		document.forms.form1.injury.value=0;
		document.forms.form1.courtordered.value=0;
	}
	else {
		document.forms.form1.fatality.value="";
		document.forms.form1.injury.value="";
		document.forms.form1.courtordered.value="";
	}
}

function checkInjury()
{
	if ((document.form1.injury.value == '1') && (document.form1.accident.value == '1')) {
		if(!confirm('Drivers who commit violations which involve a serious injury or fatality/death may not take traffic school without receiving a court order.\n\nClick OK if you have received a court order to take defensive driving for this offense.\n\nClick CANCEL if you have NOT received a court order to take defensive driving for this offense.')) {
			document.forms.form1.injury.value="0";
			document.forms.form1.courtordered.value="0";
		} else {
			document.forms.form1.courtordered.value="1";
		}
	}
	if (document.form1.accident.value == '0') {
		document.forms.form1.injury.value=0;
		document.forms.form1.courtordered.value=0;
	}
}

function checkFatality()
{
	if ((document.form1.fatality.value == '1') && (document.form1.accident.value == '1')) {
		if(!confirm('Drivers who commit violations which involve a serious injury or fatality/death may not take traffic school without receiving a court order.\n\nClick OK if you have received a court order to take defensive driving for this offense.\n\nClick CANCEL if you have NOT received a court order to take defensive driving for this offense.')) {
			document.forms.form1.fatality.value="0";
			document.forms.form1.courtordered.value="0";
		} else {
			document.forms.form1.courtordered.value="1";
		}
	}
	if (document.form1.accident.value == '0') {
		document.forms.form1.fatality.value=0;
	}
}

function checkCdl()
{
	if (document.form1.cdl.value == 'Y') {
		if(!confirm('Drivers who posses commercial licenses cannot take traffic school for any violation without receiving a court order.\n\nIf you are not sure that you have a CDL license, click CANCEL.\n\nIf you DO have a CDL license, and have gotten a court order to take defensive driving for this offense, click OK."')) {
			document.forms.form1.cdl.value="0";
		} else {
				document.forms.form1.courtordered.value="1";
			}
	}
}

function Changecode(form)
{	
	if (form.courtnum.value.substring(0,5) == 'OTHER')
	{
		if (notify != 1)
		{
		alert('Sorry, Arizona Traffic Schools only supports the courts listed on this registration form.');
		notify = 1;
		};
	}
	else
	{
	notify = 0;
	};
	
	if ((form.cnumb.value.substring(0,9) == '28-70102A') || (form.cnumb.value.substring(0,5) == 'OTHER'))
	{
		if (form.cnumb.value.substring(0,10) != lastnotify2)
		{
			alert('You may not register online for this violation. Please contact Arizona Traffic Schools at 1-866-877-2724 for more information.');
			lastnotify2 = form.cnumb.value.substring(0,10);
		};
	}
	else
	{
	lastnotify2 = '';
	};
};

//-->
