// JavaScript Document

var GB_ANIMATION = true;
var nomeFormComentario = 0;
var empresaFormComentario = 0;
var emailFormComentario = 0;
var comentarioFormComentario = 0;
var twitterFormComentario = 0;

function inputClean(field){
	
	if(field == 'nomes' && nomeFormComentario == 0){
		nomeFormComentario++;
		$("#"+field).val('');
		
	}else if(field == 'nome' && nomeFormComentario == 0){
		nomeFormComentario++;
		$("#"+field).val('');
		
	}else if(field == 'email' && emailFormComentario == 0){
		
		emailFormComentario++;
		$("#"+field).val('');
		
	}else if(field == 'empresa' && empresaFormComentario == 0){
		
		empresaFormComentario++;
		$("#"+field).val('');
		
	}else if(field == 'comentario' && comentarioFormComentario == 0){
		
		comentarioFormComentario++;
		$("#"+field).val('');
		
	}else if(field == 'twitter' && twitterFormComentario == 0){
		
		twitterFormComentario++;
		$("#"+field).val('');
		
	}	
	
}

function submitform(){
	
	

	if($('#nomes').val() == '' || $('#nomes').val() == 'Seu nome?'){
		
		alert("Preencha o campo nome");
		
	}else if($('#email').val() == '' || $('#email').val() == 'Seu e-mail?'){
		
		alert("Preencha o campo e-mail");
		
	}else if($('#empresa').val() == '' || $('#empresa').val() == 'Qual empresa você trabalha?'){
		
		alert("Preencha o campo empresa");
		
	}else if($('#comentario').val() == '' || $('#comentario').val() == 'Deixe sua mensagem aqui!'){
		
		alert("Preencha o campo comentario");
		
	}else{
		$.post("rotina/enviaComentario.php", { nome: $('#nomes').val(), email: $('#email').val(), empresa: $('#empresa').val(), comentario: $('#comentario').val(), code: $('#code').val(),urlBack: $('#urlBack').val(), postNot: $('#postNot').val(), twitter: $('#twitter').val() },
		   function(data){
    		 alert(data);
			 var sucesso = data.split('obrigado');
			 
			 if(sucesso.length > 1){
				 
				 var url = $('#urlBack').val();
				 window.open(url,'_self');
				 
				 }
   		});
		//document.myform.submit();
	}
}

function submitContato(){
	
	$.post("rotina/enviaComentario.php", { nomeContato: $('#nomeContato').val(), email: $('#email').val(), empresa: $('#empresa').val(), telefone: $('#telefone').val(), msg: $('#msg').val()},
		   function(data){
    		 alert(data);
			 var sucesso = data.split('Obrigado');
			 
			  if(sucesso.length > 1){
			
				  $('#nomeContato').val(''); 
				  $('#email').val(''); 
				  $('#empresa').val(''); 
				  $('#telefone').val('');
				  $('#msg').val('');			 
				 
				 } 
   		});
	//document.contatoMarketeria.submit();
}



function showForm(){
	$("#formComentario").show('fast');
	
}

function hideForm(){
	$("#formComentario").hide('fast');
	
}


$(document).ready(function(){	
						   
$("#formComentario").hide();

$("#telefone").mask("(99) 9999-9999");


/* MENU */
 
 	$("#menu li a").mouseover(function(){
		$(this).stop().animate({paddingTop:'80px'},{queue:false, duration:900, easing: 'easeOutBounce'})
	});
	
	$("#menu li a").mouseout(function(){
		$(this).stop().animate({paddingTop:'70px'},{queue:false, duration:900, easing: 'easeOutBounce'})
	});
	


/* IMAGENS / LEGENDA */

	 $('.item span', this ).hide();		 


	 $('.item').mouseenter(function() {
		 $('span', this ).show('fast');		 
	 });
	 
	 $('.item').mouseleave(function() {
		 $('span', this ).hide('fast');		 

	 }); 
	
/* janela pop up */
$("a.greybox").click(function(){
		//var t = this.title || $(this).text() || this.href;
		var t = " " || $(this).text() || this.href;
		GB_show(t,this.href,470,600);
		return false;
	});
});

function callLink(linkPost, before){
	
}