jQuery(function(){
	jQuery(".col-blogs #left .lista-blog-web li:first, .col-blogs #main .lista-blog-feed li:first, .col-blogs #right .lista-blog-cool li:first").css('border','none');
	
	$('.input-busca').focus(function(){
		$(this).css('background', '#DEDEDE');
		$(this).parent().css('background', '#DEDEDE');
	});
	
	$('.input-busca').blur(function(){
		$(this).css('background', '');
		$(this).parent().css('background', '');
	});

	jQuery(".menu-bar-header .menu ul li a").hover(function(){
		jQuery(".menu-bar-header .menu .barra-hover").stop().show().animate({left: $(this).position().left, width: $(this).outerWidth()}, 200);
		$(this).css('color', '#FFF');
	}, function(){
		$(this).css('color', '');
		$(".menu-bar-header .menu ul .current_page_item a").css('color', '#DADADA');
	});
	
	jQuery(".menu-bar-header").hover(function(){
		$(".menu-bar-header .menu ul li a").css('color', '#DADADA');
		$(".menu-bar-header .menu ul li a").css('border-top', '3px');
		$(".menu-bar-header .menu ul li a").css('padding-top', '20px');
	}, function(){
		jQuery(".menu-bar-header .menu .barra-hover").hide();
		$(".menu-bar-header .menu ul li a").css('color', '');
		$(".menu-bar-header .menu ul li a").css('border-top', '');
		$(".menu-bar-header .menu ul li a").css('padding-top', '');
	});	
	
	var maxwidth = 565;
	jQuery('#main .conteudo-post img').each(function(){
		if(jQuery(this).width() > maxwidth){
			jQuery(this).css('width',maxwidth+'px');
			jQuery(this).css('height','auto');
		}
	});
	
});
	


function validarDados()
{
	var er = new RegExp(/([\w\.-]{1,64}@[\w\.-]{1,252}\.\w{2,4})/);

	if(document.getElementById('nome').value == "" || document.getElementById('nome').value.lenght < 4 || document.getElementById('nome').value == "Seu Nome")
	{
		alert( "Preencha o campo 'NOME' corretamente!" );
		document.formulario.contato_nome.focus();
		return false;
	}
	
	if(!er.test(document.getElementById('email').value))
	{
		alert( "Preencha o campo 'E-MAIL' corretamente!" );
		document.formulario.contato_email.focus();
		return false;
	}
		
	/*if(document.getElementById('telefone').value == "" || document.getElementById('telefone').value.lenght < 11 || document.getElementById('telefone').value == "Telefone"){
		alert("Preencha o campo Telefone corretamente") ;
		document.formulario.contato_telefone.focus();
		return false;	
	}
	
	if (document.getElementById('comentario').value=="" || document.getElementById('comentario').value=="Sua Mensagem")
	{
		alert( "Preencha o campo MENSAGEM!" );
		document.formulario.contato_comentario.focus();
		return false;
	}
	
	if (document.getElementById('empresa').value=="" || document.getElementById('empresa').value=="Empresa"){
		
		alert( "Preencha o campo Empresa" );
		document.formulario.contato_empresa.focus();
		return false;
	}
	
	if (document.getElementById('input-setor').value=="" || document.getElementById('input-setor').value=="Setor/Indústria"){		
		alert( "Preencha o campo Setor/Indústria" );
		document.formulario.contato_setor.focus();
		return false;
	}
	
	if (document.getElementById('website').value=="" || document.getElementById('website').value=="Website"){		
		alert( "Preencha o campo Website" );
		document.formulario.contato_website.focus();
		return false;
	}
	
	if (document.getElementById('cidade').value=="" || document.getElementById('cidade').value=="Cidade"){		
		alert( "Preencha o campo Cidade" );
		document.formulario.contato_cidade.focus();
		return false;
	}
	
	if (document.getElementById('estado').value=="" || document.getElementById('estado').value=="Estado"){		
		alert( "Preencha o campo Estado" );
		document.formulario.contato_estado.focus();
		return false;
	}*/
	
	/*if (document.getElementById('input-pais').value=="" || document.getElementById('input-pais').value=="País"){		
		alert( "Preencha o campo País" );
		document.formulario.contato_pais.focus();
		return false;
	}*/
	
	/*if (document.getElementById('input-tempo-estimado-entrega').value=="" || document.getElementById('input-tempo-estimado-entrega').value=="Tempo estimado de entrega"){		
		alert( "Preencha o campo Tempo estimado de entrega" );
		document.formulario.contato_tempo_estimado-entrega.focus();
		return false;
	}
	
	if (document.getElementById('input-investimento-esperado').value=="" || document.getElementById('input-investimento-esperado').value=="Investimento estimado"){		
		alert( "Preencha o campo Investimento estimado" );
		document.formulario.contato_investimento_estimado.focus();
		return false;
	}
	
	if (document.getElementById('input-como-nos-encontrou').value=="" || document.getElementById('input-como-nos-encontrou').value=="Como nos encontrou"){		
		alert( "Preencha o campo Como nos encontrou" );
		document.formulario.contato_como_nos_encontrou.focus();
		return false;
	}*/
	
	if (document.getElementById('comentario').value=="" || document.getElementById('comentario').value=="Breve descrição do projeto"){		
		alert( "Preencha o campo Breve descrição do projeto" );
		document.formulario.contato_comentario.focus();
		return false;
	}
	return true;
}




