function IsInvalidEmailAddress( elm )
{
	var email = elm.value.toLowerCase();

	if ( ( email.indexOf( "hotmail" ) > -1 ) || ( email.indexOf( "yahoo" ) > -1 ) )
	{
		elm.className = "invalidTextInput";
		return true;
	}
	else
		elm.className = "textInput";
	return false;
}

function IsEmptyInput( elm )
{
	if ( trim( elm.value ).length == 0 )
	{
		elm.className = "invalidTextInput";
		return true;
	}
	else
		elm.className = "textInput";
	return false;
}

function trim( value )
{
    value = value.replace(/^\s*/, '').replace(/\s*$/, ''); 
   return value;
} 

function IsFormValid( infoForm )
{
	var isValid = true;
	
	if ( infoForm != null )
	{
		var numElements = infoForm.elements.length;
		
		for( var index=0; index < numElements; index++ )
		{
			var elm = infoForm.elements[ index ];

			switch ( elm.name )
			{
				case "Contact_FirstName":
				case "Contact_LastName":
				case "Contact_MailingAddress":
				case "Contact_City":
				case "Contact_State":
				case "Contact_ZipCode":
					if ( IsEmptyInput( elm ) )
						isValid = false;
					break;
				case "Contact_EMail":
					if ( IsEmptyInput( elm ) )
						isValid = false;
					break;
				default:
					break;
			}
		}
		return isValid;
	}
}

function BtnReset_OnClick()
{
	var infoForm = document.forms[ "Request" ];
	if ( infoForm != null ) infoForm.reset();
}

function BtnSubmit_OnClick()
{
    var form = document.forms["Request"];
 	if ( IsFormValid( form ) )
	{
        form.Submit1.disabled = true;	
        form.submit();
	    return true;
	}
	else
	{
	    alert( "Please fill in the highlighted fields. Thank you." );
	    return false;
	}
}