
function resetContactForm()
{
	pForm = document.contactForm;

	pForm.txt_name.value = "";
	pForm.txt_last.value = "";
	pForm.txt_email.value = "";
	pForm.txt_phone.value = "";
	pForm.txt_address.value = "";
	pForm.txt_city.value = "";
	pForm.txt_zip.value = "";
	pForm.txt_sample.value = "";
	pForm.txt_msg.value = "";

	bEnviado = false;
}

bEnviado = false;
function sendContactForm()
{
	if( bEnviado )
	{
		showAlert( "Thank-you for taking the time to share your comments and questions with us.", true );
		return;
	}

	pForm = document.contactForm;
	var msg = "";

	if( pForm.txt_name.value == "" )
	{
		msg = "Please enter your first name";
		elem = pForm.txt_name;
	}
	else
	if( pForm.txt_last.value == "" )
	{
		msg = "Please enter your last name";
		elem = pForm.txt_last;
	}
	else
	if( !email_IsValid( pForm.txt_email.value ) )
	{
		msg = "Please enter your E-mail";
		elem = pForm.txt_email;
	}
	else
	if( pForm.txt_phone.value == "" )
	{
		msg = "Please enter a phone number";
		elem = pForm.txt_stnumber;
	}

	if( msg == "" )
	{
		bEnviado = true;
		//pForm.submit();
		//p = document.getElementById( "divMsg" );
		//if( p )		p.innerHTML = "Enviando..";

		url		= "sendContact.asp";
		params	= "";
		params	= params + "txt_name="		+ escape( pForm.txt_name.value );
		params	= params + "&txt_last="		+ escape( pForm.txt_last.value );
		params	= params + "&txt_email="	+ escape( pForm.txt_email.value );
		params	= params + "&txt_phone="	+ escape( pForm.txt_phone.value );
		params	= params + "&txt_address="	+ escape( pForm.txt_address.value );
		params	= params + "&txt_city="		+ escape( pForm.txt_city.value );
		params	= params + "&txt_zip="		+ escape( pForm.txt_zip.value );
		params	= params + "&txt_country="	+ escape( pForm.txt_country.value );
		params	= params + "&txt_sample="	+ escape( pForm.txt_sample.value );
		params	= params + "&txt_method="	+ escape( pForm.txt_method.value );
		params	= params + "&txt_msg="		+ escape( pForm.txt_msg.value );

		FAjax( url, "divFormResponse", params, "POST", 0, onContactForm_response ); //ajaxCallback_BeforeUpdate, ajaxCallback_AfterUpdate );
		delete ajax; // = null;
	}
	else
	{
		showAlert( msg, true );
		elem.focus();
	}
}

var pop1 = "<table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><img src=\"images/pop/pop_top_left.gif\" width=\"13\" height=\"15\" /></td> <td background=\"images/pop/pop_top.gif\"><img src=\"images/pop/pop_top.gif\" width=\"100\" height=\"15\" /></td> <td><img src=\"images/pop/pop_top_right.gif\" width=\"14\" height=\"15\" /></td> </tr> <tr> <td width=\"14\" background=\"images/pop/pop_left.gif\"><img src=\"images/pop/pop_left.gif\" width=\"13\" height=\"100\" /></td> <td height=\"100\" align=\"center\" valign=\"top\" background=\"images/pop/pop_alert_back.gif\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"1\"><img src=\"";
var pop2 = "\" width=\"69\" height=\"99\"></td> <td><table width=\"92%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"center\" class=\"texto\">";
var pop3 = "</td> </tr> </table></td> </tr> </table> </td> <td width=\"14\" background=\"images/pop/pop_right.gif\"><img src=\"images/pop/pop_right.gif\" width=\"14\" height=\"100\" /></td> </tr> <tr> <td><img src=\"images/pop/pop_bottom_left.gif\" width=\"13\" height=\"12\" /></td> <td background=\"images/pop/pop_bottom.gif\"><img src=\"images/pop/pop_bottom.gif\" width=\"100\" height=\"12\" /></td> <td><img src=\"images/pop/pop_bottom_right.gif\" width=\"14\" height=\"12\" /></td> </tr></table>";

function onContactForm_response()
{
	//p = document.getElementById( "divFormResponse" );
	showAlert( "Thank-you for taking the time to share your comments and questions with us.", false );
}

function showAlert( msg, bError )
{
	iconFile = "images/pop/ico_alert_ok.gif";
	if( bError )	iconFile = "images/pop/ico_alert.gif";

	//Popup.showModal( 'modal' );
	pop = Popup.show( null, this, null,	{ 'content':	pop1 + iconFile + pop2 + msg + pop3	}	);
}