$(function(){
	$('#foo2').carouFredSel({
		width: 950,
		height: 250,
		//next: '#next1',
		//prev: '#prev1',
		auto:{
			duration: 1500
		},
		infinite: false,
		prev: {
        		button: "#prev",
        		key: "left",
        		duration: 1500
    		},
    		next: {
        		button: "#next",
        		key: "right",
        		duration: 1500
    		}


	});
	
	$('#prev1').fadeTo(100, 0);
	$('#foo1').carouFredSel({
		width: 900,
		height: 91,
		//next: '#next1',
		//prev: '#prev1',
		circular: false,
		auto: false,
		infinite: false,
		prev: {
        		button: "#prev1",
        		key: "left",
        		duration: 1500,
        		onEnd: function(){
    				$('#prev1').fadeTo(100, 0);
    			}   			
    		},
    		next: {
        		button: "#next1",
        		key: "right",
        		duration: 1500,
        		onEnd: function(){
    				$('#next1').fadeTo(100, 0);
    			}
    		}

	});

});

$(function(){
	$('.case .overlay').mouseout(function(){
		$(this).parent().find('.fundo-deslizante').stop().animate({"top": 0, "left": 0}, 300);
	});
	$('.case .overlay').mouseover(function(){
		$(this).parent().find('.fundo-deslizante').stop().animate({"top": -262, "left": -314}, 300);	
	});
	
	$('.equipe .case .overlay').unbind('mouseover').unbind('mouseout');
	$('.equipe .overlay').hover(function(){
		$(this).parent().find('.fundo-deslizante').stop().animate({"top": -262, "left": -314}, 300);	
	}, function(){
		$(this).parent().find('.fundo-deslizante').stop().animate({"top": 0, "left": 0}, 300);
	});
});

$(function(){
	baixar();
});

function baixar(){
	$('#imagem-cliente').animate({"top": 10}, 2000, levantar);
}

function levantar(){
	$('#imagem-cliente').animate({"top": 0}, 2000, baixar);
}

