// Redirect page
 function redirectPage(A) {
 var newurl=A;
 window.location.href="http://"+A;
 return true;
 }

// first page newload
 function NewLoad() {
  var loc1='CF/WVCF?qid=CFShp';
  location = loc1 ;
 }

// Start main menu options 
                                                                                                       
// Login - registered                                                                                  
function logbox(A,B) {
  var e1 = 0;
  var m1 = "";				 
	var l=A.value;
	var p=B.value;
	// error handling 	if (s1=="0" || s3=="" ){
if (l==null||l=="" || p==null||p==""){ e1=1; m1="Userid and Password must be entered";} ;
// alert if error
  if (e1==1) { alert(m1) ; return false; }
// else continue 
	var loc1='WVCF?qid=CFShp&IsLogin=&Login='+l;
	var loc2='&Password='+p;
	location=loc1+loc2;
	return true;
}	
function logboxhtml(A, B) {
  var e1 = 0;
  var m1 = "";				 
	var l=A.value;
	var p=B.value;
	// error handling 	
if (l==null||l=="" || p==null||p==""){ e1=1; m1="Userid and Password must be entered";} ;
// alert if error
  if (e1==1) { alert(m1) ; return false; }
// else continue 
	var loc1='CF/WVCF?qid=CFShp&IsLogin=&Login='+l;
	var loc2='&Password='+p;
	location=loc1+loc2;
	return true;
}	
	
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'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

	function sendscript(rvityp,rvidoc) {
	var loc1 = 'CFView1.jsp?ISYS=1';
	var loc2 = '&I7=';
	var var2 = rvityp ;
	var loc3 = '&I1=';
	var var3 = (rvidoc.substr(0,3))+(rvidoc.substr(4,10)) ;
	location = loc1 + loc2 + var2 + loc3 + var3 ;
		}
	
	function shp_date(form) {
	var loc1 = 'WVCF?qid=' ;
	var var1 = '';
	for (ci = 0; ci < 3; ci++){if (form.radio1[ci].checked) break ;}
	if (ci==0){var1='CFShp1a'};if (ci==1){var1='CFShp1b'};if (ci==2){var1='CFShp1c'};
	var loc2 = '&custNum=' ;
	var ani  = form.AccNum.selectedIndex;
	var var2a = form.AccNum.options[ani].text ;
	var var2 = var2a.substring(0,7);
	var loc3 = '&date1=' ;
	var var3a = form.stDate.value;
	var var3 = '1'+ var3a.substr(4,6) + var3a.substr(0,2)+ var3a.substr(2,2);
	var loc4 = '&custNam=' ;
	var var4 = var2a.substring(8,33);
	location = loc1 + var1 + loc2 + var2 + loc3 + var3 + loc4 + var4 ;
	  }	

function shp_trace(form) {
	var loc1 = 'WVCF?qid=';
	var loc3 = '';
	var i = form.qid.selectedIndex;
	var var1 = form.qid.options[i].value ;
	 if (i==0){
	  if (isNaN(form.orgNum.value)) {
		 document.cfsendscript.orgNum.focus();
	   alert("Invalid Origin Term");
	   return false; 
		 }
	  if ((form.orgNum.value)==" "||(form.orgNum.value)==null|| (form.orgNum.value).length !=3) {
		 document.cfsendscript.orgNum.focus();
	   alert("Invalid Origin Term");
	   return false; 
		 }
	  if (isNaN(form.docNum.value)) {
		 document.cfsendscript.docNum.focus();
	   alert("Invalid Pro Number");
	   return false; 
		 }	
	  if ((form.docNum.value)==" "||(form.docNum.value)==null) {
		 document.cfsendscript.docNum.focus();
	   alert("Invalid Pro Number");
	   return false; 
		 }		 	 		 
	  loc3 = '&orgNum=' + form.orgNum.value ;
	 } 
	var loc2 = '&docNum=' + form.docNum.value;
	var loc4 = '&WhoID=demo'; 
	location = loc1 + var1 + loc2 + loc3 ;
	}					

