function MeAvise(idMarca,idModelo)
{
	AbrirPagina('/box/meavise.asp','divAvise','POST','idMarca='+idMarca+'&idModelo='+idModelo,5)
}

function checaAvise()
{	
	if (document.fProposta.strNome.value =='' || document.fProposta.strNome.value =='Nome' )
	{
		alert("preencha o nome corretamente");
		document.fProposta.strNome.focus();
		return false;
	}
	if (document.fProposta.strTelefone.value =='' || document.fProposta.strTelefone.value =='Telefone' )
	{
		alert("preencha o telefone corretamente");
		document.fProposta.strTelefone.focus();
		return false;
	}
	if (document.fProposta.strCidade.value =='' || document.fProposta.strCidade.value =='Cidade' )
	{
		alert("preencha a cidade corretamente");
		document.fProposta.strCidade.focus();
		return false;
	}
	if (!isEmail(document.fProposta.strEmail.value) )
	{
		alert("preencha o email corretamente");
		document.fProposta.strEmail.focus();
		return false;
	}		
	if (document.fProposta.intAno.value=='')
	{
		alert("preencha o ano do carro");
		document.fProposta.intAno.focus();
		return false;
	}
	if (isNaN(document.fProposta.intAno.value))
	{
		alert("preencha o ano do carro corretament2");
		document.fProposta.intAno.focus();
		return false;
	}
	bolPrazo = false;
	for (i=0;i<=4;i++)
	{
		x = document.fProposta.intDias[i].checked;
		if (x)
		{
			bolPrazo = true;
			break;
		}
	}
	if (!bolPrazo)
	{
		alert("selecione até quando deseja ser avisado sobre esse carro");				
		return false;
	}
	return true;
}
function Enviar()
{		
	if (checaAvise())
	{
		dadosPost = GetDadosForm('fProposta');
		AbrirPagina('/box/meaviseSalvar.asp','divAvise','POST',dadosPost,5)
	}
}
function Limpar()
{
	document.fProposta.reset();
}
function isEmail(strValue)
{
    var objRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return objRegExp.test(strValue);
} 