pic1= new Image(16,16); 
pic1.src="/lib/images/loading.gif"; 
pic2= new Image(16,16); 
pic2.src="/lib/images/x.gif"; 
pic3= new Image(16,16); 
pic3.src="/lib/images/valid.gif"; 

function isName()  {
	var field = document.contactForm.Name;
	
	if (field.value == "") {
		alert("\nPlease enter your NAME in the field provided.\n");
		field.select();
		field.focus();
		return false;
	}
	return true;
}

function isEmail()  {

	var field = document.contactForm.Email;
	
	if (field.value == "") {
		alert("\nPlease enter your EMAIL ADDRESS in the field provided.\n");
		field.select();
		field.focus();
		return false;
		}

	if (field.value.indexOf('@',0) == -1 || field.value.indexOf('.',0) == -1)  {
		alert("\nThe EMAIL ADDRESS requires a \"@\" and a \".\" be used.\n\nPlease re-enter the EMAIL ADDRESS in the field provided.");
		field.select();
		field.focus();
		return false;
	}
	
	return true;
}

function isComments()  {
	var field = document.contactForm.Comments;
	
	if (field.value == "") {
		alert("\nPlease enter your MESSAGE in the field provided.\n");
		field.select();
		field.focus();
		return false;
	}
	return true;
}


function displayProgress() {

	

}

function submitemail(form){

	if (isName() && isEmail() && isComments())
	{ 	 

		document.getElementById('sending').innerHTML = '<img src="/lib/images/loading.gif" />&nbsp;Processing Email ...';
		URL = "Name=" + document.getElementById('Name').value + "&Email=" + document.getElementById('Email').value + "&Phone=" + document.getElementById('Phone').value + "&Time=" + document.getElementById('Time').value + "&Message=" + document.getElementById('Comments').value;
		reqResp = new sack();
		reqResp.requestFile = '/sendCallback.asp';
//		reqResp.onLoading = function(){ document.getElementById('sending').innerHTML = '<img src="images/loading.gif">'; };	
		reqResp.onCompletion = function(){ Rcvd(); };	// Specify function that will be executed after file has been found
		setTimeout("reqResp.runAJAX(URL);", 500);
		return false;
   }
	else
	 {   

	 	return false; 
	}
	
}

//// Place failure message here
function Failed()
{
document.getElementById('sending').innerHTML = 'Sorry, there was a failure in your query. Refresh and try again!'
}

//// Place confirm message here
function Rcvd()
{
document.getElementById('result').innerHTML = '* Message submitted!'
document.getElementById('sending').innerHTML = '<input name="" type="image" src="lib/images/btn_sendrequest.png" onclick="return submitemail(this.form)"/>'
}
