function checkChange(id,checked){
	if(checked){
		document.getElementById(id).style.display="block";
	} else {
		document.getElementById(id).style.display="none";
	}
}

function submitContactForm(objRef)
{
	strRef = ( typeof( objRef ) != 'object' ) ? objRef : objRef.id;

	arr = new Array();
	arr[0] = document.getElementById("first-name");
	arr[1] = document.getElementById("last-name");
	arr[2] = document.getElementById("email");
	arr[3] = document.getElementById("form-message");

	send = true;
	strMsg = '';
	total = 0;
		
	for( x in arr ) {
		if(typeof(arr[x])!='object') continue;

		tmp = '';
		if( arr[x].value == '' || arr[x].value == tmp ) {
			strMsg = 'Please fill out all the fields.  ';
			send = false;
			arr[x].style.backgroundColor = '#ffc7c7';
		} else {
			arr[x].style.backgroundColor = '#fff';
		}
	}
	
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(reg.test(arr[2].value) == false) {
      	strMsg += 'Invalid Email Address.  ';
      	send = false;
		arr[2].style.backgroundColor = '#ffc7c7';
	} else {
		arr[2].style.backgroundColor = '';
	}
	
   	if(send) {
		setTimeout("doSubmit('"+strRef+"');", 50);
	} else {
		alert(strMsg);
		return false;
	}
}

function doSubmit( ref ) {
	document.getElementById(ref).submit();
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}