	//-----------------------------------------------------------------------------------------------//
	// JS-Functions.js contains most general JavaScript functions for validation, the revolving quote
	//   and toggling the "QuickBar" menu items
	//
	// Change Log 
	// 	08/18/2003 - URCHERR - Page Created!                            
	//  03/12/2004 - URCHERR - Quotes updated for 2003 Annual Report.
	//  03/08/2005 - URCHERR - Quotes updated for 2004 Annual Report.
	//  03/15/2006 - URCHERR - Quotes updated for 2005 Annual Report.
	//  03/13/2007 - USNEWBE - Quotes Updated for 2006 Annual Report.
	//  03/10/2008 - USNEWBE - Quotes Updated for 2007 Annual Report; also added show hide function.
	//  02/11/2009 - USNEWBE - Added a trim function for use on the form edit checks.  Also added an
	//                         email address validation function.  
	//  02/27/2009 - USNEWBE - Quotes updated for 2008 Annual Report.
	//  03/03/2010 - USNEWBE - Quotes updated for 2009 Annual Report.
	//  03/08/2011 - UKSHACK - Quotes updated for 2010 Annual Report.                                                                                             // 
	//-----------------------------------------------------------------------------------------------//
	//
	var quotes=new Array();

	quotes[0]='"In 2010 our company positively responded to the economic challenges we faced and we made progress toward improving our financial results."';
	
	quotes[1]='"The experience, knowledge and training of our employees distinguish ABF in the minds of the shipping public."';
	
	quotes[2]='"In September 2010 ABF became the only six-time winner of the American Trucking Associations ("ATA") President\'s Trophy for Safety"';
	
	quotes[3]='"For the ninth consecutive year, ABF was acknowledged as a top service company to sell for by <i>Selling Power</i> magazine."'; 
	
	quotes[4]='"ABF\'s 2010 total tonnage per day increased 11% over the previous year."';
	
	quotes[5]='"ABF uniquely offers the reliability of regional and national service in a single dual-system network."';
	
	
			 
	// randomly return a quote
	function getquote(){
		var randomquote, rannum;
		rannum = Math.round(Math.random() * ((quotes.length-1) - 0)) + 0;
		return quotes[rannum];	
	}
	
	// validate the email forms
	function validatefrm(form) {
		 //02/11/2009; added trim function to all values 
     if ( Trim(form.message.value).length >= 1000 ) {
     	alert('Maximum Text Box Length Exceeded.  Please shorten your message.');
     	return false;
         }
         //02/11/2009; added trim function to verify we have something other than spaces; also email is now a required field.
         if ( (Trim(form.name.value).length == 0) || (Trim(form.message.value).length == 0) || (Trim(form.subject.value).length == 0) || (Trim(form.email.value).length == 0) ){
         	alert('Please Complete All Required Fields.');
         	return false;
         }//02/11/2009 add below email check
         else {
         		if (validEMail(form.email.value) == false)
         		{
         			alert('Please enter a valid email address.');
         			return false;
         		}
         }
         return true;
    }  
    
	
	// validate the document request forms
	function ValidateDocReqFrm(form) {	     
     		 //02/11/2009; added trim function to all values
         if ( (Trim(form.FirstName.value).length == 0) || (Trim(form.LastName.value).length == 0) || (Trim(form.Address1.value).length == 0) || (Trim(form.City.value).length == 0) || (Trim(form.State.value).length == 0) || (Trim(form.PostalCode.value).length == 0) || (Trim(form.Country.value).length == 0) || (Trim(form.Email.value).length == 0) ) {
         	alert('Please Complete All Required Fields.');
         	return false;
         }//02/11/2009 add below email check
         else {
         		if (validEMail(form.Email.value) == false)
         		{
         			alert('Please enter a valid email address.');
         			return false;
         		}
         }             
         return true;
    }  
      
  // handle toggling the quote and chart pictures  
	function togglechart(){
		var currentState
	
		chartobj=ie4? document.all.chartdiv : ns6? document.getElementById("chartdiv") : ns4? document.chartdiv : ""
		chartobj.thestyle=(ie4||ns6)? chartobj.style : chartobj
		
		currentState = chartobj.thestyle.display

		chartarrowobj=ie4? document.all.chartarrow : ns6? document.getElementById("chartarrow") : ns4? document.chartarrow : ""
		chartarrowobj.thestyle=(ie4||ns6)? chartarrowobj.style : chartarrowobj

		if (currentState != '') {
			if (currentState == 'block') {
				chartobj.thestyle.display='none'
				chartarrowobj.src = '/images/right-arrow.gif'
			} else {
				chartobj.thestyle.display='block'
				chartarrowobj.src = '/images/down-arrow.gif'
			}
		}
		else {
			chartobj.thestyle.display = 'none'
			chartarrowobj.src = '/images/right-arrow.gif'
		}
	
		return false		
	}	
	
	// handle toggling the quote and chart pictures  
	function togglequote(){
		var currentState
	
		quoteobj=ie4? document.all.quotediv : ns6? document.getElementById("quotediv") : ns4? document.quotediv : ""
		quoteobj.thestyle=(ie4||ns6)? quoteobj.style : quoteobj
		
		quotearrowobj=ie4? document.all.quotearrow : ns6? document.getElementById("quotearrow") : ns4? document.quotearrow : ""
		quotearrowobj.thestyle=(ie4||ns6)? quotearrowobj.style : quotearrowobj
	
		currentState = quoteobj.thestyle.display
	
		if (currentState != '') {
			if (currentState == 'block') {
				quoteobj.thestyle.display='none'
				quotearrowobj.src = '/images/right-arrow.gif'
			} else {
				quoteobj.thestyle.display='block'
				quotearrowobj.src = '/images/down-arrow.gif'
			}	
		}	
		else {
			quoteobj.thestyle.display = 'none'
			quotearrowobj.src = '/images/right-arrow.gif'
		}
	
		return false		
	}
	
