function checkContact()	{

	var email_pattern = /[\w\-]+\@[\w\-]+\.\w{2,3}/; 

	if (trim(document.getElementById('c_name').value).length == 0)	{
		alert("please enter your name");
		document.getElementById('c_name').focus();
		return false;
		}

	if (!email_pattern.test(document.getElementById('c_email').value))	{
		alert("the email you have entered appears to be formatted incorrectly\n\nplease check it and resubmit the form");
		document.getElementById('c_email').focus();
		return false;
		}

	if (document.getElementById('c_reason').selectedIndex == 0)	{
		alert("please select the reason for contacting us");
		document.getElementById('c_reason').focus();
		return false;
		}

	/* phone number stuff */

	if (document.getElementById('area_code').value.length != 0 || document.getElementById('phone_1').value.length != 0 || document.getElementById('phone_2').value.length != 0)	 {

		var good = true;
		var which = "";
		
		if (document.getElementById('area_code').value.length != 3 || !checkNumbers(document.getElementById('area_code').value))	 {
			good = false;
			which = 'area_code';
			}

		if (good && (document.getElementById('phone_1').value.length != 3 || !checkNumbers(document.getElementById('phone_1').value)))	{
			good = false;
			which = 'phone_1';
			}

		if (good && (document.getElementById('phone_2').value.length != 4 || !checkNumbers(document.getElementById('phone_2').value)))	{
			good = false;
			which = 'phone_2';
			}

		if (!good)	{
			alert("please make sure to include your entire phone number with area code in number format only\n\nif you need to enter a non US phone number please enter it in the comments text box");
			document.getElementById(which).focus();
			return false;
			}

		}

	if (document.getElementById('c_comments').value.length == 0 || document.getElementById('c_comments').value == 'please enter your comment or question here *')	{
		alert("please enter your comments or questions in the text box provided");
		document.getElementById('c_comments').focus();
		return false;
		}

	}

function form_focus(element)	{
	document.getElementById(element).style.borderColor = "#000000";
	document.getElementById(element).style.backgroundColor = "#FAFD9D";
	}

function form_blur(element)	{
	document.getElementById(element).style.borderColor = "#c0c0c0";
	document.getElementById(element).style.backgroundColor = "#FFFFFF";
	}

function trim(str)	{  
	while(str.charAt(0) == " ")	{  
		str = str.substring(1);
		}
	while(str.charAt(str.length-1) == " " )	{  
		str = str.substring(0,str.length-1);
		}
  return str;
}

function checkNumbers(element)	 {
	var good = true;

	loop :

	for (var x = 0 ; x < element.length ; x++)	{
		if (isNaN(element.charAt(x)))	 {
			good = false;
			break loop;
			}
		}

	return good;
	}
