$(document).ready(function(){
	//OVER DOS DESTAQUES
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'140px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'195px'},{queue:false,duration:160});
	});

	//OVER DOS PROJETOS
	$('.boxgrid2.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'170px'},{queue:false,duration:160});
	});
});


function abreGaleria(id) {
	var objLink = document.createElement('a');
	objLink.rel = 'lyteframe';
	objLink.href = 'galeria.php?idGal='+id;
	objLink.rev = 'width:650px;height:480px;scrolling:no;';
	myLytebox.start(objLink, false, true);
}


function abreVideo(id) {
	var objLink = document.createElement('a');
	objLink.rel = 'lyteframe';
	objLink.href = 'video.php?id='+id;
	objLink.rev = 'width:432px;height:350px;scrolling:no;';
	myLytebox.start(objLink, false, true);
}


function visualizaVibo(id) {
	window.open('vibo/?id='+id,'Vibo','width=955, height=680');
}

function trocaItemBox(s, div, txt){
	document.getElementById('apaga').style.display = "none";
	document.getElementById(div).style.display = "none";
	document.getElementById(txt).innerHTML = s;
	document.getElementById('campoDepar').value = s;
}
function showBox(s){
	document.getElementById(s).style.display = "block";
}
function someBox(s){
	document.getElementById(s).style.display = "none";
}
function itemBox(s){
	if(document.getElementById(s).style.display == "none"){
		document.getElementById('apaga').style.display = "block";
		document.getElementById(s).style.display = "block";
	} else {
		document.getElementById(s).style.display = "none";
	}
}
function setNomeCampoFot (campo, valor){
	document.getElementById(campo).value = valor;
	alert('Foto enviada com sucesso!');
}
function resetNomeCampoFot (campo){
	document.getElementById(campo).value = '';
	alert('Foto removida com sucesso!');
}
function setNomeCampoArq (campo, valor){
	document.getElementById(campo).value = valor;
	alert('Currículo enviado com sucesso!');
}
function resetNomeCampoArq (campo){
	document.getElementById(campo).value = '';
	alert('Currículo removido com sucesso!');
}
function verificaMail(email) {
	var campo = email;
	if (campo.indexOf("@")<1) {
		return false;
	}
	if (campo.charAt(campo.indexOf("@")-1) == ".") {
		return false;
	}
	if (campo.lastIndexOf(".")<=campo.indexOf("@")) {
		return false;
	}
	if (campo.lastIndexOf(".") == (campo.length-1)) {
		return false;
	}
	return true;
}
function valida() {
	sNome = document.getElementById('campoNome').value;
	sEmail = document.getElementById('campoEmail').value;
	sMsg = document.getElementById('campoMsg').value;
	
	if(sNome == '' || sEmail == '' || sMsg == '' || sNome == 'nome' || sEmail == 'email' || sMsg == 'mensagem'){
		alert('Preencha todos os campos.');
	}else if(verificaMail(sEmail) == false){
		alert('Digite um e-mail válido.');
	}else{
		document.getElementById('formContato').submit();
	}
}
function validaCurri() {
	sNome = document.getElementById('campoNome').value;
	sEmail = document.getElementById('campoEmail').value;
	
	sDDD1 = document.getElementById('campoDDD1').value;
	sDDD2 = document.getElementById('campoDDD2').value;
	sDDD3 = document.getElementById('campoDDD3').value;
	
	sTel1 = document.getElementById('campoTel1').value;
	sTel2 = document.getElementById('campoTel2').value;
	sTel3 = document.getElementById('campoTel3').value;
	
	sDepar = document.getElementById('campoDepar').value;
	sFoto = document.getElementById('fotoCurriculo').value;
	sCurric = document.getElementById('arqCurriculo').value;
	
	
	
	if(sNome == ''){
		alert('O campo "nome completo" é obrigatório.');
	}else if(sEmail == ''){
		alert('O campo "e-mail" é obrigatório.');
	}else if(verificaMail(sEmail) == false){
		alert('Digite um e-mail válido.');
	}else if(sDDD1 == ''){
		alert('O campo "telefone" é obrigatório.');
	}else if(sDDD2 == ''){
		alert('O campo "telefone celular" é obrigatório.');
	}else if(sDDD3 == ''){
		alert('O campo "telefone alternativo" é obrigatório.');
	}else if(sTel1 == ''){
		alert('O campo "telefone" é obrigatório.');
	}else if(sTel2 == ''){
		alert('O campo "telefone celular" é obrigatório.');
	}else if(sTel3 == ''){
		alert('O campo "telefone alternativo" é obrigatório.');
	}else if(sDepar == ''){
		alert('O campo "Área de interesse" é obrigatório.');
	}else if(sFoto == ''){
		alert('O campo "foto" é obrigatório.');
	}else if(sCurric == ''){
		alert('O campo "currículo" é obrigatório.');
	}else{
		document.getElementById('formTrabalhe').submit();
	}
}

function evita_letra(tecla)
{
	var keyCode = tecla.keyCode ? tecla.keyCode : tecla.which ? tecla.which : tecla.charCode;
	//alert(keyCode);
	if(keyCode !=8 && keyCode !=13 && keyCode !=9)
	{
		if (keyCode < 48 || keyCode > 57)
		{
			if (window.event) //IE
			tecla.returnValue = false;
			else //Firefox
			tecla.preventDefault();
		}
	}
}

function formatar(src, mask,event){
	var tecla = event.keyCode;
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)
	
	if (texto.substring(0,1) != saida && tecla!=8)	{
		src.value += texto.substring(0,1);
	}
}

function abrePagina(id) {
	if(!isNaN(id)){
		$("#portifolio").load("lista_port.php?pagina="+id);
	} else {
		$("#portifolio").load("lista_port.php?pagina=1");
	}
}

var myTimeGal;
var i = 190;
function movTo(){
	if(i>0.1){
		window.scrollBy(0,i);
		myTimeGal = setTimeout('movTo()', 5);
		i = i*0.8;
	} else {
		clearTimeout(myTimeGal);
		i = 190;
	}
}




















