function mouseover1(src,clrOver)

{
	/*if (!src.contains(event.fromElement))
	{*/
		src.style.cursor='hand';
		src.bgColor=clrOver;
		document.getElementById('img'+src.id).style.display='block'

	/*}*/
}

function mouseover(src,clrOver,numero)

{
	if(numero!=src.id){
		
		if (!src.contains(event.fromElement))
		{
			src.style.cursor='hand';
			src.bgColor=clrOver;
			document.getElementById('img'+src.id).style.display='block'
	
		}
	}
}

function mouseout(src,clrIn,numero)
{
	if(numero!=src.id){
		if (!src.contains(event.toElement))
		{
			src.style.cursor='default';
			src.bgColor=clrIn;
			document.getElementById('img'+src.id).style.display='none'		
		}
	}
}

// VALIDAÇÃO DE E-MAIL
function checkEmail(campo)
{
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(campo.value))
 {
   return (true)
 } if(campo.value!=""){
   alert("O e-mail informado não é valido.")
   campo.focus();
   campo.style.background='#E4B6BC';
   return (false)
 }
}


// Mostra e Esconde o Menu
function mostra(id){

var id
x = document.getElementById(id).style.display;

if(x == ''){
	document.getElementById(id).style.display='none';
}
else{
	document.getElementById(id).style.display='';
	}
}
	
function printSWF(nomeSWF,larguraSWF,alturaSWF,wmodeSWF){
document.write('<embed src="'+nomeSWF+'?rnd=000000022" type="application/x-shockwave-flash" width="'+larguraSWF+'" height="'+alturaSWF+'" wmode="'+wmodeSWF+'"></embed>')
}
// Valida Formulário de CURRICULO
function validaNews2(){

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#D7E6D5';
	return false
	}
if(document.form.cpf.value==''){
	alert("Campo Obrigatório!")
	document.form.cpf.focus();
	document.form.cpf.style.background='#D7E6D5';
	return false
	}
if(document.form.arquivo.value==''){
	alert("Campo Obrigatório!")
	document.form.arquivo.focus();
	document.form.arquivo.style.background='#D7E6D5';
	return false
	}

if(validacpf()){
return true
}else{
return false
}
}

function validaFormContato(){
	if(document.formContato.nome.value==''){
	alert("Campo Obrigatório!")
	document.formContato.nome.focus();
	document.formContato.nome.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.telefone.value==''){
	alert("Campo Obrigatório!")
	document.formContato.telefone.focus();
	document.formContato.telefone.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.Estado.value==0){
	alert("Campo Obrigatório!")
	document.formContato.Estado.focus();
	document.formContato.Estado.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.cidade.value==''){
	alert("Campo Obrigatório!")
	document.formContato.cidade.focus();
	document.formContato.cidade.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.email.value==''){
	alert("Campo Obrigatório!")
	document.formContato.email.focus();
	document.formContato.email.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.assunto.value==''){
	alert("Campo Obrigatório!")
	document.formContato.assunto.focus();
	document.formContato.assunto.style.background='#FFFFE5';
	return false
	}
	if(document.formContato.mensagem.value==''){
	alert("Campo Obrigatório!")
	document.formContato.mensagem.focus();
	document.formContato.mensagem.style.background='#FFFFE5';
	return false
	}

}

/*** 
* Descrição.: formata um campo do formulário de 
* acordo com a máscara informada... 
* Parâmetros: - objForm (o Objeto Form) 
* - strField (string contendo o nome 
* do textbox) 
* - sMask (mascara que define o 
* formato que o dado será apresentado, 
* usando o algarismo "9" para 
* definir números e o símbolo "!" para 
* qualquer caracter... 
* - evtKeyPress (evento) 
* Uso.......: <input type="textbox" 
* name="xxx"..... 
* onkeypress="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);"> 
* Observação: As máscaras podem ser representadas como os exemplos abaixo: 
* CEP -> 99.999-999 
*   -> 999.999.999-99 
* CNPJ -> 99.999.999/9999-99 
* Data -> 99/99/9999 
* Tel Resid -> (99) 999-9999 
* Tel Cel -> (99) 9999-9999 
* Processo -> 99.999999999/999-99 
* C/C -> 999999-! 
* Hora -> 99:99:99 
* E por aí vai... 
***/

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode; }
else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
}

sValue = objForm[strField].value;

// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( ":", "" );
sValue = sValue.toString().replace( ":", "" );
fldLen = sValue.length;
mskLen = sMask.length;

i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;

while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " ") || (sMask.charAt(i) == ":"))

if (bolMask) {
sCod += sMask.charAt(i);
mskLen++; }
else {
sCod += sValue.charAt(nCount);
nCount++;
}

i++;
}

objForm[strField].value = sCod;

if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
else { // qualquer caracter...
return true;
} }
else {
return true;
}
}
//Fim da Função Máscaras Gerais