$(function(){
	$('#span-box-sprite1').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
		//$("#box-sprite1")
		
		
		if($(this).data('clickado')){
			$('#box-sprite1').css("background-position","right top");
			$('#combobox-novo-site-institucional').val($('#span-box-sprite1 p').html());
		}else{
			$('#box-sprite1').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite2').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite2').css("background-position","right top");
			$('#combobox-novo-ecommerce').val($('#span-box-sprite2 p').html()) ;	
		}else{
			$('#box-sprite2').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite3').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite3').css("background-position","right top");
			$('#combobox-substituicao-ecommerce').val($('#span-box-sprite3 p').html()) ;	
		}else{
			$('#box-sprite3').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite4').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite4').css("background-position","right top");
			$('#combobox-solucoes-para-b2b').val($('#span-box-sprite4 p').html()) ;	
		}else{
			$('#box-sprite4').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite5').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite5').css("background-position","right top");
			$('#combobox-projeto-especial').val($('#span-box-sprite5 p').html()) ;	
		}else{
			$('#box-sprite5').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite6').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite6').css("background-position","right top");
			$('#combobox-discutir-possivel-parceria').val($('#span-box-sprite6 p').html()) ;
		}else{
			$('#box-sprite6').css("background-position","left top");		
		}	
	});
	
	$('#span-box-sprite7').click(function(){
		if(!$(this).data('clickado')){
			$(this).data('clickado', 1);
		}
		else{
			$(this).data('clickado', 0);
		}
	
		
		
		if($(this).data('clickado')){
			$('#box-sprite7').css("background-position","right top");
			$('#combobox-outros').val($('#span-box-sprite7 p').html()) ;
		}else{
			$('#box-sprite7').css("background-position","left top");		
		}	
	});
	
	
	$('#campo-absoluto-setor a').click(function(){
		$('#campo-setor span').html($(this).html()) ;
		$('#input-setor').val($(this).html()) ;		
		$('#campo-absoluto-setor').css("display", "none") ;
	});	
	
	$('#campo-setor').click(function(){		
		if($('#campo-absoluto-setor').css("display") == "block") {
			$('#campo-absoluto-setor').css("display", "none") ;			
		}else{		
			$('.hide').css("display","none") ;	
			$('#campo-absoluto-setor').css("display", "block") ;
		}
		
	});
	
	$('#campo-absoluto-pais a').click(function(){
		$('#campo-pais span').html($(this).html()) ;
		$('#input-pais').val($(this).html()) ;		
		$('#campo-absoluto-pais').css("display", "none") ;
	});
	
	$('#campo-pais').click(function(){
		if($('#campo-absoluto-pais').css("display") == "block") {
			$('#campo-absoluto-pais').css("display", "none") ;			
		}else{		
			$('.hide').css("display","none") ;	
			$('#campo-absoluto-pais').css("display", "block") ;
		}	
	});
	
	$('#campo-absoluto-tempo-estimado-entrega a').click(function(){
		$('#campo-tempo-estimado-entrega span').html($(this).html()) ;
		$('#input-tempo-estimado-entrega').val($(this).html()) ;		
		$('#campo-absoluto-tempo-estimado-entrega').css("display", "none") ;
	});
	
	$('#campo-tempo-estimado-entrega').click(function(){		
		if($('#campo-absoluto-tempo-estimado-entrega').css("display") == "block") {
			$('#campo-absoluto-tempo-estimado-entrega').css("display", "none") ;			
		}else{	
			$('.hide').css("display","none") ;		
			$('#campo-absoluto-tempo-estimado-entrega').css("display", "block") ;
		}	
	});	
		
	$('#campo-absoluto-investimento-esperado a').click(function(){
		$('#campo-investimento-esperado span').html($(this).html()) ;
		$('#input-investimento-esperado').val($(this).html()) ;		
		$('#campo-absoluto-investimento-esperado').css("display", "none") ;
	});
	
	$('#campo-investimento-esperado').click(function(){		
		if($('#campo-absoluto-investimento-esperado').css("display") == "block") {
			$('#campo-absoluto-investimento-esperado').css("display", "none") ;			
		}else{	
			$('.hide').css("display","none") ;		
			$('#campo-absoluto-investimento-esperado').css("display", "block") ;
		}	
	});
	
	$('#campo-absoluto-como-nos-encontrou a').click(function(){
		$('#campo-como-nos-encontrou span').html($(this).html()) ;
		$('#input-como-nos-encontrou').val($(this).html()) ;		
		$('#campo-absoluto-como-nos-encontrou').css("display", "none") ;
	});
	
	$('#campo-como-nos-encontrou').click(function(){		
		if($('#campo-absoluto-como-nos-encontrou').css("display") == "block") {
			$('#campo-absoluto-como-nos-encontrou').css("display", "none") ;			
		}else{	
			$('.hide').css("display","none") ;		
			$('#campo-absoluto-como-nos-encontrou').css("display", "block") ;
		}	
	});


	$('#nome').focus(function(){
		if($(this).val()=="Seu Nome"){
			$(this).val('') ;
		}		
	});
	
	$('#nome').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Seu Nome') ;
		}				
	});	
		
	$('#email').focus(function(){
		if($(this).val()=="Seu Email"){
			$(this).val('') ;
		}		
	});
	
	$('#email').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Seu Email') ;
		}				
	});
	
	$('#email').focus(function(){
		if($(this).val()=="Seu Email"){
			$(this).val('') ;
		}		
	});
	
	$('#telefone').focus(function(){
		if($(this).val()=="Telefone"){
			$(this).val('') ;
			$("#telefone").mask("(99) 9999-9999");
		}		
	});	
	
	$('#telefone').blur(function(){
		if($(this).val().length == 0 || $(this).val() == '(__) ____-____'){
			$("#telefone").unmask();
			$(this).val('Telefone') ;
		}				
	});		
	
	$('#empresa').focus(function(){
		if($(this).val()=="Empresa"){
			$(this).val('') ;	
		}	
	});	
	
	$('#empresa').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Empresa') ;
		}				
	});	
	
	$('#website').focus(function(){
		if($(this).val()=="Website"){
			$(this).val('') ;	
		}	
	});	
	
	$('#website').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Website') ;
		}				
	});
	
	
	$('#cidade').focus(function(){
		if($(this).val()=="Cidade"){
			$(this).val('') ;	
		}	
	});	
	
	$('#cidade').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Cidade') ;
		}				
	});	
	
	
	$('#estado').focus(function(){
		if($(this).val()=="Estado"){
			$(this).val('') ;	
		}	
	});	
	
	$('#estado').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Estado') ;
		}				
	});	
	
	$('textarea#comentario').focus(function(){
		if($(this).val()=="Breve descrição do projeto"){
			$(this).val('') ;	
		}	
	});	
	
	$('textarea#comentario').blur(function(){	
		if($(this).val().length == 0){
			$(this).val('Breve descrição do projeto') ;
		}				
	});
	
	$('#arquivo').change(function(){
		if($("#arquivo").val().indexOf('C:\\fakepath\\') != -1){
			$('#file').val($("#arquivo").val().split('C:\\fakepath\\')[1]);
	
		}
		else{
			$('#file').val($('#arquivo').val());
		}
	});
	
	$(".ver-mapa").fancybox({
		'width'			: '80%',
		'height'		: '80%',
		'autoScale'		: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'			: 'iframe'
	});
	
	$('.membro-equipe a').tooltip({
		track: true, 
    		delay: 0, 
	 	showURL: false, 
		showBody: " - ", 
		fade: 250,  
    		top: -65, 
    		left: -10 
	});
});

