
function menu(local, tam){
	tam+=85;
	local.style.fontWeight="lighter";
	$(local).animate({backgroundPosition: "("+tam+" 0px)"}, 500);

}
function menu2(local){
	$(local).animate({backgroundPosition: "(85 0px)"}, 500);
	local.style.fontWeight="bold";
	
}

function limpaPesq(local){
	local.value="";
	local.style.color="#7F8BA1";
}
function aumenta(){
	document.getElementById('estrutura_conteudo').style.height="536px";
}

//Tem o objetivo de receber o tipo de menu clicado e joga-lo na div subConteudo
function cardapio(arquivo){
//	document.getElementById('estrutura_conteudo').style.height="526px";
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer 
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				
				alert("Seu navegador parou!");
				return false;
			}
		}
	}
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if(arquivo=="servicos.php"){
				document.getElementById('subMenu').style.backgroundImage="url(img/fundo.png)";
				document.getElementById('subMenu').innerHTML = ajaxRequest.responseText;
				$('.kwicks').kwicks({
					max : 790,
					spacing : 5,
					sticky : true,
					event : 'click'
				});
			}
			else if(arquivo=="empresa.php"){
				document.getElementById('subMenu').style.backgroundImage="url(img/subMenu.png)";
				document.getElementById('subMenu').innerHTML = ajaxRequest.responseText;
			}
			else if(arquivo=="depoimentos.php" || arquivo=="contatos.php"){
				document.getElementById('subMenu').style.backgroundImage="url(img/subMenu.png)";
				document.getElementById('subMenu').innerHTML = ajaxRequest.responseText;
			}
			else if(arquivo=="proposta.php"){
				document.getElementById('subMenu').style.backgroundImage="url(img/fundo.png)";
				document.getElementById('subMenu').innerHTML = ajaxRequest.responseText;
				document.getElementById("nome").focus();
			}
			else{
				document.getElementById('subMenu').style.height="526px";
				document.getElementById('subMenu').style.backgroundImage="url(img/fundo.png)";
				document.getElementById('subMenu').innerHTML = ajaxRequest.responseText;
				//$('#tableContatos').animate({width:'400px;'},600);
			}
		}
	}
	
	//var complemento = "?email="+email+"&senha="+senha;
	ajaxRequest.open("GET", arquivo, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//ajaxRequest.setRequestHeader('Content-Type','text/xml');
    ajaxRequest.setRequestHeader('encoding','ISO-8859-1');
	ajaxRequest.send(null); 
}


function legenda(string){
	string+=" || Clique para entrar em nossa Galeria!";
	document.getElementById('barra').innerHTML=string;
}


function fecha(){
	$('#infoCompleta').fadeOut();
}

function mascaraFone(local,string){
		if(string.length == 2 ) local.value = "("+string+")";
		if(string.length == 8 ) local.value = string+"-";
		if(string.length == 13){
			document.getElementById("cel").focus();
			validaFone(local,string);
		}
		}
		
function validaFone(local,string){
		if(string.length < 12 || string.length == 0){
			document.getElementById("spFone").innerHTML="**";
			document.getElementById("spFone").style.color="red";
			local.focus();
		}
		else if(string.length == 12){
			document.getElementById("spFone").innerHTML="";
			document.getElementById("cel").focus();
		}
	}

function mascaraCep(local,string){
		if(string.length==0)local.focus();
		if(string.length==5)local.value+="-";
		if(string.length==8){
		document.getElementById("cidade").focus();
		}
	}
	
function enviada(){
	if(validaCampos()){
		var nome = document.getElementById('nome').value;
		enviada2(nome);
		$('#tabela').fadeOut();
		$('#sendMail').fadeIn();
		$('#sendMail').animate({
			marginLeft:'300px',
			marginTop:'150px',
			width:'344px',
			height:'213px'},
			900,
			function(){
				$('#sendMail').css('background-color', 'transparent');
				$('#sendMail').css('background-image', 'url(\'img/panel.png\')');
				$('#msgMail').fadeIn();
				});
		setTimeout("$('#sendMail').fadeOut();",5000);
		setTimeout("$('#form1').submit();",5400);
	}
	else{
		return;
		}
	 };
	 
	 
function envia2(){
	if(validaContato()){
		var nome = document.getElementById('nome').value;
		enviada2(nome);
		//$('#tabela').fadeOut();
		$('#sendMail').fadeIn();
		$('#sendMail').animate({
			marginLeft:'140px',
			marginTop:'50px',
			width:'344px',
			height:'213px'},
			900,
			function(){
				$('#sendMail').css('background-color', 'transparent');
				$('#sendMail').css('background-image', 'url(\'img/panel.png\')');
				$('#msgMail').fadeIn();
				});
		setTimeout("$('#sendMail').fadeOut();",5000);
		setTimeout("$('#form2').submit();",5400);
	}
	else{
		return;
		}
	 };
	 
	 
	 
	 