//03/10/2008 Added	
	function change(id)
	{
		row=document.getElementById(id);
		
		if (row.className == "show")
		{
			//do nothing
		} 
		else
		{
			switch (id)
			{
				case "first":
					row.className = "show";
					document.getElementById("second").className = "hide";
					document.getElementById("third").className = "hide";
					break;
				case "second":
					row.className = "show";
					document.getElementById("first").className = "hide";
					document.getElementById("third").className = "hide";
					break;
				case "third":
					row.className = "show";
					document.getElementById("first").className = "hide";
					document.getElementById("second").className = "hide";
					break;
			}
		}
	}
	
	
	//*************************************************************
	//02/11/2009 Trim Function
	var reTrimSpaces = /^ +| +$/g;
	
	//Remove leading and trailing blanks from a string; 
	function Trim(Str)
	{
		return Str.replace(reTrimSpaces,"");
	}
	
	
	//*************************************************************
	//02/11/2009...brought in function from ValidEmail.js.
	//function to validate email address
function validEMail(inEmailAddr)
   {
   //Start and end the array with "" to simplify the looping
   var ValidEMChars = new Array("","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9",".","^","_","{","}","~","!","#","%","&","/","'","`","*","$","-","+","")
   //var AtomDesc = new Array("Username", "E-Mail host")
   var i
   var j
   var k
   var Atom   
   var AtomLen
   var NumValidEMChars
   
   Atom = inEmailAddr.split("@")
   NumValidEMChars = ValidEMChars.length   
      
   if (Atom.length > 2)
      {
      //alert("Too many '@' symbols in email address")
      return false
      }

   if (Atom.length < 2)
      {
      //alert("'@' symbol required for email address")
      return false
      }
   
   if (Atom[1].indexOf(".") == -1)
      {
      //alert(AtomDesc[1] + " must contain at least one period")
      return false
      }   
   
   if (!((Atom[1].charAt(Atom[1].length - 4) == ".") || (Atom[1].charAt(Atom[1].length - 3) == ".")))
      {
      //alert(AtomDesc[1] + " ending domain must be either 2 or 3 characters in length")
      return false
      }         
   for (var i = 0; i<2; i++)
      {
      if (Atom[i].length == 0)
         {         
         //alert(AtomDesc[i] + " required in email address")
         return false
         }      

      if (Atom[i].indexOf("..") != -1)
         {
         //alert(AtomDesc[i] + " cannot contain repeating periods")
         return false
         }           

      if (Atom[i].charAt(0) == ".")
         {
         //alert(AtomDesc[i] + " cannot begin with a period")
         return false
         }
      
      if (Atom[i].charAt((Atom[i].length - 1)) == ".")
         {
         //alert(AtomDesc[i] + " cannot end with a period")
         return false
         }        
      AtomLen = Atom[i].length - 1
      for (var j = 0; j<=AtomLen; j++)
         {
         k = 0       
         while(Atom[i].charAt(j) != ValidEMChars[k] && k < NumValidEMChars)            
            {
            k++
            }      
         if (Atom[i].charAt(j) != ValidEMChars[k])
            {            
            //alert("Invalid character '" + Atom[i].charAt(j) + "' in " + AtomDesc[i])         
            return false
            }
         }
      }               
   return true;   
   }  