function shp_trace2(form) {
	var loc1 = 'WVCF?qid=CFPro5';
	var loc3 = '';
	var i = 0 ;
	 if (i==0){
	  if (isNaN(form.orgNum.value)) {
		 document.cfsendscript.orgNum.focus();
	   alert("Invalid Origin Term");
	   return false; 
		 }
	  if ((form.orgNum.value)==" "||(form.orgNum.value)==null|| (form.orgNum.value).length !=3) {
		 document.cfsendscript.orgNum.focus();
	   alert("Invalid Origin Term");
	   return false; 
		 }
	  if (isNaN(form.docNum.value)) {
		 document.cfsendscript.docNum.focus();
	   alert("Invalid Pro Number");
	   return false; 
		 }	
	  if ((form.docNum.value)==" "||(form.docNum.value)==null) {
		 document.cfsendscript.docNum.focus();
	   alert("Invalid Pro Number");
	   return false; 
		 }		 	 		 
	  loc3 = '&orgNum=' + form.orgNum.value ;
	 } 
	var loc2 = '&docNum=' + form.docNum.value;
	var loc4 = '&WhoID=demo'; 
	location = loc1 + loc2 + loc3 ;
	}			
	
	function chkform(form) {
	var e1=0;    var m1=""; 	var vi=0;
	var a01=form.a01.value;	var a02=form.a02.value;
	var a03=form.a03.value;	var a04=form.a04.value;
	var a05=form.a05.value;	 
	var a07=form.a07.value;	 
	var a09=form.a09.value;	 
	var a11=form.a11.value;	var a12=form.a12.value;
	var a13=form.a13.value;	var a14=form.a14.value;
	var a15=form.a15.value;	 
	var a17=form.a17.value;	var a18=form.a18.value;
	var a19=form.a19.value;	var a20=form.a20.value;
	var a21=form.a21.value;	var a22=form.a22.value;
	var a23=form.a23.value;	var a24=form.a24.value;
	var a25=form.a25.value;	var a26=form.a26.value;
	var a27=form.a27.value;	var a28=form.a28.value;
	var a29=form.a29.value;	var a30=form.a30.value;
	var a31=form.a31.value;	var a32=form.a32.value;
	var a33=form.a33.value;	var a34=form.a34.value;
	var a35=form.a35.value;	var a36=form.a36.value;
	var a37=form.a37.value;	var a38=form.a38.value;
	var a39=form.a39.value;	var a40=form.a40.value;
	var a41=form.a41.value;	var a42=form.a42.value;
	var a43=form.a43.value;	var a44=form.a44.value;
	var a45=form.a45.value;	var a46=form.a46.value;
	var a47=form.a47.value;	var a48=form.a48.value;
	var a49=form.a49.value;	var a50=form.a50.value;
	var a51=form.a51.value; var a52=form.a52.value;
	var a53=form.a53.value; var a54=form.a54.value;
	var a55=form.a55.value; var a56=form.a56.value;
	var a57=form.a57.value; var a58=form.a58.value;
	var a59=form.a59.value; var a60=form.a60.value;
	var a61=form.a61.value; var a62=form.a62.value;
	var a63=form.a63.value; var a64=form.a64.value;
	var a65=form.a65.value; var a66=form.a66.value;
	var a67=form.a67.value; var a68=form.a68.value;
	var a69=form.a69.value; var a70=form.a70.value;
	var a71=form.a71.value; var a72=form.a72.value;
	 
	var vi=(form.i01.selectedIndex);	var i01=(form.i01.options[vi].value);
	var vi=(form.i02.selectedIndex);	var i02=(form.i02.options[vi].value);
	var vi=(form.i03.selectedIndex);	var i03=(form.i03.options[vi].value);
	var vi=(form.i04.selectedIndex);	var i04=(form.i04.options[vi].value);
	var vi=(form.i05.selectedIndex);	var i05=(form.i05.options[vi].value);
	var vi=(form.i06.selectedIndex);	var i06=(form.i06.options[vi].value);
	var vi=(form.i07.selectedIndex);	var i07=(form.i07.options[vi].value);
	var vi=(form.i08.selectedIndex);	var i08=(form.i08.options[vi].value);
	var vi=(form.i09.selectedIndex);	var i09=(form.i09.options[vi].value);
	var vi=(form.i10.selectedIndex);	var i10=(form.i10.options[vi].value);
	var vi=(form.i11.selectedIndex);	var i11=(form.i11.options[vi].value);
	var vi=(form.i12.selectedIndex);	var i12=(form.i12.options[vi].value);
	var vi=(form.i13.selectedIndex);	var i13=(form.i13.options[vi].value);
	var vi=(form.i14.selectedIndex);	var i14=(form.i14.options[vi].value);
	var vi=(form.i15.selectedIndex);	var i15=(form.i15.options[vi].value);
	var vi=(form.i16.selectedIndex);	var i16=(form.i16.options[vi].value);
	var vi=(form.i17.selectedIndex);	var i17=(form.i17.options[vi].value);
	var vi=(form.i18.selectedIndex);	var i18=(form.i18.options[vi].value);
	
  if (a01=="null" || a01==""){ e1=1; m1="First name is required";} ;
	// if (a02=="null" || a01==""){ e1=1; m1="  selection is required";} ;
	if (a03=="null" || a03==""){ e1=1; m1="Last name is required";} ;
	if (a04=="null" || a04==""){ e1=1; m1="Street address is required";} ;
	if (a05=="null" || a05==""){ e1=1; m1="City is required";} ;
	if (i01=="null" || i01==""){ e1=1; m1="Select a address state";} ;
	// if (a06=="null" || a06==""){ e1=1; m1=" ";} ;
	if (a07=="null" || a07==""){ e1=1; m1="Zip code is required";} ;
	// if (a08=="null" || a08==""){ e1=1; m1="";} ;
	if (i02=="null" || i02==""){ e1=1; m1="Birth date Month?";} ;
	if (i03=="null" || i03==""){ e1=1; m1="Birth date Day?";} ;
	if (i04=="null" || i04==""){ e1=1; m1="Birth date Year?";} ;
	if (a09=="null" || a09==""){ e1=1; m1="Birth City is required";} ;
	if (i05=="null" || i05==""){ e1=1; m1="Birth State?";} ;
	// if (a10=="null" || a10==""){ e1=1; m1="";} ;
	if (a11=="null" || a11==""){ e1=1; m1="Social Security is required";} ;
	if (a12=="null" || a12==""){ e1=1; m1="License Number  is required";} ;
	if (a13=="null" || a13==""){ e1=1; m1="Home Phone is required";} ;
	// if (a14=="null" || a14==""){ e1=1; m1="Cell Phone is required";} ;
	// if (a15=="null" || a15==""){ e1=1; m1="How did you hear is required";} ;
	// if (a16=="null" || a16==""){ e1=1; m1="";} ;
	if (i06=="null" || i06==""){ e1=1; m1="Company or Owner Operator?";} ;
	if (i07=="null" || i07==""){ e1=1; m1="Date Available Month?";} ;
	if (i08=="null" || i08==""){ e1=1; m1="Date Available Day?";} ;
	if (i09=="null" || i09==""){ e1=1; m1="Date Available year?";} ;
	if (a17=="null" || a17==""){ e1=1; m1="Education and Training is required";} ;
	if (a18=="null" || a18==""){ e1=1; m1="Years of experience is required";} ;
	if (i10=="null" || i10==""){ e1=1; m1="Moving Violations Y/N?";} ;	
	// if (a19=="null" || a19==""){ e1=1; m1="Moving Violation is required";} ;
	if (i11=="null" || i11==""){ e1=1; m1="Accidents Y/N?";} ;	
	// if (a20=="null" || a20==""){ e1=1; m1="Accident listing is required";} ;
	if (i12=="null" || i12==""){ e1=1; m1="License suspensions Y/N?";} ;	
	// if (a21=="null" || a21==""){ e1=1; m1="License Suspension is required";} ;
	if (i13=="null" || i13==""){ e1=1; m1="Felony conviction Y/N?";} ;
	// if (a22=="null" || a22==""){ e1=1; m1="Felony explanation  is required";} ;
	if (i14=="null" || i14==""){ e1=1; m1="Drug or Alcohol test refusal Y/N?";} ;
	// if (a23=="null" || a23==""){ e1=1; m1="Drug conviction is required";} ;
	if (i15=="null" || i15==""){ e1=1; m1="Discharged Y/N?";} ;	
	// if (a24=="null" || a24==""){ e1=1; m1="Period of unemployment is required";} ;
	if (a25=="null" || a25==""){ e1=1; m1="No employment record?";} ;	
	if (i16=="null" || i16==""){ e1=1; m1="Worked for Caldwell previously Y/N?";} ;	
	if (i17=="null" || i17==""){ e1=1; m1="Axel type?";} ;
	if (i18=="N" ){ e1=1; m1="To process this Application you must agree to the terms";} ;
// alert if error
  if (e1==1) { alert(m1) ; 
	return false;  
// else 
	} else {
// continue
	  document.dappform.submit();
		return true;
  }
}

function homeform() {
		var l1="http://www.caldwellfreight.com";
		location=l1;
		return true;		 
}		