function enviada2(nome){
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer 
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				
				alert("Seu navegador parou!");
				return false;
			}
		}
	}
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('sendMail').innerHTML = ajaxRequest.responseText;
		}
	}
	
	var arquivo = "enviada2.php?nome="+nome;
	ajaxRequest.open("GET", arquivo, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//ajaxRequest.setRequestHeader('Content-Type','text/xml');
    ajaxRequest.setRequestHeader('encoding','ISO-8859-1');
	ajaxRequest.send(null); 
}

function suporte(){
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer 
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				
				alert("Seu navegador parou!");
				return false;
			}
		}
	}
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('subConteudo').innerHTML = ajaxRequest.responseText;
		}
	}
	
	var arquivo = "suporte.php";
	ajaxRequest.open("GET", arquivo, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//ajaxRequest.setRequestHeader('Content-Type','text/xml');
    ajaxRequest.setRequestHeader('encoding','ISO-8859-1');
	ajaxRequest.send(null); 
}



function validaCampos(){
	var nome = document.getElementById('nome').value;
	var fone = document.getElementById('tel').value;
	var cel  = document.getElementById('cel').value;
	var email = document.getElementById('email').value;
	if(nome==''){
		alert('Preencha o campo Nome!');
		document.getElementById('nome').focus();
		return false;
	}
	if(email==''){
		alert('Preencha o campo Email!');
		document.getElementById('email').focus();
		return false;
	}
	if(fone=='' && cel==''){
		alert('Preencha ao menos um dos campos de Telefones!');
		document.getElementById('cel').focus();
		return false;
	}
	return true;
}


function validaContato(){
	var nome = document.getElementById('nome').value;
	var fone = document.getElementById('fone').value;
	var msg  = document.getElementById('mensagem').value;
	var email = document.getElementById('email').value;
	if(nome==''){
		alert('Preencha o campo Nome!');
		document.getElementById('nome').focus();
		return false;
	}
	if(email==''){
		alert('Preencha o campo Email!');
		document.getElementById('email').focus();
		return false;
	}
	if(msg==''){
		alert('Preencha o campo Mensagem!');
		document.getElementById('mensagem').focus();
		return false;
	}
	if(fone==''){
		alert('Preencha o campo de Telefone!');
		document.getElementById('fone').focus();
		return false;
	}
	return true;
};


function curriculo(){
	var campoTitulo = document.getElementById('contentTitulo');
	var campoString = document.getElementById('contentString');
	var campoInput = document.getElementById('contentCampo');
	var campoBotao = document.getElementById('contentButton');
	
	campoTitulo.innerHTML='Envio de Curriculum';
	campoString.innerHTML='Selecione o anexo:';
	campoInput.innerHTML="<input type='file' name='curriculo' id='curriculo' />";
	campoBotao.innerHTML="<img src='img/proposta.png' width='160' height='50' style='cursor:pointer;' onclick='sendCurriculo();' />";
	document.getElementById('form2').action='sendCurriculo.php';
	
};

function sendCurriculo(){
		var nome = document.getElementById('nome').value;
		enviada2(nome);
		//$('#tabela').fadeOut();
		$('#sendMail').fadeIn();
		$('#sendMail').animate({
			marginLeft:'140px',
			marginTop:'50px',
			width:'344px',
			height:'213px'},
			900,
			function(){
				$('#sendMail').css('background-color', 'transparent');
				$('#sendMail').css('background-image', 'url(\'img/panel.png\')');
				$('#msgMail').fadeIn();
				});
		setTimeout("$('#sendMail').fadeOut();",5000);
		setTimeout("$('#form2').submit();",5400);
}

function troca(cod,foto){
	var vetor=document.getElementsByTagName("*");
	for (i=0; i<vetor.length; i++) {
		if (vetor[i].className==cod) {
			vetor[i].style.backgroundImage="url("+foto+")";		
	}}
}

function destroca(cod,foto2){
	var vetor=document.getElementsByTagName("*");
	for (i=0; i<vetor.length; i++) {
		if (vetor[i].className==cod) {
			vetor[i].style.backgroundImage="url("+foto2+")";		
	}}
}


var atual;
function abre(codigo){
	atual=codigo;
	
	var ajaxRequest;
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer 
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				
				alert("Seu navegador parou!");
				return false;
			}
		}
	}
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('ic2').innerHTML = ajaxRequest.responseText;
			$('#infoCompleta').fadeIn();
			$('#ic2').fadeIn();
			
		}
	}
	
	var arquivo = "view.php?codigo="+codigo;
	ajaxRequest.open("GET", arquivo, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	//ajaxRequest.setRequestHeader('Content-Type','text/xml');
    ajaxRequest.setRequestHeader('encoding','ISO-8859-1');
	ajaxRequest.send(null); 
	
}
function proxima(){
	abre(atual+1);
}
function anterior(){
	abre(atual-1);
}












