//ESTEVAM MENDES
//26/05/2011
/*/estevam.mendes@levitron.com.br*/
$D = function(id)
{
	return document.getElementById(id);	
}
$DN = function(id)
{
	return document.getElementsByName(id);	
}

//VALIDA INDEX
function validaHome()
{
	var retorno = '0';
	retorno += abreDiv2('nome','nome');
	retorno += abreDiv2('email','email');
	retorno += abreDiv2('ddd','ddd');
	retorno += abreDiv2('telefone','telefone');
	retorno += abreDiv2('mensagem','mensagem');
	
	if(retorno!='0')
	{
		return false;	
	}
}
//VALIDA FALE CONOSCO
function validaFale()
{
	var retorno = '0';
	retorno += abreDiv('departamento','departamento');
	retorno += abreDiv('nomeFale','nomeFale');
	retorno += abreDiv('empresaFale','empresaFale');
	retorno += abreDiv('emailFale','emailFale');
	retorno += abreDiv('mensagemFale','mensagemFale');
	
	if(retorno!='0')
	{
		return false;	
	}
}
// VALIDA TRABALHE CONOSCO
function validaTrab()
{
	var retorno = '0';
	retorno += abreDiv('nomeTrab','nomeTrab');
	retorno += abreDiv('dddTrab','dddTrab');
	retorno += abreDiv('tel1Trab','tel1Trab');
	retorno += abreDiv('tel2Trab','tel2Trab');
	retorno += abreDiv('file[]','file[]');	
	if(retorno!='0')
	{
		return false;	
	}
}
//FUNÇÃO ABRE DIV 
function abreDiv2(idV,idFocus)
{	
	if( ($D(idV).value=='nome') || ($D(idV).value=='') ) 
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else if( ($D(idV).value=='e-mail') || ($D(idV).value=='') ) 
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else if( ($D(idV).value=='ddd') || ($D(idV).value=='') ) 
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else if( ($D(idV).value=='telefone') || ($D(idV).value=='') ) 
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else if( ($D(idV).value=='mensagem') || ($D(idV).value=='') ) 
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else	
	{		
		$D(idFocus).style.backgroundColor = '';
		return '';	
	}
}
	
function abreDiv(idV,idFocus)
{		
	if($D(idV).value=='' || $D(idV).value == '--')
	{		
		$D(idFocus).style.backgroundColor = '#C6C6FF';		
		return 1;	
	}
	else	
	{		
		$D(idFocus).style.backgroundColor = '';
		return '';	
	}
}
//VALIDA EMAIL
function validaEmail(id)
{	
	$D(id).style.backgroundColor = '#C6C6FF';		
	var email = $D(id).value;		
	if(email.indexOf("@")==-1 || email.indexOf(".")==-1)		
	{				
		$D(id).style.backgroundColor = '#C6C6FF';	
		return 1;
	}
	else
	{
		$D(id).style.backgroundColor = '';
		return '';
	}		
}
