
function resetSamplesForm()
{
	pForm = document.samplesForm;

	pForm.txt_name.value = "";
	pForm.txt_last.value = "";
	pForm.txt_stnumber.value = "";
	pForm.txt_stname.value = "";
	pForm.txt_city.value = "";
	pForm.txt_state.value = "";
	pForm.txt_zip.value = "";
	pForm.txt_gender.value = "";
	pForm.txt_email.value = "";
	pForm.txt_phone.value = "";

	bEnviado = false;
}

bEnviado = false;
function sendSamplesForm()
{
	if( bEnviado )
	{
		showAlert( "Your sample request has been successfully sent.", true );
		return;
	}

	pForm = document.samplesForm;
	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( pForm.txt_stnumber.value == "" )
	{
		msg = "Your address is incomplete. Please enter a street number";
		elem = pForm.txt_stnumber;
	}
	else
	if( pForm.txt_stname.value == "" )
	{
		msg = "Your address is incomplete. Please enter a street name";
		elem = pForm.txt_stname;
	}
	else
	if( !email_IsValid( pForm.txt_email.value ) )
	{
		msg = "Please enter your E-mail";
		elem = pForm.txt_email;
	}

	pCombo = pForm.txt_sample;
	if( pCombo[ pCombo.selectedIndex ].value == "" )
	{
		msg	= "You forgot to select a sample product";
		elem = pCombo;
	}
	if( !document.getElementById("iag").checked )
	{
		msg	= "you must agree with terms conditions";
		elem = document.getElementById("iag").checked;
	}
	//alert( pCombo[ pCombo.selectedIndex ].value );

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

		url		= "sendSamples.asp";
		params	= "";
		params	= params + "txt_name="		+ escape( pForm.txt_name.value );
		params	= params + "&txt_last="		+ escape( pForm.txt_last.value );
		params	= params + "&txt_stnumber="	+ escape( pForm.txt_stnumber.value );
		params	= params + "&txt_stname="	+ escape( pForm.txt_stname.value );
		params	= params + "&txt_city="		+ escape( pForm.txt_city.value );
		params	= params + "&txt_state="	+ escape( pForm.txt_state.value );
		params	= params + "&txt_zip="		+ escape( pForm.txt_zip.value );
		params	= params + "&txt_country="	+ escape( pForm.txt_country.value );
		params	= params + "&txt_gender="	+ escape( pForm.txt_gender.value );
		params	= params + "&txt_email="	+ escape( pForm.txt_email.value );
		params	= params + "&txt_phone="	+ escape( pForm.txt_phone.value );
		params	= params + "&txt_sample="	+ escape( pForm.txt_sample.value );

		FAjax( url, "divFormResponse", params, "POST", 0, onSamplesForm_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 onSamplesForm_response()
{
	//p = document.getElementById( "divFormResponse" );
	showAlert( "Your sample request has been successfully sent.", 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	}	);
}
