$(document).ready(function(){

	//mascara telefone
	$("#tel").mask("(99)9999-9999");
	
		
	var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
	var IE7 = (navigator.userAgent.indexOf("MSIE 7")>=0) ? true : false;

	/****************************************/
	
	if(IE6 || IE7){}
	else{
		$('.menu > ul > li').hoverIntent({
			over: function(){
				$(this).children('ul').css('display', 'block');
			},
			out: function(){
				$(this).children('ul').css('display', 'none');
			},
			timeout: 100
		});		
	}
	
	 //Tira nome e e-mail do campo quando a pessoa clica //receba notícias zigma
 
 	$("#login").focus(function(){if($(this).val() == 'login') $(this).val('');});
	$("#login").blur(function(){if($(this).val() == '') $(this).val('login');});
	
	$("#senha").focus(function(){if($(this).val() == 'senha') $(this).val('');});
	$("#senha").blur(function(){if($(this).val() == '') $(this).val('senha');});
	
	//
	
	$(".realupload").change(function(){
	
		$(".fakeupload").val( $(this).val() );
		
		console.log($(this.val()));
		
	});
	
	//
	
	$("a[rel=fotos]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
	});
	
	$(".youtube").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	
	//validação formulário
	$("#formContato").submit(function(){
		
		var campo_nome = $("#nome").val();
		var campo_email = $("#email").val();
		var campo_mensagem = $("#mensagem").val();
		var erro = 0;
		
		$("#limpar_nome_contato").html('');
		$("#limpar_nome_contato").html('');
		$("#limpar_nome_contato").html('');
		
		if(campo_nome ==""){
		erro=1; 
		$("#limpar_nome_contato").html('Informe o seu nome corretamente');		
		}
		
		if(campo_email.indexOf('@')==-1 && campo_email.indexOf('.com')==-1){
		erro=1; 
		$("#limpar_email_contato").html('Informe o seu email corretamente');
		}
		
		if(campo_mensagem =="" ){
		erro=1;
		$("#limpar_msg_contato").html('Informe uma mensagem com no mínimo 2 caracteres');
		}
		
		if(erro > 0){
			return false;
		} else{
			return true;
		}
	});	 
	
	$("#formFornecedor").submit(function(){
		var campo_nome = $("#nome").val();
		var campo_email = $("#email").val();
		var erro = 0;
		
		
		if(campo_nome ==""){
		erro=1; 
		$("#limpar_nome_fornecedor").html('Informe o seu nome corretamente');		
		}
		if(campo_email.indexOf('@')==-1 && campo_email.indexOf('.com')==-1){
		erro=1; 
		$("#limpar_email_fornecedor").html('Informe o seu email corretamente');
		}
		if(erro > 0){
			return false;
		} else{
			return true;
		}
	});
	
	$("#formLicitacao").submit(function(){
		var campo_nome = $("#nome").val();
		var campo_email = $("#email").val();
		var erro = 0;
		
		
		if(campo_nome ==""){
		erro=1; 
		$("#limpar_nome_licitacao").html('Informe o seu nome corretamente');		
		}
		if(campo_email.indexOf('@')==-1 && campo_email.indexOf('.com')==-1){
		erro=1; 
		$("#limpar_email_licitacao").html('Informe o seu email corretamente');
		}
		if(erro > 0){
			return false;
		} else{
			return true;
		}
	});
 	
});