//VALIDA CPF
function validacpf(){ 
  var i; 
  s = document.form.cpf.value; 
  s = s.toString().replace( "-", "" );
  s = s.toString().replace( ".", "" );
  s = s.toString().replace( ".", "" );  
  if (s.length < 11){
  	alert("CPF Invalido")
	return false;
  }
  var c = s.substr(0,9); 
  var dv = s.substr(9,2); 
  var d1 = 0; 
  for (i = 0; i < 9; i++){ 
  	d1 += c.charAt(i)*(10-i); 
  } 
  if (d1 == 0){ 
  	alert("CPF Invalido") 
    return false; 
  } 
  d1 = 11 - (d1 % 11); 
  if (d1 > 9) d1 = 0; 
  	if (dv.charAt(0) != d1) { 
  		alert("CPF Invalido") 
  		return false; 
    } 
    d1 *= 2; 
    for (i = 0; i < 9; i++){ 
    	d1 += c.charAt(i)*(11-i); 
    } 
    d1 = 11 - (d1 % 11); 
    if (d1 > 9) d1 = 0; 
    if (dv.charAt(1) != d1){ 
    	alert("CPF Invalido") 
  		return false; 
    } 
	return true; 
  
}

// Valida Formulário de envio de contato
function validaNews(){

email=document.form.email

if(document.form.nome.value==''){
	alert("Campo Obrigatório!")
	document.form.nome.focus();
	document.form.nome.style.background='#FFFFE5';
	return false
	}
if(document.form.email.value==''){
	alert("Campo Obrigatório!")
	document.form.email.focus();
	document.form.email.style.background='#FFFFE5';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}
} 	

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validaVisita(){

email=document.formVis.emailVIS

if(document.getElementById('nomeVIS').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('nomeVIS').focus();
	document.getElementById('nomeVIS').style.background='#FFFFE5';
	return false
	}
if(document.formVis.emailVIS.value==''){
	alert("Campo Obrigatório!")
	document.formVis.emailVIS.focus();
	document.formVis.emailVIS.style.background='#FFFFE5';
	return false		
	}
	else{
	 if(checkEmail(email)==false){
	  return false     
	  }
	}
if(document.getElementById('telefoneVIS').value==''){
	alert("Campo Obrigatório!")
	document.getElementById('telefoneVIS').focus();
	document.getElementById('telefoneVIS').style.background='#FFFFE5';
	return false
	}	
	else{
	retorna();
	}
}
function retorna(){
	var empresa  = document.getElementById('empresaVIS').value;
	var nome 	 = document.getElementById('nomeVIS').value;
	var email 	 = document.getElementById('emailVIS').value;
	var telefone = document.getElementById('telefoneVIS').value;
	var mensagem = document.getElementById('mensagemVIS').value;

	document.getElementById('empresaVIS_h').value = empresa;
	document.getElementById('nomeVIS_h').value = nome;
	document.getElementById('emailVIS_h').value = email;
	document.getElementById('telefoneVIS_h').value = telefone;
	document.getElementById('mensagemVIS_h').value = mensagem;
	
	formVis.submit();
	}
	
// StartCode \\
var dt = new Array();
var clockID = 0;

var cl_tf = '0';
var cl_df = '0';

function UpdateClock()
{
	if(clockID)
  	clearTimeout(clockID);

	var tDate = new Date();
	dt[0] = tDate.getFullYear();
	dt[1] = pad(tDate.getMonth()+1);
	dt[2] = pad(tDate.getDate());
	dt[3] = pad(tDate.getHours());
	dt[4] = pad(tDate.getMinutes());
	dt[5] = pad(tDate.getSeconds());

	dt_obj = document.getElementById('clock_dt');  // Este é o identificador da chamada "DATA"
	tm_obj = document.getElementById('clock_tm');  // Este é o identificador da chamada "HORA"
	
	dt_obj.innerHTML = formatDate();
	tm_obj.innerHTML = formatTime();

	clockID = setTimeout("UpdateClock()", 1000);
}

function pad(val)
{
	if(val <= 9)
	{
		val.toString();
		val = "0" + val;
	}

	return val;
}

function formatDate()
{
  var d;

	d = cl_df.replace(/Y/,dt[0]);
  d = d.replace(/m/,dt[1]);
  d = d.replace(/d/,dt[2]);

	return d;
}

function formatTime()
{
  var t;

	t = cl_tf.replace(/H/,dt[3]);
  t = t.replace(/i/,dt[4]);
  t = t.replace(/s/,dt[5]);

	return t;
}


function StartClock(df,tf)
{
	cl_df = df;
	cl_tf = tf;

	clockID = setTimeout("UpdateClock()", 500);
}

function KillClock()
{
	if(clockID)
	{
		clearTimeout(clockID);
		clockID  = 0;
	}
}

function setCookie(name,val,first)
{
	if(first)
		document.cookie = name + "=" + val;
	else
	  document.cookie += name + "=" + val;
}
	
