//***  UL Forms
//*** 
//***  Updated 
//***  2003-08-27 changed call from mailer.pl to mailer.asp
//***  2007-10-24 changed script from atlis.net/asp/mailer.asp to universallogistics.ca/formsend/formsend.asp
//***  2008-09-29 CC Wolfgang on Contact Us page.
//***
//*** help-callme.html       
//*** help-maillist.html   
//*** help-consult.html
//*** help-seminar.html   
//*** help-suggest.html   
//*** help-refer.html      
//*** help-alerts.html 
//*** contact.html
//*** quote-dist.html
//*** quote-air.html
//*** quote-ocean.html
//*** quote-truck.html
//*** quote-cust.html  
//*** clients-passw.html      
	 
	var g_form = true; 
//*** 
//***  Trick to dynamically get the file name of the displayed page.
//*** 
	var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
	var thefile = location.href.substring(dir.length,location.href.length+1);
	
function doClear ( form ) {	
//******************************************************************************* 
//  Clear button on forms
//******************************************************************************* 	
 	document.form0.onReset = " return confirm('Are you sure that you want to clear all the data you have entered on this form?')";
  	document.form0.reset();	
}


function doForm ( form ) {	
//******************************************************************************* 
//  Validate form. Common rtn for forms.
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var len;
	var emailid = ""; // used when recipient varies depending on form or selected options (eg consult-direct.html)
	var subj = "Universal Logistics"; // Subject line on email. This will be replaced programmatically.
 
//*********************************
//*** EXISTING UL CLIENT
//*********************************
if (thefile != "clients-passw.html") {
//* RADIOS
	if (document.form0.Existing_UL_Client[0].checked ||
		document.form0.Existing_UL_Client[1].checked ) {	}
  		else {errormessage=errormessage+"Existing client?\n"}      	
} 

//*********************************
//*** QUOTE - CUST BROKERAGE
//*********************************
if (thefile == "quote-cust.html") { 
//*** 1  Handling
	if (document.form0.Cust_Brokerage_Handling[0].checked ||
		document.form0.Cust_Brokerage_Handling[1].checked ||
		document.form0.Cust_Brokerage_Handling[2].checked ||
		document.form0.Cust_Brokerage_Handling[3].checked ) {	}
  		else {errormessage=errormessage+"1. Customs Brokerage Handling\n"}	
  		
	if (document.form0.Cust_Brokerage_Handling[3].checked) 	{	
		//* Cust_Brokerage_Handling_Other *********************
		minlength = 3; fieldblank=true;
	    for (j=0; j < document.form0.Cust_Brokerage_Handling_Other.value.length; j++) 
	    {
	      if (document.form0.Cust_Brokerage_Handling_Other.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Cust_Brokerage_Handling_Other.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"1. Customs Brokerage Handling: Other\n"} 
	}
  		
//*** 2  Importer_Type RADIOS 
	if (document.form0.Importer_Type[0].checked ||
		document.form0.Importer_Type[1].checked ) {	}
  		else {errormessage=errormessage+"2. Importer Type\n"}
	 
	
//*** 3  Business_Number RADIOS 
	if (document.form0.Business_Number[0].checked ||
		document.form0.Business_Number[1].checked ) {	}
  		else {errormessage=errormessage+"3. Business Number\n"}
		 		
//*** 3a  IF BUSINESS NUMBER = YES
	if (document.form0.Business_Number[0].checked) 	{	
		 //* Business_No
		minlength = 5; fieldblank=true;
	    for (j=0; j < document.form0.Business_No.value.length; j++) 
	    {
	      if (document.form0.Business_No.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Business_No.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"3a. Business Number\n"} 
	      	
//*** 3b  Business_No_RM RADIOS 
		if (document.form0.Business_No_RM[0].checked ||
			document.form0.Business_No_RM[1].checked ) {	}
	  		else {errormessage=errormessage+"3b. Business Number RM\n"}	   
	
//*** 3c  Business_No_RT RADIOS 
		if (document.form0.Business_No_RT[0].checked ||
			document.form0.Business_No_RT[1].checked ) {	}
	  		else {errormessage=errormessage+"3c. Business Number RT\n"}	   		   		      	
	      	
	} //* END: IF BUSINESS NUMBER = YES
	
//*** 4   Annual_Shipment_Volume
		minlength = 2; fieldblank=true;
	    for (j=0; j < document.form0.Annual_Shipment_Volume.value.length; j++) 
	    {
	      if (document.form0.Annual_Shipment_Volume.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Annual_Shipment_Volume.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"4. Annual Shipment Volume\n"} 	

//*** 6   Avg_Canadian_Dollar_Value
		minlength = 2; fieldblank=true;
	    for (j=0; j < document.form0.Avg_Canadian_Dollar_Value.value.length; j++) 
	    {
	      if (document.form0.Avg_Canadian_Dollar_Value.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Annual_Shipment_Volume.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"6. Avg Canadian Dollar Value\n"} 
	      	
//*** 8   Volume Percentage - Origin	      	
	    if (document.form0.Freight_Originate_US.value == "" & 
	    	document.form0.Freight_Originate_UK.value == "" &
	    	document.form0.Freight_Originate_Europe.value == "" &
	    	document.form0.Freight_Originate_FarEast.value == "" &
	    	document.form0.Freight_Originate_Other.value == "")
	  	  {errormessage=errormessage+"8. Volume Percentage - Origin\n"}  		  	  
	  	  
//*** 9   Volume Percentage - Destination	      	
	    if (document.form0.Freight_Destination_Ontario.value == "" & 
	    	document.form0.Freight_Destination_Quebec.value == "" &
	    	document.form0.Freight_Destination_Central_Canada.value == "" &
	    	document.form0.Freight_Destination_Western_Canada.value == "" &
	    	document.form0.Freight_Destination_Maritimes.value == "")
	  	  {errormessage=errormessage+"9. Volume Percentage - Destination\n"} 	  	  	  	      	

//*** 10   Nature of Imported Goods  Nature_of_Imported_Goods
		minlength = 5; fieldblank=true;
	    for (j=0; j < document.form0.Nature_of_Imported_Goods.value.length; j++) 
	    {
	      if (document.form0.Nature_of_Imported_Goods.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Nature_of_Imported_Goods.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"10. Nature of Imported Goods\n"} 
	      	
//*** 11   Product(s) Dutiable? 
	if (document.form0.Products_Dutiable[0].checked ||
		document.form0.Products_Dutiable[1].checked ) {	}
  		else {errormessage=errormessage+"11. Product(s) Dutiable?\n"}	      	  		

//*** 11a  IF Dutiable = YES
	if (document.form0.Products_Dutiable[0].checked) 	{	
		 //* Duty_Rate
		minlength = 2; fieldblank=true;
	    for (j=0; j < document.form0.Duty_Rate.value.length; j++) 
	    {
	      if (document.form0.Duty_Rate.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Duty_Rate.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"11. Duty Rate\n"} 
	}	

//*** 12    NAFTA_Preferential
	if (document.form0.NAFTA_Preferential[0].checked ||
		document.form0.NAFTA_Preferential[1].checked ) {	}
  		else {errormessage=errormessage+"12. Preferential duty rates under NAFTA?\n"}	      	  		

//*** 12a  IF NAFTA_Preferential = YES
	if (document.form0.NAFTA_Preferential[0].checked) 	{
		if (document.form0.NAFTA_Certificates[0].checked ||
			document.form0.NAFTA_Certificates[1].checked ) {	}
	  		else {errormessage=errormessage+"12. NAFTA Certificates of Origin??\n"}		
	}			      	  		

//*** 13   Subject_to_GST
	if (document.form0.Subject_to_GST[0].checked ||
		document.form0.Subject_to_GST[1].checked ) {	}
  		else {errormessage=errormessage+"13. Subject to GST?\n"}

//*** 15   Unique_Service_Requirements
	if (document.form0.Unique_Service_Requirements[0].checked ||
		document.form0.Unique_Service_Requirements[1].checked ||
		document.form0.Unique_Service_Requirements[2].checked ) {	}
  		else {errormessage=errormessage+"15. Unique Service Requirements?\n"} 

//*** 15a  IF Unique_Service_Requirements = YES
	if (document.form0.Unique_Service_Requirements[0].checked) 	{	
		minlength = 5; fieldblank=true;
	    for (j=0; j < document.form0.Unique_Service_Specs.value.length; j++) 
	    {
	      if (document.form0.Unique_Service_Specs.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Unique_Service_Specs.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"15a. Unique Service Requirements\n"} 
	}  		 		  			

//*** 16   Familiar_Direct_Payment_Options
	if (document.form0.Familiar_Direct_Payment_Options[0].checked ||
		document.form0.Familiar_Direct_Payment_Options[1].checked ) {	}
  		else {errormessage=errormessage+"16. Familiar with Duty and GST Direct Payment Options?\n"}
  		
//*** 17  Prefer_One_Service_Provider
	if (document.form0.Prefer_One_Service_Provider[0].checked ||
		document.form0.Prefer_One_Service_Provider[1].checked ) {	}
  		else {errormessage=errormessage+"17. Prefer one service provider?\n"}  	

//*** 17a  IF Prefer_One_Service_Provider = YES
	if (document.form0.Prefer_One_Service_Provider[0].checked) 	{
	 	if (document.form0.Freight_Lanes1.checked == 0 &
	 	 	document.form0.Freight_Lanes2.checked == 0 & 
	 	 	document.form0.Freight_Lanes3.checked == 0 & 
	 	 	document.form0.Freight_Lanes4.checked == 0 & 
	 	 	document.form0.Freight_Lanes5.checked == 0)   
	 			{errormessage=errormessage+"17a. Freight Lanes Preference\n"} 
	 	//** Other 	
	 	if (document.form0.Freight_Lanes5.checked == 1) {
			minlength = 4; fieldblank=true;
		    for (j=0; j < document.form0.Freight_Lanes_Other.value.length; j++) 
		    {
		      if (document.form0.Freight_Lanes_Other.value.substring(j,j+1) !=" ") {fieldblank=false}
		    }
		    if (document.form0.Freight_Lanes_Other.value.length < minlength || fieldblank)
		      	{errormessage=errormessage+"17a. Freight Lanes Preference: Other\n"}		 	 
	 	 }
	}  			
  		
} //*** END quote-cust.html  **** QUOTE - CUST BROKERAGE

//*********************************
//*** QUOTE - DISTRIBUTION
//*********************************
if (thefile == "quote-dist.html") { 
 	if (document.form0.Distrib_Service1.checked == 0 &
 	 	document.form0.Distrib_Service2.checked == 0 & 
 	 	document.form0.Distrib_Service3.checked == 0 & 
 	 	document.form0.Distrib_Service4.checked == 0 & 
 	 	document.form0.Distrib_Service5.checked == 0 & 
 	 	document.form0.Distrib_Service6.checked == 0 & 
 	 	document.form0.Distrib_Service_Other.value == "" )    
 	{errormessage=errormessage+"Distribution Service Required\n"}  

  		
} //*** End quote-dist.html
 
//*********************************
//*** QUOTE - AIR, OCEAN & TRUCK SERVICES
//*********************************
if (thefile == "quote-air.html" || thefile == "quote-ocean.html" || thefile == "quote-truck.html") { 

if (thefile == "quote-air.html" || thefile == "quote-ocean.html") {    	
//* Shipment_Terms RADIOS 
	if (document.form0.Shipment_Terms[0].checked ||
		document.form0.Shipment_Terms[1].checked ||
		document.form0.Shipment_Terms[2].checked ||
		document.form0.Shipment_Terms[3].checked ) {	}
  		else {errormessage=errormessage+"Terms of Shipment \n"}
}
//if (thefile == "quote-air.html" || thefile == "quote-truck.html") {     
//* Freight_Payment RADIOS
	if (document.form0.Freight_Payment_Terms[0].checked ||
		document.form0.Freight_Payment_Terms[1].checked ) {	}
  		else {errormessage=errormessage+"Freight Payment Terms\n"}
//}  		
//* Equipment Requirements  

if (thefile == "quote-ocean.html") {
//*  
	if (document.form0.Equipment_Requirements[0].checked ||
		document.form0.Equipment_Requirements[1].checked ) {
			//* if FCL
			if (document.form0.Equipment_Requirements[1].checked ) {
			
//				if (document.form0.Container_Type[0].checked ||
//					document.form0.Container_Type[1].checked ) {
					//* if Non-Stadard
//					if (document.form0.Container_Type[1].checked) {	
						
							if (document.form0.Container_Type[0].checked ||
								document.form0.Container_Type[1].checked ||
								document.form0.Container_Type[2].checked ||
								document.form0.Container_Type[3].checked ||
								document.form0.Container_Type[4].checked ||
								document.form0.Container_Type[5].checked ||
								document.form0.Container_Type[6].checked ||
								document.form0.Container_Type[7].checked ||
								document.form0.Container_Type[8].checked ) { }
		
		  					else {errormessage=errormessage+"Equipment Requirements: Container Type\n"} 
					}
//				}//* if Non-Stadard
//	  			else {errormessage=errormessage+"Equipment Requirements: Container Type\n"} 	
//				}
			} //* if FCL
  		else {errormessage=errormessage+"Equipment Requirements\n"}      		 
}
if (thefile == "quote-truck.html") {
//*  RADIOS 
	if (document.form0.Equipment_Requirements[0].checked ||
		document.form0.Equipment_Requirements[1].checked ||
		document.form0.Equipment_Requirements[2].checked ) {	}
  		else {errormessage=errormessage+"Equipment Requirements\n"}
}
 
//* Orig_City 
	minlength = 3; fieldblank=true;
    for (j=0; j < document.form0.Orig_City.value.length; j++) 
    {
      if (document.form0.Orig_City.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Orig_City.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Originating City\n"} 

if (thefile == "quote-truck.html") {      	
//*** ORIG PROVINCE / STATE
    minlength = 2; fieldblank=true;
    for (j=0; j < document.form0.Orig_ProvState.value.length; j++) 
    {
      if (document.form0.Orig_ProvState.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Orig_ProvState.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Originating Province/State\n"}
}

//*** ORIG COUNTRY 
//* Just Ocean and Air, Not Truck
if (thefile == "quote-ocean.html" || thefile == "quote-air.html" ) {
	var item = document.form0.Orig_Country.selectedIndex;
	var countryval = document.form0.Orig_Country.options[item].value;
	if (countryval == "") {errormessage=errormessage+"Originating Country\n"}       	
}	
	     	
if (thefile == "quote-truck.html") {
//* Loading dock RADIOS
	if (document.form0.Orig_Loading_Dock[0].checked ||
		document.form0.Orig_Loading_Dock[1].checked ) {	}
  		else {errormessage=errormessage+"Originating Loading Dock\n"}      	
}      	
      	
//* Dest_City *********************
	minlength = 3; fieldblank=true;
    for (j=0; j < document.form0.Dest_City.value.length; j++) 
    {
      if (document.form0.Dest_City.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Dest_City.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Destination City\n"} 

//*** DEST COUNTRY 
//* Just Ocean and Air, Not Truck
if (thefile == "quote-ocean.html" || thefile == "quote-air.html" ) {
	var item = document.form0.Dest_Country.selectedIndex;
	var countryval = document.form0.Dest_Country.options[item].value;
	if (countryval == "") {errormessage=errormessage+"Destination Country\n"}  
}

if (thefile == "quote-truck.html") {
//* Loading dock RADIOS
	if (document.form0.Dest_Loading_Dock[0].checked ||
		document.form0.Dest_Loading_Dock[1].checked ) {	}
  		else {errormessage=errormessage+"Destination Loading Dock\n"}      	
} 
      	       	      	      	 
//* Pieces 
	minlength = 1; fieldblank=true;
    for (j=0; j < document.form0.Pieces.value.length; j++) 
    {
      if (document.form0.Pieces.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Pieces.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"No. of Pieces\n"}       	

//* Weight 
	minlength = 1; fieldblank=true;
    for (j=0; j < document.form0.Weight.value.length; j++) 
    {
      if (document.form0.Weight.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Weight.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Total Weight\n"}      
      		
//* Weight Units RADIOS
	if (document.form0.Weight_Units[0].checked ||
		document.form0.Weight_Units[1].checked ) {	}
  		else {errormessage=errormessage+"Weight Units\n"}  

//** OCEAN **  
if (thefile == "quote-ocean.html") {
	minlength = 1; fieldblank=true;
    for (j=0; j < document.form0.Volume.value.length; j++) 
    {
      if (document.form0.Volume.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Volume.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Total Volume\n"} 	
	
	//* Volume Units RADIOS
	if (document.form0.Volume_Units[0].checked ||
		document.form0.Volume_Units[1].checked ) {	}
  		else {errormessage=errormessage+"Volume Units\n"}      	
} 
  		
//* Commodity 
	minlength = 3; fieldblank=true;
    for (j=0; j < document.form0.Commodity.value.length; j++) 
    {
      if (document.form0.Commodity.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Commodity.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Commodity\n"} 
  		    	
//* Hazardous RADIO
	if (document.form0.Hazardous[0].checked ||
		document.form0.Hazardous[1].checked ) {	}
  		else {errormessage=errormessage+"Hazardous?\n"}  
  		 
//* If Hazardous = Yes
	if (document.form0.Hazardous[0].checked) {
		if (document.form0.UN_No.value == "") 				{errormessage=errormessage+"Hazardous: UN #\n"} 
		if (document.form0.Packing_Group_No.value == "")	{errormessage=errormessage+"Hazardous: Packing Group #\n"}
		if (document.form0.Class.value == "")				{errormessage=errormessage+"Hazardous: Class\n"}
    }		

//* Insurance RADIO
	if (document.form0.Insurance[0].checked ||
		document.form0.Insurance[1].checked ) {	}
  		else {errormessage=errormessage+"Insurance?\n"} 

//* If Insurance = Yes
	if (document.form0.Insurance[0].checked) {
		if (document.form0.Insurance_Value.value == "") 	{errormessage=errormessage+"Insurance Value\n"} 
		var item = document.form0.Insurance_Currency.selectedIndex;
		var currency = document.form0.Insurance_Currency.options[item].value;
		if (currency == "") {errormessage=errormessage+"Insurance Currency\n"}
    }
  		
} //*** End AIR, OCEAN & TRUCK SERVICES
	
//*********************************
//*** RADIO - PASSWORD	CLIENTS-PASSW
//*********************************
	if (thefile == "clients-passw.html") { 
		//* 2 radios, 1 checkbox		
  		if (document.form0.Request_Type[0].checked || document.form0.Request_Type[1].checked ||document.form0.Request_Type_AMPS.checked) {
//  		if (document.form0.Request_Type[0].checked) document.form0.Request_Type.value = "Request Password";
//  		if (document.form0.Request_Type[1].checked) document.form0.Request_Type.value = "Change Password";
  			if (document.form0.Request_Type[0].checked) subj = "Request Password";
  			if (document.form0.Request_Type[1].checked) subj = "Change Password";
  			if (document.form0.Request_Type_AMPS.checked) subj = "Request AMPS Password";
  		}
  		else {errormessage=errormessage+"Request New or Change Password?\n"}
  		
		if (document.form0.Notify_By[0].checked ||
			document.form0.Notify_By[1].checked ) {	}
  			else {errormessage=errormessage+"Notify How?\n"}  
	} 
	
//*********************************
//*** CHECKBOXES - HELP-MAILLIST
//*********************************
 	if (thefile == "help-maillist.html") {
 		if (document.form0.RegularMailings.checked == 0 &
 		 	document.form0.RouteNewsletter.checked == 0 & 
 		 	document.form0.PastIssuesRoute.checked == 0)    
 	    {errormessage=errormessage+"At least one Mailing checkbox\n"}
 	}    

//*********************************
//*** SEMINAR - HELP-SEMINAR
//*********************************

 	if (thefile == "help-seminar.html") {
		//*** CHECKBOXES
 		if (document.form0.Seminar1.checked == 0 &
 		    document.form0.Seminar2.checked == 0 &
 		 	document.form0.Seminar3.checked == 0 &
 		 	document.form0.Seminar4.checked == 0 &
 		 	document.form0.Seminar5.checked == 0 &
 		 	document.form0.Seminar6.checked == 0 &
 		 	document.form0.Seminar_Other.value == "")    
 	    	{errormessage=errormessage+"At least one Seminar Subject\n"}
 	    
 	    //*** RADIOS
  		if (document.form0.No_of_Participants[0].checked ||
  			document.form0.No_of_Participants[1].checked ||
  			document.form0.No_of_Participants[2].checked || 
  			document.form0.No_of_Participants[3].checked) {
// 			if (document.form0.Request_Type[0].checked) document.form0.No_of_Participants.value = "Request Password";
  		}
  		else {errormessage=errormessage+"Number of Participants\n"}
  		
		//*** DATE 
	    fieldblank=true;
	    minlength = 5;
	    for (j=0; j < document.form0.Preferred_Date.value.length; j++) 
	    {
	      if (document.form0.Preferred_Date.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Preferred_Date.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"Preferred Date\n"}
 	    
 	}
	 		
//*********************************
//*** REQUEST REFERRAL - HELP-REFER
//*********************************
 	if (thefile == "help-refer.html") {
		//*** CHECKBOXES
 		if (document.form0.Area_of_Interest1.checked == 0 &
 			document.form0.Area_of_Interest2.checked == 0 &
 			document.form0.Area_of_Interest3.checked == 0 &
 			document.form0.Area_of_Interest4.checked == 0 &
 			document.form0.Area_of_Interest5.checked == 0)   
 	    {errormessage=errormessage+"At least one area of interest\n"}
	} 

//*********************************
//*** CONSULTION - DIRECT SUPPORT
//*********************************

 	if (thefile == "consult-direct.html") {
 	    //*** RADIOS
  		if (document.form0.Ask_Who[0].checked || document.form0.Ask_Who[1].checked || document.form0.Ask_Who[2].checked) {}
  		else {errormessage=errormessage+"Ask Who?\n"} 
  				
//*** QUESTION   
	
	    fieldblank=true;
	    minlength = 10;
	    for (j=0; j < document.form0.Question.value.length; j++) 
	    {
	      if (document.form0.Question.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Question.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"Your Question\n"}  		
	} 		

//*********************************
//*** CONTACT US 
//*********************************
 	if (thefile == "contact.html") {
		//*** CHECKBOXES
 		if (document.form0.International_Transportation_Air.checked == 0 &
 			document.form0.International_Transportation_Ocean.checked == 0 &
 		   document.form0.Trucking_Canada.checked == 0 & 
 		   document.form0.Trucking_US.checked == 0 & 
 		   document.form0.US_Bound_Freight.checked == 0 &
 		   document.form0.Customs_Brokerage_Canada.checked == 0 &
 		   document.form0.Customs_Brokerage_US.checked == 0 &
 		   document.form0.Distribution.checked == 0 &
 		   document.form0.Total_Logistics_Solutions.checked == 0 &
 		   document.form0.Consulting.checked == 0 &
 		   document.form0.Book_Specialty.checked == 0 &
 		   document.form0.UK_Ocean_and_Air.checked == 0 &
 		   document.form0.Pet_Food_and_Supplies.checked == 0 &
 		   document.form0.NAFTA_and_AMPS_Compliance.checked == 0 &
 		   document.form0.Non_Resident_Importer_Package.checked == 0 &
 		   document.form0.Client_Care.checked == 0 &
 		   document.form0.Route_Maillist.checked == 0 &
 		   document.form0.EmailAlert_Maillist.checked == 0 &
 		   document.form0.Call_Me.checked == 0 &
 		   document.form0.Seminars.checked == 0)     
 	    {errormessage=errormessage+"At least one area of interest\n"}
	} 

//*********************************
//*** EMAIL ALERTS  - HELP-ALERTS
//*********************************
 	if (thefile == "help-alerts.html") {
		//*** CHECKBOXES
 		if (document.form0.International_Transportation_Air.checked == 0 &
 			document.form0.International_Transportation_Ocean.checked == 0 &
 		   document.form0.Trucking_Canada.checked == 0 & 
 		   document.form0.Trucking_US.checked == 0 & 
 		   document.form0.Customs_Brokerage_Canada.checked == 0 &
 		   document.form0.Customs_Brokerage_US.checked == 0 &
 		   document.form0.Distribution.checked == 0 &
 		   document.form0.Total_Logistics_Solutions.checked == 0 &
 		   document.form0.Consulting.checked == 0 &
 		   document.form0.Book_Specialty.checked == 0 &
 		   document.form0.UK_Ocean_and_Air.checked == 0 &
 		   document.form0.Pet_Food_and_Supplies.checked == 0 &
 		   document.form0.NAFTA_and_AMPS_Compliance.checked == 0 &
 		   document.form0.Non_Resident_Importer_Package.checked == 0 &
 		   document.form0.ALL_SUBJECTS.checked == 0)     
 	    {errormessage=errormessage+"At least one area of interest\n"}
	}

//*********************************
//*** SUGGEST - HELP-SUGGEST
//*********************************
 	if (thefile == "help-suggest.html") {
 		if (document.form0.I_Like.value == "" &
 		 	document.form0.I_Dont_Like.value == "" &
 		 	document.form0.I_Suggest.value == "")    
 	   		{errormessage=errormessage+"Comment or suggestion\n"}
	} 

//*********************************		
//*** COMMON STUFF TO FORMS    
//*********************************

//*** NAME 
    fieldblank=true;
    minlength = 3;
    for (j=0; j < document.form0.Name.value.length; j++) 
    {
      if (document.form0.Name.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Name.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Name\n"}

//*** TITLE		
	    fieldblank=true;
	    minlength = 4;
	    for (j=0; j < document.form0.Title.value.length; j++) 
	    {
	      if (document.form0.Title.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Title.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"Title\n"}
	
//*** COMPANY
	
	    fieldblank=true;
	    minlength = 4;
	    for (j=0; j < document.form0.Company.value.length; j++) 
	    {
	      if (document.form0.Company.value.substring(j,j+1) !=" ") {fieldblank=false}
	    }
	    if (document.form0.Company.value.length < minlength || fieldblank)
	      	{errormessage=errormessage+"Company\n"}       	    	

//*** TYPE OF COMPANY

if (thefile != "clients-passw.html") { 

 		if (document.form0.Large_Importer.checked == 0 &
 			document.form0.Small_Importer.checked == 0 &
 		   document.form0.Large_Exporter.checked == 0 & 
 		   document.form0.Small_Exporter.checked == 0)
// 		   document.form0.US_Non_Resident_Importer.checked == 0)  		       
 	    {errormessage=errormessage+"Type of Company\n"}    

//*** INDUSTRY SECTOR

	minlength = 4; fieldblank=true;
    for (j=0; j < document.form0.Industry_Sector.value.length; j++) 
    {
      if (document.form0.Industry_Sector.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Industry_Sector.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Industry Product or Sector\n"}   	    
} 

//*** ADDRESS1
    minlength = 6; fieldblank=true;
    for (j=0; j < document.form0.Address1.value.length; j++) 
    {
      if (document.form0.Address1.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Address1.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Address\n"}
      	      	
//*** CITY
    minlength = 3; fieldblank=true;
    for (j=0; j < document.form0.City.value.length; j++) 
    {
      if (document.form0.City.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.City.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"City\n"}

//*** PROVINCE / STATE
    minlength = 2;     fieldblank=true;
    for (j=0; j < document.form0.Province_State.value.length; j++) 
    {
      if (document.form0.Province_State.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Province_State.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Province/State\n"}
      	
//*** Country 
	var item = document.form0.Country.selectedIndex;
	var countryval = document.form0.Country.options[item].value;
	if (countryval == "") {errormessage=errormessage+"Country\n"} 

//*** TEL 
	minlength = 9; fieldblank=true;
    for (j=0; j < document.form0.Telephone.value.length; j++) 
    {
      if (document.form0.Telephone.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Telephone.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Telephone\n"}     	

//*** FAX 
	minlength = 9; fieldblank=true;
    for (j=0; j < document.form0.Fax.value.length; j++) 
    {
      if (document.form0.Fax.value.substring(j,j+1) !=" ") {fieldblank=false}
    }
    if (document.form0.Fax.value.length < minlength || fieldblank)
      	{errormessage=errormessage+"Fax\n"}  

//*** EMAIL 
   if (document.form0.Email.value.length ==0 || document.form0.Email.value.indexOf('@', 0) == -1 || document.form0.Email.value.indexOf('.', 0) == -1) 
	{errormessage=errormessage+"Email address\n"} 

//*** Uncomment next line to unhook the validation 
//    errormessage ="";
  
   if (errormessage !="") { alert (firstmessage + "\n" + errormessage) }
   else { 
		//** For CUST BROKERAGE form, append these values with a % for clarity on the output.   	
		if (thefile == "quote-cust.html") { 	  	  
			 //** 7 Add percentage sign if not blank 	  	  
		  	 if (document.form0.Shipments_LVS.value != "") document.form0.Shipments_LVS.value += " %";
		  	 if (document.form0.Shipments_Non_LVS.value != "") document.form0.Shipments_Non_LVS.value += " %";
			 //** 8 Add percentage sign if not blank 	  
		  	 if (document.form0.Freight_Originate_US.value != "") document.form0.Freight_Originate_US.value += " %";
		  	 if (document.form0.Freight_Originate_UK.value != "") document.form0.Freight_Originate_UK.value += " %";
		  	 if (document.form0.Freight_Originate_Europe.value != "") document.form0.Freight_Originate_Europe.value += " %";
		  	 if (document.form0.Freight_Originate_FarEast.value != "") document.form0.Freight_Originate_FarEast.value += " %";
		  	 if (document.form0.Freight_Originate_Other.value != "") document.form0.Freight_Originate_Other.value += " %";		  	   
 			//** 9 Add percentage sign if not blank 	  	  
	 	 	 if (document.form0.Freight_Destination_Ontario.value != "") document.form0.Freight_Destination_Ontario.value += " %";
	 	 	 if (document.form0.Freight_Destination_Quebec.value != "") document.form0.Freight_Destination_Quebec.value += " %";
	  	 if (document.form0.Freight_Destination_Central_Canada.value != "") document.form0.Freight_Destination_Central_Canada.value += " %";
	  	 if (document.form0.Freight_Destination_Western_Canada.value != "") document.form0.Freight_Destination_Western_Canada.value += " %";
	 	 	 if (document.form0.Freight_Destination_Maritimes.value != "") document.form0.Freight_Destination_Maritimes.value += " %";	
	   }    	
 		document.form0.sendemailto.value = "webmaster@universallogistics.ca";
//   	document.form0.sendemailto.value = "pc@twistedpixel.com";
	if (thefile == "clients-passw.html") 		{ subj = "UL: " + subj ;}  //subj determined above.
	else  if (thefile == "help-callme.html")	{ subj = "UL: Call Me"; }
	else  if (thefile == "help-maillist.html") 	{ subj = "UL: Add to Mailing List"; }
	else  if (thefile == "help-alerts.html") 	{ subj = "UL: Email Alerts!"; }		
	else  if (thefile == "help-consult.html") 	{ subj = "UL: Consulting Support"; }	
	else  if (thefile == "help-seminar.html") 	{ subj = "UL: Book a Seminar"; }
	else  if (thefile == "help-suggest.html") 	{ subj = "UL: Suggestion Box"; }
	else  if (thefile == "help-refer.html") 	{ subj = "UL: Request Referral"; }
	else  if (thefile == "contact.html") 		{ subj = "UL: Contact Us"; }
	else  if (thefile == "quote-dist.html") 	{ subj = "UL: Quote-Distribution"; }
	else  if (thefile == "quote-air.html") 		{ subj = "UL: Quote-Air"; }
	else  if (thefile == "quote-ocean.html")	{ subj = "UL: Quote-Ocean"; }
	else  if (thefile == "quote-truck.html") 	{ subj = "UL: Quote-Trucking"; }
	else  if (thefile == "quote-cust.html") 	{ subj = "UL: Quote-Customs Brokerage"; }
	
	else  if (thefile == "consult-direct.html") { 
		subj = "UL: Direct Support";    
		//* Customs_Brokerage Brian Rowe
		if (document.form0.Ask_Who[0].checked) document.form0.sendemailto.value = "browe@universallogistics.ca"; 
		//*	Transportation_Support - Carlos Torres	
		if (document.form0.Ask_Who[1].checked) document.form0.sendemailto.value = "ctorres@universallogistics.ca"; 
		//* Distribution Support - Jon Barnard		
		if (document.form0.Ask_Who[2].checked) document.form0.sendemailto.value = "jbarnard@universallogistics.ca"; 
		
		//****** OVERRIDE as per Paul Glionna request.
		 document.form0.sendemailto.value = "webmaster@universallogistics.ca";		
		}				

//*** Store common stuff in cookies, which will automatically be displayed in other forms.
    if (document.form0.Name.value !="") 				setCookie("Name", document.form0.Name.value); 
    if (document.form0.Title.value !="") 				setCookie("Title", document.form0.Title.value); 
    if (document.form0.Company.value !="") 				setCookie("Company", document.form0.Company.value);          
    if (document.form0.Large_Importer.checked != 0) 	setCookie("Large_Importer", document.form0.Large_Importer.checked); 
    if (document.form0.Small_Importer.checked != 0) 	setCookie("Small_Importer", document.form0.Small_Importer.checked);
    if (document.form0.Large_Exporter.checked != 0) 	setCookie("Large_Exporter", document.form0.Large_Exporter.checked); 
    if (document.form0.Small_Exporter.checked != 0) 	setCookie("Small_Exporter", document.form0.Small_Exporter.checked); 
//    if (document.form0.US_Non_Resident_Importer.checked != 0) 	
//    					setCookie("US_Non_Resident_Importer", document.form0.US_Non_Resident_Importer.checked);
    if (document.form0.Industry_Sector.value != "") 	setCookie("Industry_Sector", document.form0.Industry_Sector.value);
    if (document.form0.Address1.value !="") 			setCookie("Address1", document.form0.Address1.value);
    if (document.form0.Address2.value !="") 			setCookie("Address2", document.form0.Address2.value);    
    if (document.form0.City.value !="") 				setCookie("City", document.form0.City.value);    
    if (document.form0.Province_State.value !="") 		setCookie("Province_State", document.form0.Province_State.value); 
    if (document.form0.PostalCode.value !="") 			setCookie("PostalCode", document.form0.PostalCode.value); 
       													setCookie("Country", document.form0.Country.selectedIndex);
    if (document.form0.Telephone.value !="") 			setCookie("Telephone", document.form0.Telephone.value);
    if (document.form0.Fax.value !="") 					setCookie("Fax", document.form0.Fax.value);
    if (document.form0.Email.value !="") 				setCookie("Email", document.form0.Email.value);

//* BCC if field exists in form	
	if (window.document.form0.sendemailbcc) { 
		document.form0.sendemailbcc.value = "pc@twistedpixel.com, wolfgang@wordsatwork.ca";
  	}
  
	if (window.document.form0.Comments) { 
		//* If comments start with xx, set testFlag on - for developer testing 
		var sComments = document.form0.Comments.value;
		if (sComments.substring(0,2) == "xx") {
			document.form0.sendemailto.value = "pc@twistedpixel.com"; 
			//document.form0.sendemailbcc.value = "pc@twistedpixel.com, wolfgang@wordsatwork.ca";
		}
  	}  
  	
//     	document.form0.sendemailto.value = "webmaster@universallogistics.ca";  //* for testing
//  	document.form0.sendemailto.value = "webmaster@unsworthcb.com";  //* for testing
//  	document.form0.sendemailto.value = "twisted6@csolve.net"; 
  	
  	document.form0.redirect.value = "http://www.universallogistics.ca/html/confirm.html";
  	document.form0.sendemailsubject.value = subj;
   	document.form0.sendemailform.value  = document.form0.Email.value;
// 	document.form0.action = "http://cgi.ebsi.net/cgi-bin/mailer.pl";
// 	document.form0.action = "http://www.atlis.net/asp/mailer.asp";
    document.form0.action = "http://www.universallogistics.ca/mailer/formsend.asp";
  	document.form0.method = "POST";
  	document.form0.submit();
 	return(0)  

   }
}  

function loadit( ) {
//*******************************************************************************
// load form with test data
//*******************************************************************************

    document.form0.Name.value = "Mr Rogers";
 	document.form0.Title.value = "Captain Canada"; 	    
    document.form0.Company.value = "Acme Ltd."; 
    document.form0.Telephone.value = "705-555-1212";
    document.form0.Fax.value =  "705-555-3456";
    document.form0.Email.value =  "pc@twistedpixel.com";
//  document.form0.Comments.value =  "I like Universal Logistics";
}
function doCookies () {
//******************************************************************************* 
//  Common rtn for pages with forms. If Name, Title, etc is in cookie, display
//  on form so user does not have to enter it again.
//******************************************************************************* 		

	var theName 			= getCookie("Name"); 
	var theTitle			= getCookie("Title"); 
	var theCompany			= getCookie("Company"); 
	var theLarge_Importer	= getCookie("Large_Importer");
	var theSmall_Importer	= getCookie("Small_Importer"); 
	var theLarge_Exporter	= getCookie("Large_Exporter"); 
	var theSmall_Exporter	= getCookie("Small_Exporter"); 
	var theIndustry_Sector	= getCookie("Industry_Sector"); 	
//	var theUS_Non_Resident_Importer	= getCookie("US_Non_Resident_Importer"); 
	var theAddress1			= getCookie("Address1"); 
	var theAddress2			= getCookie("Address2"); 
	var theCity				= getCookie("City"); 
	var theProvince_State	= getCookie("Province_State"); 
	var thePostalCode		= getCookie("PostalCode"); 
	var theCountry			= getCookie("Country"); 
	 	
	var theTelephone		= getCookie("Telephone"); 
	var theFax				= getCookie("Fax"); 
	var theEmail			= getCookie("Email"); 
 
	if (theName == null) 	{theName = "" } // Just in case the cookie is not set.	
	if (theTitle == null)	{theTitle = "" };	
	if (theCompany == null)	{theCompany = "" };	
	if (theLarge_Importer == null)	{theLarge_Importer = 0 };
	if (theSmall_Importer == null)	{theSmall_Importer = 0 };
	if (theLarge_Exporter == null)	{theLarge_Exporter = 0 };
	if (theSmall_Exporter == null)	{theSmall_Exporter = 0 };
//	if (theUS_Non_Resident_Importer == null)	{theUS_Non_Resident_Importer = 0 };
	if (theIndustry_Sector == null)	{theIndustry_Sector = "" };	
	if (theAddress1 == null) {theAddress1 = "" };
	if (theAddress2 == null) {theAddress2 = "" };
	if (theCity == null)	{theCity = "" };
	if (theProvince_State == null)		{theProvince_State = "" };
	if (thePostalCode == null)		{thePostalCode = "" };
	if (theCountry == null)		{theCountry = 0 };  // Selection List
	if (theTelephone == null) {theTelephone = "" };
	if (theFax == null)		{theFax = "" };
	if (theEmail == null)	{theEmail = "" };
 
    document.form0.Name.value = theName;
    document.form0.Title.value = theTitle;
    document.form0.Company.value = theCompany;
    document.form0.Large_Importer.checked = theLarge_Importer;
    document.form0.Small_Importer.checked = theSmall_Importer;
    document.form0.Large_Exporter.checked = theLarge_Exporter;
    document.form0.Small_Exporter.checked = theSmall_Exporter;
//  document.form0.US_Non_Resident_Importer.checked = theUS_Non_Resident_Importer;
	document.form0.Address1.value = theAddress1;
	document.form0.Address2.value = theAddress2;
	document.form0.City.value = theCity;
	document.form0.Province_State.value = theProvince_State;
	document.form0.PostalCode.value = thePostalCode;
	document.form0.Country.selectedIndex = theCountry;
    document.form0.Industry_Sector.value = theIndustry_Sector;
    document.form0.Telephone.value = theTelephone;
    document.form0.Fax.value = theFax;
    document.form0.Email.value = theEmail;
}

function clearRequest() {
//******************************************************************************* 
//   Clear Request Type buttons from the clients-passw.html pages
//******************************************************************************* 			
	document.form0.Request_Type[0].checked = false;
	document.form0.Request_Type[1].checked = false;
	document.form0.Request_Type_AMPS.checked = false;
}
