// JavaScript Document

function validaOrcamento()
{
	corOk = '#FFFFFF';
	corErro = '#FCD1D1';
	
	if(document.formOrcamento.nome.value=="" || document.formOrcamento.nome.value.length < 3)
	{
		alert( "Preencha campo NOME corretamente! (Mínimo 3 Caracteres)" );
			document.formOrcamento.nome.focus();
			document.formOrcamento.nome.style.backgroundColor = corErro;
				return false;
	}
	document.formOrcamento.nome.style.backgroundColor = corOk;
		
	if( document.formOrcamento.email.value=="" || document.formOrcamento.email.value.indexOf('@')==-1 || document.formOrcamento.email.value.indexOf('.')==-1 )
	{
		alert( "Preencha campo E-MAIL corretamente!" );
			document.formOrcamento.email.focus();
			document.formOrcamento.email.style.backgroundColor = corErro;
				return false;
	}
	document.formOrcamento.email.style.backgroundColor = corOk;
	
	
	if(document.formOrcamento.telefone.value=="")
	{
		alert( "Preencha campo TELEFONE corretamente!" );
			document.formOrcamento.telefone.focus();
			document.formOrcamento.telefone.style.backgroundColor = corErro;
				return false;
	}
	document.formOrcamento.telefone.style.backgroundColor = corOk;
	
	if(document.formOrcamento.mensagem.value=="" || document.formOrcamento.mensagem.value.length < 10)
	{
		alert( "Preencha campo MENSAGEM corretamente! (Mínimo 10 caracteres)" );
			document.formOrcamento.mensagem.focus();
			document.formOrcamento.mensagem.style.backgroundColor = corErro;
				return false;
	}
	document.formOrcamento.mensagem.style.backgroundColor = corOk;	
	
	return true;
}

function validaContato()
{
	corOk = '#FFFFFF';
	corErro = '#FCD1D1';
	
	if(document.formContato.nome.value=="" || document.formContato.nome.value.length < 3)
	{
		alert( "Preencha campo NOME corretamente! (Mínimo 3 Caracteres)" );
			document.formContato.nome.focus();
			document.formContato.nome.style.backgroundColor = corErro;
				return false;
	}
	document.formContato.nome.style.backgroundColor = corOk;
		
	if( document.formContato.email.value=="" || document.formContato.email.value.indexOf('@')==-1 || document.formContato.email.value.indexOf('.')==-1 )
	{
		alert( "Preencha campo E-MAIL corretamente!" );
			document.formContato.email.focus();
			document.formContato.email.style.backgroundColor = corErro;
				return false;
	}
	document.formContato.email.style.backgroundColor = corOk;
	
	
	if(document.formContato.assunto.value=="")
	{
		alert( "Preencha campo ASSUNTO corretamente!" );
			document.formContato.assunto.focus();
			document.formContato.assunto.style.backgroundColor = corErro;
				return false;
	}
	document.formContato.assunto.style.backgroundColor = corOk;
	
	if(document.formContato.mensagem.value=="" || document.formContato.mensagem.value.length < 10)
	{
		alert( "Preencha campo MENSAGEM corretamente! (Mínimo 10 caracteres)" );
			document.formContato.mensagem.focus();
			document.formContato.mensagem.style.backgroundColor = corErro;
				return false;
	}
	document.formContato.mensagem.style.backgroundColor = corOk;	
	
	return true;
}
		
//Script para confirmação de exclusão
function deleta(msg)
{
	if (msg=='')
	{
		if(confirm("Confirma Exclusão?")) {
			return true;
		} else {
			return false;
		}
	}
	else 
	{
		if(confirm(msg)) {
			return true;
		} else {
			return false;
		}	
	}
}

//addSWF('Caminho e arquivo a ser chamado', Largura , altura , true ou false para transparente)
function addSWF   (URL, WIDTH, HEIGHT, TRANSPARENT)
{
document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
document.write (' <param name="movie" value="'+ URL +'" />');
document.write (' <param name="quality" value="high" />');

if ( TRANSPARENT ) {
  document.write (' <param name="Wmode" value="Transparent" />');
}

document.write (' <embed src="'+ URL +'" quality="high" ');

if ( TRANSPARENT ) {
document.write (' Wmode = "transparent" ');
}

document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
document.write (' </object>');

}