// JavaScript Document
function empty(id, txt) {
	
	var target = document.getElementById(id);
	var texto = target.value;
	
	if(texto == txt) { target.value = ""; }
	else { texto = texto; }
	
	target.onblur = function() {
		if(target.value=="") {
			target.value = texto;
		} 		
	}
}


var nomes = new Array();
nomes = ["winits", "suzuki", "cassio", "rita", "nivea"];

var nomes_home = new Array();
nomes_home = ["winits_home", "suzuki_home", "cassio_home", "rita_home", "nivea_home"];

var dicasId = new Array();
dicasId = ["sol", "pao", "vegetais", "pressao", "mamao", "goiabada", "centelha", "leite"];

function comment(n) {
	for(var i=0; i<nomes.length; i++){
		document.getElementById(nomes[i]).className = "text_off";
	}
	document.getElementById(nomes[n]).className = "text_on";
}

function callHome(h) {
	for(var j=0; j<nomes_home.length; j++){
		document.getElementById(nomes_home[j]).className = "chamada_off";
	}
	document.getElementById(nomes_home[h]).className = "chamada_on";
}

function chamaDica(c) {
	for(var s=0; s<dicasId.length; s++){
		document.getElementById(dicasId[s]).className = "dica_off";
	}
	document.getElementById(dicasId[c]).className = "dica_on";
}

function openWindow(mypage, w, h, myname) {
	
	var winl = (screen.width - w)/2;
	var wint = (screen.height - h)/ 2;
	
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl;
	win = window.open(mypage, myname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,'+winprops);
	
}


function jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function mudaImagem(imagem) {
	alert(imagem);
	document.getElementById('imgZoom').src = imagem;

}

function init(){
	//Função de mostra da News Letter
	var param = window.location.search.substring(1);
	if(param=='sucesso'){
		var classe = document.getElementById('cadastrar').style.display = 'none';
		var classe = document.getElementById('sucesso').style.display = 'block';
	}
}


//Função para validação do formulário
function valida() {
 f = document.contato; 
 //Valida nome
 if(f.sNome.value == "") { 
  document.getElementById('valida_form').innerHTML='Por favor, preencha seu Nome'; 
  f.sNome.focus();  
  return false;
 } 
 //Valida e-mail
 if(f.sEmail.value == "") {
  document.getElementById('valida_form').innerHTML='Por favor, preencha seu E-mail'; 
  f.sEmail.focus();  
  return false;
 } 
 //valida mensagem
 if(f.sMensagem.value == "") {
  document.getElementById('valida_form').innerHTML='Por favor, escreva uma Mensagem'; 
  f.sMensagem.focus();  
  return false;
 } 
//Caso o retorno seja TRUE(1) 
 return true;
}//Final da função valida_forum....  
