

  
   function enviar(event) {  
      if( event.keyCode==13 ) { 
        $.colorbox({width:"1200px",height:"900px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=busca&busca="+$("#pesq-cla").val()});
      }  
   }  
 

 window.onload = function()
{
	
	$("#print-page").click(function(){
		window.print();
	});
	
	
	$("#bt-pesq").click(function(){
		
		$.colorbox({width:"1200px",height:"900px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=busca&busca="+$("#pesq-cla").val()});
		
	});
	
	$(".videoyoutube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
	$(".produto-class").click(function(){
		$.colorbox({width:"1000px",height:"808px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=classificadosin&id="+$(this).attr("title")});
		return false;
	});
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
    $('#slider').css("display","block").nivoSlider(
	{
		effect:'random', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:7000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:true, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} 
	}
	
	);
   
	$('ul#galleryIndex2').css("display","block").carouFredSel({
		items: 5,
		direction: "left",
		prev : {   
				button  : "#prevG2",
				key     : "left"
		},
		next : {
				button  : "#nextG2",
				key     : "right"
		},
			scroll : {
			items: 1,
			effect: "easeOutBounce",
			duration: 800,                        
			pauseOnHover: true
			}
		});
		
		$('ul#galleryIndex').css("display","block").carouFredSel({
		items: 5,
		direction: "left",
		prev : {   
				button  : "#prevG",
				key     : "left"
		},
		next : {
				button  : "#nextG",
				key     : "right"
		},
			scroll : {
			items: 1,
			effect: "easeOutBounce",
			duration: 800,                        
			pauseOnHover: true
			}
		});
	
	
	
	
	$(".loc3").goMap({ 
        markers: [{  
            latitude: -16.702238, 
            longitude: -49.283754,			
            html: { 
                content: 'Poolcor Seguros', 
                popup: true 
            } 
        },{  
            latitude: -16.702238, 
            longitude:-49.283754, 
            html: 'Hello!' 
        }],
		zoom: 18,
		maptype: 'SATELLITE',
        hideByClick: false
    }); 
	
	$('#coin-slider').coinslider({

		width: 920, 

		height: 259,

		navigation: true, 

		delay: 5000 

	});
	$('#coin-clube').coinslider({

		width: 182, 

		height: 606,

		navigation: false, 

		delay: 5000 

	});
	
	$(".sejaparceiro").colorbox({width:"600px", inline:true, href:".formParc"});
	$(".mapa-localizacao").colorbox({width:"850px",height:"390px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=mapa"});
	$("#fazercotacao").colorbox({width:"300px",height:"270px", inline:true, href:".formCota"});
	
	$(".fazercotacao-ex").click(function(){
		
		$("#nome-seguro").val($(this).attr("title"));	
		$(this).colorbox({width:"300px",height:"270px", inline:true, href:".formCota"});
	
	});
	
	$("#abas-menu").tabs();
	 
		
	// JCarrossel      
    
    	 $("#carrossel-produtos").css('display','block').jcarousel({
    		    animation: 1000,
    	        auto: 0
    	 });
    	 
    	
		 
       		$(".carrossel-parceiros").jCarouselLite({
			btnNext: ".seta1",
			btnPrev: ".seta2",
			speed: 1200,
			circular: true,
			scroll: 1,
			visible: 5
    		});
			
			
			$(".carrossel-clube").jCarouselLite({
			btnNext: ".seta1",
			btnPrev: ".seta2",
			speed: 5000,
			circular: true,
			scroll: 1,
			visible: 1,
			auto:1000
			 
    		});
		
    
	
	$("#busca-veiculo").click(function(){
		
		if($("#tipo_veiculo").val() == ""){
		alert("Escolha um tipo de veículo!");
		return false
		}
		$.colorbox({width:"1200px",height:"900px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=busca&tipo="+$("#tipo_veiculo").val()+"+&fabricante="+$("#fabricante_veiculo").val()+"&modelo="+$("#modelo_veiculo").val()+"&valor_inicio="+$("#valor_inicio").val()+"&valor_fim="+$("#valor_fim").val()+"&ano_inicio="+$("#ano_inicio").val()+"&ano_fim="+$("#ano_fim").val()+"&estado="+$("#estado").val()});
		
		
	});
	
	$("#busca-site-icon").click(function(){
		
		if($("#busca_site").val() == ""){
		alert("Informe a pesquisa!");
		return false
		}
		$.colorbox({width:"1200px",height:"900px", scrolling:false, transition:'elastic',iframe:true, href:"index.php?metodo=buscasite&pesq="+$("#busca_site").val()});
		
		
	});
	
	
	
	getTwitters(
	'tweet-container',
	{
	id: 'raddaronline',
	count: 5,
	enableLinks: true,
	ignoreReplies: true,
	clearContents: true,
	lang: 'pt-br',
	template: '<span class="imagem"><img height="50" width="50" src="%user_profile_image_url%" alt="%user_name%" /></span><span class="prefixo"><a href="http://twitter.com/%user_screen_name%/">%user_name%</a></span><span class="texto"> "%text%"</span> <a href="http://twitter.com/%user_screen_name%/statuses/%id%/" class="time">%time%</a>'
	});
	
	
	
	$('.img-hover-prod').hover(function(){
		descricao = $(this).find('.img-hover-detail');
		descricao.stop().animate({top: "-154px", opacity: 1}, 400 );
	},
	function () {
	$('.img-hover-detail').stop();
	$('.img-hover-detail').animate({top: "0px", opacity: 1}, 500 );
	})
	
	
	
	
	$('.data').mask('99/99/9999');
	$('.telefone').mask('(99) 9999-9999');
	$('.cep').mask('99999-999');
	$('.cpf').mask('999.999.999.99');
	
	$("#curriculo").change(function() {
        var filename = $(this).val();
        var file_arr = filename.split('.');
        var last_item = file_arr.length - 1;
        var file_ext = file_arr[last_item];
        if(file_ext == 'DOC' || file_ext == 'doc' || file_ext == 'PDF' || file_ext == 'pdf' || file_ext == 'DOCX' || file_ext == 'docx') {
            
        } else {
        	
            alert('Somente são permitido os formatos: .doc e .pdf');
            $(this).val("");
        }
    });
	
	
	$(function (){
	    $('.reP').hide()
	    $('.s1').click(function (){
	        var id = $(this).attr('id')
	        $('#ds-'+id+'').slideToggle('show')
	        $('#ax-'+id+'').toggleClass('cls2')
	        return false
	    });
	});
	
	$('.s1').toggle(function(){
		
		$("#img-"+$(this).attr("id")).attr("src","imagens/icon-menos.png");
		
	},function(){
		
		$("#img-"+$(this).attr("id")).attr("src","imagens/icon-mais.png");
			
	});
	
	
	$("#cot-nome").click(function(){
		if($(this).val() == "Digite seu nome"){
		$(this).val("");
		}	
	});
	$("#cot-nome").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu nome");
		}	
	});
	$("#cot-email").click(function(){
		if($(this).val() == "Digite seu e-mail"){
		$(this).val("");
		}	
	});
	$("#cot-email").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu e-mail");
		}	
	});
	$("#cot-telefone").click(function(){
		if($(this).val() == "Digite seu telefone"){
		$(this).val("");
		$(this).mask("(99) 9999-9999");
		}	
	});
	$("#parc-nome").click(function(){
		if($(this).val() == "Qual o seu Nome?"){
		$(this).val("");
		}	
	});
	$("#parc-nome").blur(function(){
		if($(this).val() == ""){
		$(this).val("Qual o seu Nome?");
		}	
	});
	
	
	$("#parc-empresa").click(function(){
		if($(this).val() == "Qual a sua empresa?"){
		$(this).val("");
		}	
	});	
	$("#parc-empresa").blur(function(){
		if($(this).val() == ""){
		$(this).val("Qual a sua empresa?");
		}	
	});
	
	$("#parc-email").click(function(){
		if($(this).val() == "Digite um email para contato"){
		$(this).val("");
		}	
	});
	$("#parc-email").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite um email para contato");
		}	
	});
	
	$("#parc-telefone").click(function(){
		if($(this).val() == "Digite seu telefone, que em brêve te ligamos"){
		$(this).val("");
		$(this).mask("(99) 9999-9999");
		}	
	});
	$("#parc-telefone").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu telefone, que em brêve te ligamos");
		}	
	});
	
	
	
	$("#nome-pergunta").click(function(){
	if($(this).val() == "Digite seu nome"){
	$(this).val("");
	}	
	});
	
	$("#nome-pergunta").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu nome");
		}	
	});
	
	$("#email-pergunta").click(function(){
	if($(this).val() == "Digite seu email"){
	$(this).val("");
	}	
	});
	
	$("#email-pergunta").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu email");
		}	
	});
	
	
	$("#telefone-pergunta").click(function(){
	if($(this).val() == "Digite seu telefone"){
	$(this).val("");
	}	
	});
	$("#telefone-pergunta").blur(function(){
		if($(this).val() == ""){
		$(this).val("Digite seu telefone");
		}	
	});
	
	// Monta janelas DIALOG JQUERY UI
	$(".dialog").dialog({
		bgiframe: true,
		modal: true,
		buttons: {
			Ok: function() {
				$(this).dialog('close');
			}
		}
	});
	$(".dialog-info").dialog({
		bgiframe: true,
		modal: true,
		autoOpen: false,
		buttons: {
			Ok: function() {
				$(this).dialog('close');
			}
		}
	});
	
	$('a.lightbox').lightBox({
		overlayBgColor: '#000',
		overlayOpacity: 0.6,
		imageLoading: 'imagens/lightbox/loading.gif',
		imageBtnClose: 'imagens/lightbox/close.gif',
		imageBtnPrev: 'imagens/lightbox/prev.gif',
		imageBtnNext: 'imagens/lightbox/next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Imagem',
		txtOf: 'de'

    });
	
	$('#tipo_veiculo').change(function(){
		
		$.ajax({
			url: "index.php?metodo=geraFabricante",
			dataType: "html",
			type: "post",
			data: "tipo="+$("#tipo_veiculo").val(),
			success: function(data){
				$("#fabricante_veiculo").html(data);
			},
			error: function(){}			
			});
	
	});
	
	
	$('#buscacep').change(function(){
		
		var cep = $(this).val().replace("-","");
		window.location="index.php?metodo=buscacep&cep="+cep+"&nome="+$("#nome").val();
	
	
	});
	
	
	
	$('#fabricante_veiculo').change(function(){
		
		$.ajax({
			url: "index.php?metodo=geraModelo",
			dataType: "html",
			type: "post",
			data: "fabricante="+$("#fabricante_veiculo").val(),
			success: function(data){
				$("#modelo_veiculo").html(data);
			},
			error: function(){ }			
			});
	
	});
	
	$('ul#galleryIndex2').carouFredSel({
		items: 5,
		direction: "left",
		prev : {   
				button  : "#prevG2",
				key     : "left"
		},
		next : {
				button  : "#nextG2",
				key     : "right"
		},
			scroll : {
			items: 1,
			effect: "easeOutBounce",
			duration: 800,                        
			pauseOnHover: true
			}
		});
		
		$('ul#galleryIndex').carouFredSel({
		items: 6,
		direction: "left",
		prev : {   
				button  : "#prevG",
				key     : "left"
		},
		next : {
				button  : "#nextG",
				key     : "right"
		},
			scroll : {
			items: 1,
			effect: "easeOutBounce",
			duration: 800,                        
			pauseOnHover: true
			}
		});
	
		

}


function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) objTextBox.value = '';
    if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}

 function formatarmoeda(num){
var x = 0;
if(num<0){
	num = Math.abs(num);
	 x = 1;
}
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%100);
num = Math.floor((num*100+0.5)/100).toString();
if(cents < 10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))
+num.substring(num.length-(4*i+3));
ret = num + ',' + cents;
if (x == 1) ret = ' – ' + ret;

return ret;
}


function validaformcota(){
	
	if(document.form2.seguro.value == ""){
	alert("Informe o seguro");
	return false;
	}
	if(document.form2.nome.value == ""){
	alert("Informe seu nome");
	return false;
	}
	if(document.form2.email.value == ""){
	alert("Informe seu e-mail");
	return false;
	}
	if(document.form2.telefone.value == ""){
	alert("Informe seu telefone");
	return false;
	}
	
	}

