// JavaScript Document

function home_normal()
{
	document.btn1.src="images/home_up.gif";
}
function home_over()
{
	document.btn1.src="images/home_over.gif";	
}

function home_down()
{
	document.btn1.src="images/home_down.gif";
}

function services_normal()
{
	document.btn2.src="images/services_up.gif";
}
function services_over()
{
	document.btn2.src="images/services_over.gif";	
}
function services_down()
{
	document.btn2.src="images/services_down.gif";
}

// JScript source code

function setFocus(obj)										//due to a bug in FireFox this script is used to set focus
{															//on an object when there is invalid user input
   var testObject=null;
   testObject=document.getElementById(obj);					//gets the object
   testObject.focus();										//sets the focus on the field
   testObject.select();										//selects the text in the field
}	

function validateEmail(obj, minLength, maxLength)
/* This function takes the input from a textbox that is used for email address and validates
it's character for only acceptable input */
{
	var testString=document.getElementById(obj).value;		//gets string value from the textbox
	var testObject=document.getElementById(obj);			//gets the actual textbox object
	var strleng=testString.length;							//gets the length of the textboxes string for use in testing
	var validChars = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;	//set acceptable characters
	
	if (((strleng < parseInt(minLength)) || (strleng > parseInt(maxLength))) && (strleng !=0))
		{ 	if (parseInt(minLength) ==  parseInt(maxLength))
				{	alert("Please check the length, the length should be " + maxLength + " characters long.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}
			else
				{	alert("Please check the length, should be between " + minLength + " and " + maxLength + " characters in length.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}	}
					
	if (!(testObject.value.match(validChars)) && (strleng != 0))
		{	alert ("Please enter a valid email address.");
			self.setTimeout("setFocus('"+obj+"')",10);
			document.body.style.cursor="default";	
		}
	
	testObject.style.backgroundColor="white";
}														//end testing email values

function validateAlpha(obj, minLength, maxLength)
/* This function takes the value from a text box and tests it to ensure that only upper and lower case
alphabetic characters as well as comman, space, apostrophe, hyphen, and blanks are containted in the 
input from the user.  This test is performed when the user attempts to exit the text box.  If the input 
is not correct an alert box will be displayeda and the field focus and selected forcing the user to 
enter valid input. */
{   														//begin validateField function
	var testString=document.getElementById(obj).value;		//gets string value from the textbox
	var testObject=document.getElementById(obj);			//gets the actual textbox object
	var strleng=testString.length;							//gets the length of the textboxes string for use in testing
	var validChars = /^[a-zA-Z\s]+$/;						//sets valid characters to compare values against
		
	if (((strleng < parseInt(minLength)) || (strleng > parseInt(maxLength))) && (strleng !=0))
		{ 
			if (parseInt(minLength) ==  parseInt(maxLength))
				{	alert("Please check the length, the length should be " + maxLength + " characters long.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}
			else
				{	alert("Please check the length, should be between " + minLength + " and " + maxLength + " characters in length.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}	}	
	
	if (!(testObject.value.match(validChars)) && (strleng != 0))
		{	alert ("Please only enter alphabetic characters in this field.");
			self.setTimeout("setFocus('"+obj+"')",10);
			document.body.style.cursor="default";	
		}
		
		testObject.style.backgroundColor="white";

}//end of validateAlpha function

function validateNumberic(obj, minLength, maxLength)
/* This function tests a text box from a HTML form to ensure that only numberic data has been entered
by the user.  This test is done when the user attempts to exit the text box and if the data is invalid
an alert box is displayed and then the text box gets focus and the data is selected. */
{															//begin testing for numberic values

	var testString=document.getElementById(obj).value;		//gets string value from the textbox
	var testObject=document.getElementById(obj);			//gets the actual textbox object
	var strleng=testString.length;							//gets the length of the textboxes string for use in testing
	var validChars = /^[0-9]+$/;						//sets valid characters to compare values against
	
	if (((strleng < parseInt(minLength)) || (strleng > parseInt(maxLength))) && (strleng !=0))
		{ 	if (parseInt(minLength) ==  parseInt(maxLength))
				{	alert("Please check the length, the length should be " + maxLength + " characters long.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}
			else
				{	alert("Please check the length, should be between " + minLength + " and " + maxLength + " characters in length.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}	}
					
	if (!(testObject.value.match(validChars)) && (strleng != 0))
		{	alert ("Please only enter Numberic characters in this field.");
			self.setTimeout("setFocus('"+obj+"')",10);
			document.body.style.cursor="default";	
		}
	
	testObject.style.backgroundColor="white";
}   														//end testing of numberic values 														//end testing of hyphenated numberic values

function validateAlphaNum(obj, minLength, maxLength)
/* This function takes the value from a text box and tests it to ensure that only upper and lower case
alphabetic characters as well as comman, space, apostrophe, hyphen, and blanks are containted in the 
input from the user.  This test is performed when the user attempts to exit the text box.  If the input 
is not correct an alert box will be displayeda and the field focus and selected forcing the user to 
enter valid input. */
{   														//begin validateField function
	var testString=document.getElementById(obj).value;		//gets string value from the textbox
	var testObject=document.getElementById(obj);			//gets the actual textbox object
	var strleng=testString.length;							//gets the length of the textboxes string for use in testing
	var validChars = /^[a-zA-Z0-9\-\s]+$/;					//sets valid characters to compare values against
		
	if (((strleng < parseInt(minLength)) || (strleng > parseInt(maxLength))) && (strleng !=0))
		{ 
			if (parseInt(minLength) ==  parseInt(maxLength))
				{	alert("Please check the length, the length should be " + maxLength + " characters long.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}
			else
				{	alert("Please check the length, should be between " + minLength + " and " + maxLength + " characters in length.");
		 			self.setTimeout("setFocus('"+obj+"')",10);
		 			document.body.style.cursor="default";	}	}	
	
	if (!(testObject.value.match(validChars)) && (strleng != 0))
		{	alert ("Please only enter alphabetic characters in this field.");
			self.setTimeout("setFocus('"+obj+"')",10);
			document.body.style.cursor="default";	
		}
		
		testObject.style.backgroundColor="white";

}//end of validateAlphaNum function

function validateEmpty()
/* When called this function will check the fields on the form to ensure that none are empty, unchecked, etc. */
/* 

---Function templates-----

//  Use this statement to check for blank textboxes
if (document.getElementById('field_name').value.length == 0)
		{	errFlag=1;
			document.getElementById('field_name').style.backgroundColor="red";	}
			
//  Use this statement to check for unchecked check boxes.  Add && statements for multiple checkboxes.
if (!(document.getElementById('field_name').checked))
		{	errFlag=1;
			document.getElementById('field_name').style.backgroundColor="red";	}
*/
{
	var errFlag=0;											//initialize error flag
	

}

function imageChange (intX, intY, intZ){
	document.getElementById('image1').style.zIndex=intX;
	document.getElementById('image2').style.zIndex=intY;
	document.getElementById('image3').style.zIndex=intZ;	
}