

function funcSubmit() {

fieldsToFill = 16;

fieldsToCount = fieldsToFill - 1;

x = 0; // just to use as a counter

errs = 0; // number of blank fields

while(x <= fieldsToCount){

 if(document.srchfrm.elements[x].value == ""){

  errs++;

 }

 x++;

}

if(errs == 12){

 alert('Your search form is blank.  Please fill in at least one field.');
 
 document.srchfrm.Pty.focus(); 

 return false; 

} 
  

  if((document.srchfrm.Rptr.value != '') || ((document.srchfrm.OffVol.value != '') || (document.srchfrm.OffPage.value != ''))) {

	if((document.srchfrm.Rptr.value == '') || ((document.srchfrm.OffVol.value == '') || (document.srchfrm.OffPage.value == ''))) {
		
		alert('Please Enter Complete Official Reports Citation.');
	
		document.srchfrm.OffVol.focus(); 
	
	    	return false; 
	
	}
	
  }  

  
  if((document.srchfrm.slipYear.value != '') && (document.srchfrm.slipNo.value == '')) {

	alert('Please Enter Slip Opinion Number.');

	document.srchfrm.slipNo.focus(); 

    return false; 

  } 
  
  if((document.srchfrm.Pty.value != '') && (document.srchfrm.fullText.value != ''))
  {
  
  	alert('You cannot search on both Party Name and Full Text. Please enter EITHER Party Name OR  Full Text.');
  
  	document.srchfrm.Pty.focus(); 
  
        return false; 
  
  } 
 //*** CR 24117 (IE) *** 
 var vStartDate= document.srchfrm.dtStartDate.value;
 var vEndDate= document.srchfrm.dtEndDate.value; 
 if ( (vStartDate != "") && (vEndDate != "") )
 {
	// get the value of the month (Jan = 0, Feb = 1, ... in the Date() object 
	var iStartMonth = vStartDate.substring(0, 2) - 1;
	var iEndMonth   = vEndDate.substring(0, 2) - 1;

	var dtFirstDate  = new Date(vStartDate.substring(6, 10),iStartMonth,vStartDate.substring(3, 5));
    var dtSecondDate = new Date(vEndDate.substring(6, 10),iEndMonth,vEndDate.substring(3, 5));
    
    if (dtFirstDate >= dtSecondDate)
    {
        alert('Start Date must be BEFORE End Date.');
        return false;
    }
 }
 return true; 
}

function funcCheckDate(objName) {
	var datefield = objName;
	if ((datefield.value != "") && (isDate(datefield.value,"MM/dd/yyyy") == false)) {
		alert("That date is invalid.  (Please be sure the format is mm/dd/yyyy.)  Please try again.");
		datefield.select();
		datefield.focus();
		return false;
	}

}


function funcZeroPad(objName) {
	var numfield = objName.value;
	var j = numfield.length;
	if ((!isNaN(numfield)) && (j > 0)) {
  		for (i=0; i < 5-j; i++) { 
  			numfield = "0" + numfield;
  		}
		objName.value=numfield;  		
  	}

}