function mudaCliente(id){
	$('.col-set-clientes').load('../wp-content/themes/pontocom-novo/ajax-cliente.php?id='+id);
}

function mudaImagemCliente(url){
	$('#imagem-cliente img').attr('src', url);
}

jQuery(function(){ 
	$('.conteudo-post iframe').each(function(){
		var url = $(this).attr('src');
		if(url.length){
			var y = url.split('?');
			url = y[0]+'?wmode=transparent';
			$(this).attr('src', url);
		}
	});

	$('embed').attr('wmode', 'transparent');
	$('object, embed').css('position', 'relative');
	
});




function verMaisBlogs(){
	$('.vermais').addClass("loading");
	
	$.get('../wp-content/themes/pontocom-novo/ajax-blogs.php?id=' + 1265 + '&offset=' + $('ul.lista-blog-web li').length, function(html){
		if(html.length){
			$(html).appendTo('ul.lista-blog-web');
		}
	});
	
	$.get('../wp-content/themes/pontocom-novo/ajax-blogs.php?id=' + 1264 + '&offset=' + $('ul.lista-blog-feed li').length, function(html){
		if(html.length){
			$(html).appendTo('ul.lista-blog-feed');
		}
	});
	
	$.get('../wp-content/themes/pontocom-novo/ajax-blogs.php?id=' + 1266 + '&offset=' + $('ul.lista-blog-cool li').length, function(html){
		if(html.length){
			$(html).appendTo('ul.lista-blog-cool');
		}
		
		$('.vermais').removeClass("loading");
	});
}




