jQuery(function($){
$(document).ready(function(){
    $("#btn_msn").livequery("click",function(){
	$("#mensagem_anunciante01").show("slow")
	$("#btn_fechar").css("color","#fff")
	return false
	})
	$("#btn_fechar").livequery("click",function(){
	$("#mensagem_anunciante01").hide("slow")	
	return false
	})
	$("#EnviarMensagemanun").livequery("click",function(){
	   	email=$("#mensagem_texto").val()
		if(email.length == 0){
					alert("Mensagem precisa ser preenchida!")
				return false
		      }
		})
		
		$('.descricao_compre3').fadeIn()
		$('.descricao_compre2').fadeIn()
		$("#solicita").hide()
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
  /*pagina venda*/
	
	$("#enviarvenda").livequery("click",function(){
	   	email=$("#emailv").val()
		
		  if((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 7))){
					alert("E-mail errado!")
				return false
		      }
		   if(email.length == 0){
			  alert("Preencha o campo E-mai!")
			  return false  
		   }
		  
	    });
	
	
	   /*pagina_comprar*/
	   
      $.post("busca_index.php",
		 {},function(data){
		  $('.retornocaminhoesbusca').html(data);
		 })
	$('.titulo_nbusca1 a').livequery("click",function(){
	  $('.titulo_nbusca1 a').removeClass('botao_novabuscaselecionado');
	  $(this).addClass('botao_novabuscaselecionado');
      $.post("busca_index.php",
		 {},function(data){
		  $('.retornocaminhoesbusca').html(data);
		 })
	 return false;
	})	
	
	/*pagina compar2*/
	      $.post("busca_index.php",
		 {},function(data){
		  $('.retornocaminhoesbusca2').html(data);
		 })
	$('.titulo_nbusca1 a').livequery("click",function(){
	  $('.titulo_nbusca1 a').removeClass('botao_novabuscaselecionado');
	  $(this).addClass('botao_novabuscaselecionado');
      $.post("busca_index.php",
		 {},function(data){
		  $('.retornocaminhoesbusca2').html(data);
		 })
	 return false;
	})	
	
		
		$('#botao_fechar_menu').livequery("click",function(){
			
			
		 $("#menu_suspenso").hide()
		 $("#retorno_menu_suspenso").hide()
		 return false;
		
		});
		$("#foto1_galeria a").livequery("click",function(){
		 imagem = $(this).attr("rel")
		 if(imagem=="foto1"){
		 $("#foto1").show()	 
		 $("#foto2").hide()
		 $("#foto3").hide()
		 $("#foto4").hide()
		 $("#foto5").hide()
		 $("#foto6").hide()
		 }
	     if(imagem=="foto2"){
		 $("#foto1").hide()	 
		 $("#foto2").show()
		 $("#foto3").hide()
		 $("#foto4").hide()
		 $("#foto5").hide()
		 $("#foto6").hide()
		 }
		 if(imagem=="foto3"){
		 $("#foto1").hide()	 
		 $("#foto2").hide()
		 $("#foto3").show()
		 $("#foto4").hide()
		 $("#foto5").hide()
		 $("#foto6").hide()
		 }
		 if(imagem=="foto4"){
		 $("#foto1").hide()	 
		 $("#foto2").hide()
		 $("#foto3").hide()
		 $("#foto4").show()
		 $("#foto5").hide()
		 $("#foto6").hide()
		 }
		 if(imagem=="foto5"){
		 $("#foto1").hide()	 
		 $("#foto2").hide()
		 $("#foto3").hide()
		 $("#foto4").hide()
		 $("#foto5").show()
		 $("#foto6").hide()
		 }
		 if(imagem=="foto6"){
		 $("#foto1").hide()	 
		 $("#foto2").hide()
		 $("#foto3").hide()
		 $("#foto4").hide()
		 $("#foto5").hide()
		 $("#foto6").show()
		 }
		 return false
		})
		
		
		$("#mandaranuncio").livequery("click",function(){
		  
		  fotos1 = $("#imagemuploads1").val()
		  if(fotos==""){
		    alert("pelo menos uma foto")
		    return false
		  }
		})
		$("#botao_menu_lateral_s a").livequery("click",function(){
	    $("#menu_suspenso").hide()
		$("#retorno_menu_suspenso").hide()
		$("#loading").hide()
	    susu = $(this).attr("rel")
	    if(susu=="noticias"|| susu=="dicas" || susu=="estradas" || susu=="tabelas" ){
		
		$("#menu_suspenso").show()
		$("#loading").show()
		//$("#loading").show()
		$.ajax({method:"get",
			url:"conteudo_menu_suspenso.php",
			data: "pag="+susu,
			beforeSend: function(){
				$("#loading").show()},
				//$(".conteudo").slideUp("slow")},
			complete: function(){
				$("#loading").hide()
				},
			success: function(html){
				$("#retorno_menu_suspenso").show()
				$("#retorno_menu_suspenso").html(html)
		
		}
		})//fim do $.ajax(  */
		return false
	  }
	})//fim do $("div.menu li a").click	
	
	$("#texto_titulo_servico2 a").livequery("click",function(){
	    $("#menu_suspenso").hide()
		$("#retorno_menu_suspenso").hide()
		$("#loading").hide()
	    susu = $(this).attr("rel")
	    if(susu=="noticias"|| susu=="dicas" || susu=="estradas" || susu=="tabelas" ){
		
		$("#menu_suspenso").show()
		$("#loading").show()
		//$("#loading").show()
		$.ajax({method:"get",
			url:"conteudo_menu_suspenso.php",
			data: "pag="+susu,
			beforeSend: function(){
				$("#loading").show()},
				//$(".conteudo").slideUp("slow")},
			complete: function(){
				$("#loading").hide()
				},
			success: function(html){
				$("#retorno_menu_suspenso").show()
				$("#retorno_menu_suspenso").html(html)
		
		}
		})//fim do $.ajax(  */
		return false
	  }
	})//fim do $("div.menu li a").click	 
	
	$("#servico_noticia a").livequery("click",function(){
	    $("#menu_suspenso").hide()
		$("#retorno_menu_suspenso").hide()
		$("#loading").hide()
	    susu = $(this).attr("rel")
	    if(susu=="noticias"|| susu=="dicas" || susu=="estradas" || susu=="tabelas" ){
		
		$("#menu_suspenso").show()
		$("#loading").show()
		//$("#loading").show()
		$.ajax({method:"get",
			url:"conteudo_menu_suspenso.php",
			data: "pag="+susu,
			beforeSend: function(){
				$("#loading").show()},
				//$(".conteudo").slideUp("slow")},
			complete: function(){
				$("#loading").hide()
				},
			success: function(html){
				$("#retorno_menu_suspenso").show()
				$("#retorno_menu_suspenso").html(html)
		
		}
		})//fim do $.ajax(  */
		return false
	  }
	})//fim do $("div.menu li a").click	 
	
	$("#texto_titulo_servico1 a").livequery("click",function(){
	    $("#menu_suspenso").hide()
		$("#retorno_menu_suspenso").hide()
		$("#loading").hide()
	    susu = $(this).attr("rel")
	    if(susu=="noticias"|| susu=="dicas" || susu=="estradas" || susu=="tabelas" ){
		
		$("#menu_suspenso").show()
		$("#loading").show()
		//$("#loading").show()
		$.ajax({method:"get",
			url:"conteudo_menu_suspenso.php",
			data: "pag="+susu,
			beforeSend: function(){
				$("#loading").show()},
				//$(".conteudo").slideUp("slow")},
			complete: function(){
				$("#loading").hide()
				},
			success: function(html){
				$("#retorno_menu_suspenso").show()
				$("#retorno_menu_suspenso").html(html)
		
		}
		})//fim do $.ajax(  */
		return false
	  }
	})//fim do $("div.menu li a").click	 
	
	
	/*fim pagina venda*/ 	
  var currentPosition = 0;
  var slideWidth = 772;
  var slides = $('.slide');
  var numberOfSlides = slides.length;
  
  // Remove scrollbar in JS
  $('#slidesContainer').css('overflow', 'hidden');

  // Wrap all .slides with #slideInner div
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
      'width' : slideWidth
    });
  
  // Set #slideInner width equal to total width of all slides
  $('#slideInner').css('width', slideWidth * numberOfSlides);

  // Insert controls in the DOM
  $('#slideshow')
    .prepend('<span class="control" id="leftControl">Clicking moves left</span>')
    .append('<span class="control" id="rightControl">Clicking moves right</span>');

  // Hide left arrow control on first load
  manageControls(currentPosition);

  // Create event listeners for .controls clicks
  $('.control')
    .bind('click', function(){
    // Determine new position
	currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
    
	// Hide / show controls
    manageControls(currentPosition);
    // Move slideInner using margin-left
    $('#slideInner').animate({
      'marginLeft' : slideWidth*(-currentPosition)
	 
    });
  });

  // manageControls: Hides and Shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
	if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
	// Hide right arrow if position is last slide
    if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
  }	
		
      $('#botao_fechar_menu').hover(
            function(){ // Change the input image's source when we "roll on"
                $("#botao_fechar_menu img").attr({ src :'imagens/menu_suspenso/bot_x2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $("#botao_fechar_menu img").attr({ src :'imagens/menu_suspenso/bot_x1.png'});             }
        );	
		
	  $('#ENVIAR1').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar1.png'});             }
        );
	  $('#ENVIARC').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar1.png'});             }
        );
	   $('#ENVIARS').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/financiamento/bot_enviar1.png'});             }
        );
	   $('#anuncie_aqui_link').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui1.png'});             }
        );
	    $('#anuncie_aqui_link2').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui1.png'});             }
        );
		$('#anuncie_aqui_link3').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui1.png'});             }
        );
		$('#anuncie_aqui_link4').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui1.png'});             }
        );
		$('#anuncie_aqui_link5').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_anuncie_aqui1.png'});             }
        );
	   $('#enviaranuncie').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_enviar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_enviar1.png'});}
        );
	    $('#enviarparceiro').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_enviar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/anuncie_ja/bot_enviar1.png'});}
        );
	  /*pagina financia*/
	 
	 
	
     
	    $("#bt_onibus_select").livequery("click",function(){
		$(this).hide()
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
		$("#bt_onibus2_select").show()
		$("#buscaonibus").show()
		$("#bt_caminhao_select").show()
		$("#bt_caminhao2_select").hide()
		$("#buscacaminhao").hide()
		$("#bt_trator_select").show()
		$("#bt_trator2_select").hide()
		$("#buscatrator").hide()
		$("#bt_van_select").show()
		$("#bt_van2_select").hide()
		$("#buscavan").hide()
		$("#bt_todos_select").show()
		$("#bt_todos2_select").hide()
		$("#buscatodos").hide()
		return false
	
	})
	$("#bt_caminhao_select").livequery("click",function(){
		$(this).hide()
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
		$("#bt_onibus2_select").hide()
		$("#bt_onibus_select").show()
		$("#buscaonibus").hide()
		$("#bt_caminhao2_select").show()
		$("#buscacaminhao").show()
		$("#bt_trator_select").show()
		$("#bt_trator2_select").hide()
		$("#buscatrator").hide()
		$("#bt_van_select").show()
		$("#bt_van2_select").hide()
		$("#buscavan").hide()
		$("#bt_todos_select").show()
		$("#bt_todos2_select").hide()
		$("#buscatodos").hide()
		return false
	
	})
	$("#bt_trator_select").livequery("click",function(){
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
		$("#bt_onibus2_select").hide()
		$("#bt_onibus_select").show()
		$("#buscaonibus").hide()
		$("#bt_caminhao2_select").hide()
		$("#bt_caminhao_select").show()
		$("#buscacaminhao").hide()
		$("#bt_trator_select").hide()
		$("#bt_trator2_select").show()
		$("#buscatrator").show()
		$("#bt_van_select").show()
		$("#bt_van2_select").hide()
		$("#buscavan").hide()
		$("#bt_todos_select").show()
		$("#bt_todos2_select").hide()
		$("#buscatodos").hide()
		return false
	
	})
	$("#bt_van_select").livequery("click",function(){
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
		$("#bt_onibus2_select").hide()
		$("#bt_onibus_select").show()
		$("#buscaonibus").hide()
		$("#bt_caminhao2_select").hide()
		$("#bt_caminhao_select").show()
		$("#buscacaminhao").hide()
		$("#bt_trator_select").show()
		$("#bt_trator2_select").hide()
		$("#buscatrator").hide()
		$("#bt_van_select").hide()
		$("#bt_van2_select").show()
		$("#buscavan").show()
		$("#bt_todos_select").show()
		$("#bt_todos2_select").hide()
		$("#buscatodos").hide()
		return false
	
	})
	$("#bt_todos_select").livequery("click",function(){
		$("select[name=modelo]").html('<option value="0">Selecione Marca</option>');
		$("#bt_onibus2_select").hide()
		$("#bt_onibus_select").show()
		$("#buscaonibus").hide()
		$("#bt_caminhao2_select").hide()
		$("#bt_caminhao_select").show()
		$("#buscacaminhao").hide()
		$("#bt_trator_select").show()
		$("#bt_trator2_select").hide()
		$("#buscatrator").hide()
		$("#bt_van_select").show()
		$("#bt_van2_select").hide()
		$("#buscavan").hide()
		$("#bt_todos_select").hide()
		$("#bt_todos2_select").show()
		$("#buscatodos").show()
		return false
	
	})
	$("#finh1").livequery("click",function(){
		$(this).show()
		$("#finh2").hide()
		$("#finh3").hide()
		$("#fin1").hide()
		$("#fin2").show()
		$("#fin3").show()
		$("#formseg").hide()
	    $("#formcon").hide()
		$("#formfin").show()
		
		return false
	
	})
	$("#finh2").livequery("click",function(){
		$(this).show()
		$("#finh1").hide()
		$("#finh3").hide()
		$("#fin1").show()
		$("#fin2").hide()
		$("#fin3").show()
		$("#formseg").show()
	    $("#formcon").hide()
		$("#formfin").hide()
		
		return false
	
	})
	$("#finh3").livequery("click",function(){
		$(this).show()
		$("#finh1").hide()
		$("#finh2").hide()
		$("#fin1").show()
		$("#fin3").hide()
		$("#fin2").show()
		$("#formseg").hide()
	    $("#formcon").show()
		$("#formfin").hide()
		
		return false
	
	})
	$("#fin1").livequery("click",function(){
		$("#finh1").show()
		$("#finh2").hide()
		$("#finh3").hide()
		$(this).hide()
		$("#fin3").show()
		$("#fin2").show()
		$("#formseg").hide()
	    $("#formcon").hide()
		$("#formfin").show()
		
		return false
	
	})
	$("#fin2").livequery("click",function(){
	    $("#finh1").hide()
		$("#finh2").show()
		$("#finh3").hide()
		$(this).hide()
		$("#fin3").show()
		$("#fin1").show()
		$("#formseg").show()
	    $("#formcon").hide()
		$("#formfin").hide()
		
		return false
	
	})
	$("#fin3").livequery("click",function(){
        $("#finh1").hide()
		$("#finh2").hide()
		$("#finh3").show()
		$(this).hide()
		$("#fin2").show()
		$("#fin1").show()
		$("#formseg").hide()
	    $("#formcon").show()
		$("#formfin").hide()
		
		return false
	
	})
	
	
	
	/*fim pagina financiamento*/
	/*inicio pagina compre*/
	$("#botoes_barra_cinza2 a").livequery("click",function(){
	cal=$(this).attr("rel")
		  $.ajax({
			type:"GET",
			url:"veiculosmais.php",
			data:{veiculos:"mais"},
			success: function(r){
			$("#retorno_escolha").html("")
			$("#retorno_escolha").html(r)
			$('.descricao_compre').fadeIn()
			}
		})
return false
	
	})
	
    $("#corpo_descricao_evento a").livequery("click",function(){
	evento=$(this).attr("rel")
		  $.ajax({
			type:"POST",
			url:"eventoprincipal.php",
			data:{idevento:evento},
			success: function(r){
			$("#corpo_evento_atual").html("")
			$("#corpo_evento_atual").html(r)
			
			}
		})

	
	})
	
      $("#ENVIAR1").livequery("click",function(){
		 ofirefi_f=$("#firefi_f").val()
		onome_f=$("#nome_f").val()
		oemail_f=$("#email_f").val()
		opesjurfis_f=$("#pesjurfis_f").val()
		ocpf_f=$("#cpf_f").val()
		org_f=$("#rg_f").val()
		ofiliacao_f=$("#filiacao_f").val()
		ocomplemento_res_f=$("#complemento_res").val()
		odata_nasc_f=$("#data_nasc_f").val()
		oend_res_f=$("#end_res_f").val()
		onum_res_f=$("#num_res_f").val()
		obairro_res_f=$("#bairro_res_f").val()
		ocep_res_f=$("#cep_res_f").val()
		ouf_f=$("#uf_f").val()
		ocidade_res_f=$("#fcidade_res_f").val()
		otel_res_f=$("#tel_res_f").val()
		ocel_res_f=$("#cel_res_f").val()
		oempresa_f=$("#empresa_f").val()
		otel_com_f=$("#tel_com_f").val()
		oreceita_f=$("#receita_f").val()
		oend_com_f=$("#end_com_f").val()
		onum_com_f=$("#num_com_f").val()
		ocomplemento_com_f=$("#complemento_com_f").val()
	    obairro_com_f=$("#bairro_com_f").val()
		ocep_com_f=$("#cep_com_f").val()
		ouf_com_f=$("#uf_com_f").val()
	    ocidade_com_f=$("#cidade_com_f").val()
		oveiculonu_f=$("#veiculonu_f").val()
		osegmento_f=$("#segmento_f").val()
		ocategoria_f=$("#categoria_f").val()
		omarca_f=$("#marca_f").val()
		omodelo_f=$("#modelo_f").val()
		oano_f=$("#ano_f").val()
		oano_fab_f=$("#ano_fab_f").val()
		oplaca_f=$("#placa_f").val()
		ovalor_ben_f=$("#valor_ben_f").val()
		oentrada_f=$("#entrada_f").val()
		ovalor_finan_f=$("#valor_finan_f").val()
		onr_parc_f=$("#nr_parc_f").val()
		oveiculo_similar_f=$("#veiculo_similar_f").val()
	        $(".animacao").show()
		    $.ajax({
			type:"POST",
			url:"inserefinanciamento.php",
			data:{firefi_f:ofirefi_f,nome_f:onome_f,email:oemail_f,cpf_f:ocpf_f,rg_f:org_f,filiacao_f:ofiliacao_f,data_nasc_f:odata_nasc_f,end_res:oend_res_f,num_res_f:onum_res_f,complemento:ocomplemento_res_f,bairro:obairro_res_f,cidade:ocidade_res_f,estado:ouf_f,marca:omarca_f,cep:ocep_res_f,tels:otel_res_f,empresa_f:oempresa_f,end_com_f:oend_com_f,num_com_f:onum_com_f,complemento_com_f:ocomplemento_com_f,complemento_com_f:ocomplemento_com_f,bairro_com_f:obairro_com_f,cep_com_f:ocep_com_f,uf_com_f:ouf_com_f,cidade_com_f:ocidade_com_f,veiculonu_f:oveiculonu_f,segmento_f:osegmento_f,categoria_f:ocategoria_f,marca_f:omarca_f,modelo_f:omodelo_f,ano_f:oano_f,ano_fab_f:oano_fab_f,placa_f:oplaca_f,valor_ben_f:ovalor_ben_f,entrada_f:oentrada_f,valor_finan_f:ovalor_finan_f,nr_parc_f:onr_parc_f,veiculo_similar_f:oveiculo_similar_f,enviado:"financiamento"},
			success: function(r){
				$(".animacao").slideUp(1000)
			    $("#retorno_susu").show()
			    $("#retorno_susu").html(r)
			     $("#ENVIAR1").hide()
				$("#ENVIARS").hide()
				$("#ENVIARC").hide()
				
			}
		})
return false
	     
	})
	 
	 
	 
	 
	 
	 
	$("#ENVIARS").livequery("click",function(){
		opesjurfis_s=$("#pesjurfis_s").val()
		onome_s=$("#nome_s").val()
		oemail_s=$("#email_s").val()
		ofiliacao_s=$("#filiacao_s").val()
		ocomplemento_res_s=$("#complemento_res").val()
		oend_res_s=$("#end_res_s").val()
		onum_res_s=$("#num_res_s").val()
		obairro_res_s=$("#bairro_res_s").val()
		ocep_res_s=$("#cep_res_s").val()
		ouf_s=$("#uf_s").val()
		ocidade_res_s=$("#fcidade_res_s").val()
		otel_res_s=$("#tel_res_s").val()
		ocel_res_s=$("#cel_res_s").val()
		oveiculonu_s=$("#veiculonu_s").val()
		oreceita_s=$("#receita_s").val()
		oend_com_s=$("#end_com_s").val()
		osegmento_s=$("#segmento_s").val()
		ocategoria_s=$("#categoria_s").val()
		omarca_s=$("#marca_s").val()
		omodelo_s=$("#modelo_s").val()
		oano_s=$("#ano_s").val()
		oano_fab_s=$("#ano_fab_s").val()
		oplaca_s=$("#placa_s").val()
		ovalor_ben_s=$("#valor_ben_s").val()
	        $(".animacao").show()
		    $.ajax({
			type:"POST",
			url:"inserefinanciamento.php",
			data:{pesjurfis_s:opesjurfis_s,nome_s:onome_s,email:oemail_s,filiacao_s:ofiliacao_s,end_res:oend_res_s,num_res_s:onum_res_s,complemento:ocomplemento_res_s,bairro:obairro_res_s,cidade:ocidade_res_s,estado:ouf_s,marca:omarca_s,cep:ocep_res_s,tels:otel_res_s,cel_res_s:ocel_res_s,veiculonu_s:oveiculonu_s,categoria_s:ocategoria_s,marca_s:omarca_s,modelo_s:omodelo_s,ano_s:oano_s,ano_fab_s:oano_fab_s,placa_s:oplaca_s,valor_ben_s:ovalor_ben_s,enviado:"seguro"},
			success: function(r){
				$(".animacao").slideUp(1000)
			    $("#retorno_susu").show()
			    $("#retorno_susu").html(r)
			    $("#ENVIAR1").hide()
				$("#ENVIARS").hide()
				$("#ENVIARC").hide()
				
			}
		})
return false
	
	     
	})
	  

	  
	  
	  
	  
	 $("#ENVIARC").livequery("click",function(){
		opesjurfis_c=$("#pesjurfis_c").val()
		onome_c=$("#nome_c").val()
		oemail_c=$("#email_c").val()
		ocpf_res_c=$("#cpf_res_c").val()
		ocep_res_c=$("#cep_res_c").val()
		ouf_c=$("#uf_c").val()
		ocidade_res_c=$("#fcidade_res_c").val()
		otel_res_c=$("#tel_res_c").val()
		ocel_res_c=$("#cel_res_c").val()
		oveiculonu_c=$("#veiculonu_c").val()
		oreceita_c=$("#receita_c").val()
		osegmento_c=$("#segmento_c").val()
		ocategoria_c=$("#categoria_c").val()
		omarca_c=$("#marca_c").val()
		omodelo_c=$("#modelo_c").val()
		oano_c=$("#ano_c").val()
		oano_fab_c=$("#ano_fab_c").val()
		oplaca_c=$("#placa_c").val()
		ovalor_ben_c=$("#valor_ben_c").val()
		onr_parc=$("#nr_parc").val()
		ovalor_c=$("#valor_c").val()
		           
	        $(".animacao").show()
		    $.ajax({
			type:"POST",
			url:"inserefinanciamento.php",
			data:{pesjurfis_c:opesjurfis_c,nome_c:onome_c,email:oemail_c,cpf_res_c:ocpf_res_c,cidade:ocidade_res_c,estado:ouf_c,marca:omarca_c,cep:ocep_res_c,tels:otel_res_c,cel_res_c:ocel_res_c,veiculonu_c:oveiculonu_c,categoria_c:ocategoria_c,modelo_c:omodelo_c,ano_c:oano_c,ano_fab_c:oano_fab_c,placa_c:oplaca_c,valor_ben_c:ovalor_ben_c,onr_parc:onr_parc,valor_c:ovalor_c,enviado:"consorcio"},
			success: function(r){
				$(".animacao").slideUp(1000)
			    $("#retorno_susu").show()
			    $("#retorno_susu").html(r)
			    $("#ENVIAR1").hide()
				$("#ENVIARS").hide()
				$("#ENVIARC").hide()
			}
		})
return false
	
	}) 
	  
	$("#voltar_form").livequery("click",function(){
	      $("#ENVIAR1").show()
		  $("#ENVIARS").show()
		  $("#ENVIARC").show()
	      $("#retorno_susu").hide()
	 })
	
	
    $("#botoes_barra_cinza a").livequery("click",function(){
	$('.descricao_compre').hide();
	cal=$(this).attr("rel")
	
		  $.ajax({
			type:"GET",
			url:"veiculosmais.php",
			data:{veiculos:"menos"},
			success: function(r){
				$("#retorno_escolha").html("")
				$("#retorno_escolha").html(r)
				 $('.descricao_compre').fadeIn()

			}
		})
return false
	
	})
	
	/*fim pagina compre*/
	
		$("#texto_procon").hide()///começo pagina segurança
		$("#texto_detran").hide()
		$("#texto_multas").hide()
		$("#seguranca").hide()
		$("#texto_ipva").hide()
		$("#imagem_procon").hide()
		$("#imagem_detran").hide()
		$("#imagem_multas").hide()
		$("#imagem_ipva").hide()
		$("#botao_selecionado_procon").hide()
		$("#botao_selecionado_detran").hide()
		$("#botao_selecionado_multas").hide()
		$("#botao_selecionado_ipva").hide()
		
	$("#seguranca").livequery("click",function(){
		$("#texto_procon").hide()
		$("#texto_seguranca").show()
		$("#texto_detran").hide()
		$("#texto_multas").hide()
		$("#texto_ipva").hide()
		
		$("#imagem_seguranca").show()
		$("#imagem_procon").hide()
		$("#imagem_detran").hide()
		$("#imagem_multas").hide()
		$("#imagem_ipva").hide()
		
		$("#seguranca").hide()
		$("#procon").show()
		$("#detran").show()
		$("#multas").show()
		$("#ipva").show()
		
		
		$("#botao_selecionado_seguranca").show()
		
		$("#botao_selecionado_procon").hide()
		$("#botao_selecionado_detran").hide()
		$("#botao_selecionado_multas").hide()
		$("#botao_selecionado_ipva").hide()
		return false						
		});	
	$("#procon").livequery("click",function(){
		$("#texto_procon").show()
		$("#texto_seguranca").hide()
		$("#texto_detran").hide()
		$("#texto_multas").hide()
		$("#texto_ipva").hide()
		$("#imagem_seguranca").hide()
		$("#imagem_procon").show()
		$("#imagem_detran").hide()
		$("#imagem_multas").hide()
		$("#imagem_ipva").hide()
		$("#seguranca").show()
		$("#procon").hide()
		$("#detran").show()
		$("#multas").show()
		$("#ipva").show()
		$("#botao_selecionado_seguranca").hide()
		$("#botao_selecionado_procon").show()
		$("#botao_selecionado_detran").hide()
		$("#botao_selecionado_multas").hide()
		$("#botao_selecionado_ipva").hide()
		
		return false
		});
	$("#detran").livequery("click",function(){
		$("#texto_procon").hide()
		$("#texto_seguranca").hide()
		$("#texto_detran").show()
		$("#texto_multas").hide()
		$("#texto_ipva").hide()
		$("#imagem_seguranca").hide()
		$("#imagem_procon").hide()
		$("#imagem_detran").show()
		$("#imagem_multas").hide()
		$("#imagem_ipva").hide()
		
		$("#seguranca").show()
		$("#procon").show()
		$("#detran").hide()
		$("#multas").show()
		$("#ipva").show()
		
		
		$("#botao_selecionado_seguranca").hide()
		
		$("#botao_selecionado_procon").hide()
		$("#botao_selecionado_detran").show()
		$("#botao_selecionado_multas").hide()
		$("#botao_selecionado_ipva").hide()
		return false						
		});
	$("#multas").livequery("click",function(){
		$("#texto_procon").hide()
		$("#texto_seguranca").hide()
		$("#texto_detran").hide()
		$("#texto_multas").show()
		$("#texto_ipva").hide()
		$("#imagem_seguranca").hide()
		$("#imagem_procon").hide()
		$("#imagem_detran").hide()
		$("#imagem_multas").show()
		$("#imagem_ipva").hide()
		
		$("#seguranca").show()
		$("#procon").show()
		$("#detran").show()
		$("#multas").hide()
		$("#ipva").show()
		
		
		$("#botao_selecionado_seguranca").hide()
		
		$("#botao_selecionado_procon").hide()
		$("#botao_selecionado_detran").hide()
		$("#botao_selecionado_multas").show()
		$("#botao_selecionado_ipva").hide()
		return false						
		});
	$("#ipva").livequery("click",function(){
		$("#texto_procon").hide()
		$("#texto_seguranca").hide()
		$("#texto_detran").hide()
		$("#texto_multas").hide()
		$("#texto_ipva").show()
		$("#imagem_seguranca").hide()
		$("#imagem_procon").hide()
		$("#imagem_detran").hide()
		$("#imagem_multas").hide()
		$("#imagem_ipva").show()
		$("#seguranca").show()
		$("#procon").show()
		$("#detran").show()
		$("#multas").show()
		$("#ipva").hide()
		
	
		
		$("#botao_selecionado_seguranca").hide()
		
		$("#botao_selecionado_procon").hide()
		$("#botao_selecionado_detran").hide()
		$("#botao_selecionado_multas").hide()
		$("#botao_selecionado_ipva").show()
		return false						
		});///fim pagina segurança
	    
		$('#tentar_login2').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_voltar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_voltar1.png'});             }
        );
		$('#tentar_login').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_voltar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_voltar1.png'});             }
        );
        //página central assinante
		$('#sair').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_central_sair2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_central_sair1.png'});             }
        );
		$('#entrar2').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/bot2_entrar_tab3.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/bot1_entrar_tab3.png'});             }
        );
		$('#entrar').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : ''});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : ''});             }
        );
		$('#bt_solicita').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_solicitar2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'imagens/central_do_assinante/bot_solicitar1.png'});             }
        ); 
		 
		$("#esqueci").hover(function(){
									 
		 $(this).addClass()							 
		})
		$("#email_solicita").addClass("valor")
		
		$("#esqueci").livequery("click",function(){
			$("#solicita").show()
			$("#retorno").html("")
			$("#email_solicita").addClass("valor")
		    $("#email_solicita").attr("value","Digite o e-mail")
			$("#fundo_login").hide()
			$("#retornologin").hide()
			$("#esqueci").hide()
		});
		$("#email_solicita").livequery("click",function(){
		  $(this).attr("value","")
		  $(this).removeClass("valor")
		})
		$("#email_solicita").livequery("blur",function(){
		  valor=$(this).val()
		  if(valor.length==0){
		  $(this).addClass("valor")
		  $(this).attr("value","Digite o e-mail")
		  }
		})
		 
		 $("#bt_solicita").livequery("click",function(){
		 email=$("#email_solicita").val()
		       if( email=="Digite o e-mail" ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
		   $.ajax({
			type:"POST",
			url:"solicitasenha.php",
			data:{txtemail:email , enviado:"1"},
			success: function(r){
				$("#retorno").html(r)
				
			}
		})
return false
	}//fim else
	});
	 $("#logout").livequery("click",function(){
	       										 
	  })
	 $("#entrar").livequery("click",function(){
		
		 loginuser=$("#loginusuario").val()
		 password=$("#senha").val()
		       if( loginuser==""||password=="" ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
			 $("#fundo_login").hide()
			 $("#conteudo_central_login").hide()
			 $("#espaco").show()
			 $("#esq_minha_senha2").hide()
			  $("#entrar").hide()
			 $("#retornologin").show()
			 $("#retornologin").html("")
		     $.ajax({
			type:"POST",
			url:"verifica.php",
			data:{txtemail:loginuser ,txtsenha:password, enviado:"1"},
			success: function(r){
				
				$("#retornologin").html(r)
				
			}
		})
return false
	}//fim else
	})
	 
	 $("#entrar2").livequery("click",function(){
		
		 loginuser=$("#loginins").val()
		 password=$("#senhains").val()
		       if( loginuser==""||password=="" ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
			 $("#tabela_dir_inscreva").hide()
			 $("#espaco").show()
			 $("#tabela_dir_retorno").show()
			 $("#esq_minha_senha").hide()
			  //$("#entrar").hide()
			 //$("#retornologin").show()
			 //$("#retornologin").html("")
		     $.ajax({
			type:"POST",
			url:"verifica.php",
			data:{txtemail:loginuser ,txtsenha:password, enviado:"1"},
			success: function(r){
				
				$("#tabela_dir_retorno").html(r)
				
			}
		})
return false
	}//fim else
	})


	 
	 $("#tentar_login").livequery("click",function(){
	    $("#entrar").show()
		$("#solicita").hide()
		$("#retornologin").hide()
		$("#tabela_dir_retorno").hide()
		$("#conteudo_central_login").show()
		$("#espaco").hide()
		$("#fundo_login").show()
		$("#tabela_dir_inscreva").show()
	    $("#esq_minha_senha2").show()
		$("#esq_minha_senha").show()
		$("#esqueci").show()
	 })
	 $("#tentar_login2").livequery("click",function(){
	    $("#entrar").show()
		
		$("#retornologin").hide()
		$("#solicita").hide()
		$("#fundo_login").show()
	    $("#esq_minha_senha2").show()
		$("#esqueci").show()
		
	 })
    /*início pagina contato*/
      
	  $("#btnenviar_mensagem").livequery("click",function(){
		nome=$("#nome_mensagem").val()
		email=$("#email_mensagem").val()
		msg=$("#telefone_mensagem").val()
		ass=$("#assunto_mensagem").val()
		        if((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 7))){
					alert("E-mail errado!")
				return false
				}
				if(nome.length==0 || email.length==0 || msg.length==0 || ass.length==0  ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
		$.ajax({
			type:"POST",
			url:"mensagem_contato.php",
			data:{txtnome:nome , txtemail:email , txtmsg:msg , txtass:ass , enviado:"1"},
			success: function(r){
				$("#retorno_mensagem").html(r)
				$("#nova_mensagem").show("slow")
				$("#btnenviar_mensagem").hide("slow")
			}
		})
return false
	}//fim else
	})
	
	 $('#indexbt').livequery("click",function(){
	     $("#banner").hide();
	 })
	
	 $("#banner").hide().fadeIn('10000');
	 window.setTimeout(function()
	 {
	 $("#banner").fadeOut('20000').hide();
	 $("#linfechar").fadeOut('20000').hide(); 
	 }, 10000);
	 $('#linfechar').livequery("click",function(){
	   $(this).hide();
	   $('#banner').hide();
	   return false
	})

	
	div = $('#indexdiv').val();
	switch (div){
	case("index"):
	   $('#menu_superior a span').removeClass();
	   $('span#iniciop').addClass('selecionadolink');
	break;
    
	case("empresa"):
	   $('#menu_superior a span').removeClass();
	   $('span#empresap').addClass('selecionadolink');
	break;

	case("anuncie"):
	   $('#menu_superior a span').removeClass();
	   $('span#anunciep').addClass('selecionadolink');
	break;
	case("tvcavalinho"):
	   $('#menu_superior a span').removeClass();
	   $('span#tvcavalinhop').addClass('selecionadolink');
	break;	case("propaganda"):
	   $('#menu_superior a span').removeClass();
	   $('span#propagandap').addClass('selecionadolink');
	break;
	
    case("centrala"):
	   $('#menu_superior a span').removeClass();
	   $('span#centralap').addClass('selecionadolink');
	break;
    case("seguranca"):
	   $('#menu_superior a span').removeClass();
	   $('span#segurancap').addClass('selecionadolink');
	break;
    case("cadastre"):
	   $('#menu_superior a span').removeClass();
	   $('span#cadastrep').addClass('selecionadolink');
	break;
    case("servico"):
	   $('#menu_superior a span').removeClass();
	   $('span#servicop').addClass('selecionadolink');
	break;
    case("contato"):
	   $('#menu_superior a span').removeClass();
	   $('span#contatop').addClass('selecionadolink');
	break;
	}
   /* $("#corpo").livequery("mouseenter",function(e){
        var x = e.pageX - this.offsetLeft;
        var y = e.pageY - this.offsetTop;
        $('#mexemenu').animate({left:x ,top:y},1); 
    });*/
/*BANNER
	function fecha_banner(){
		var banner_obj = document.getElementById('banner_popup');
		banner_obj.style.display = 'none';
		}
	function fecha_banner_timeout(){
		setTimeout('fecha_banner()', 1000);
		}
	function abre_banner(){
		var banner_obj = document.getElementById('banner_popup');
		banner_obj.style.left = '200px';
		banner_obj.style.top = '100px';
		banner_obj.style.display = '';
		fecha_banner_timeout();
		}


FIM BANNER*/
  

	  $('#abremenu').livequery("click",function(){
	    $(this).hide();
		$("#fechamenu").show();
		$("#menuadm").show();
		return false;
	  })
	  $('#fechamenu').livequery("click",function(){
	    $(this).hide();
		$("#abremenu").show();
		$("#menuadm").hide();
		return false;
	  })
	 $("#nova_mensagem").livequery("click",function(){
		$("#btnenviar_mensagem").show("slow")
		$(this).hide("slow")
	    $("#retorno_mensagem").html("")
		$("#nome_mensagem").attr("value","")
		$("#email_mensagem").attr("value","")
		$("#telefone_mensagem").attr("value","")
		$("#assunto_mensagem").attr("value","")
	 });
	  
	/*fim pagina contato*/
	
	 /*início pagina contato desenvolvedor*/
	 
	  $("#btnenviar_desen").livequery("click",function(){
		nome=$("#nome_desen").val()
		email=$("#email_desen").val()
		msg=$("#telefone_desen").val()
		ass=$("#assunto_desen").val()
		        if((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 7))){
					alert("E-mail errado!")
				return false
				}
				if(nome.length==0 || email.length==0 || msg.length==0 || ass.length==0  ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
		$.ajax({
			type:"POST",
			url:"msn_contato_desen.php",
			data:{txtnome:nome , txtemail:email , txtmsg:msg , txtass:ass , enviado:"1"},
			success: function(r){
				$("#retorno_desen").html(r)
				$("#nova_desen").show("slow")
				$("#btnenviar_desen").hide("slow")
			}
		})
return false
	}//fim else
	})
	
	
	 $("#nova_desen").livequery("click",function(){
		$("#btnenviar_desen").show("slow")
		$(this).hide("slow")
	    $("#retorno_desen").html("")
		$("#nome_desen").attr("value","")
		$("#email_desen").attr("value","")
		$("#telefone_desen").attr("value","")
		$("#assunto_desen").attr("value","")
	 });
	  
	/*fim pagina contato desenvolvedor*/
	
	  /*início anuncie*/
	  $("#telefoneanuncio").mask("99-9999-9999");
	  $("#celularanuncio").mask("99-9999-9999");
	  $("#enviaranuncie").livequery("click",function(){
		nome=$("#nomeanuncio").val()
		email=$("#emailanuncio").val()
		msg=$("#telefoneanuncio").val()
		ass=$("#celularanuncio").val()
		empresaanun=$("#empresaanuncio").val()
		cidadeanun=$("#cidadeanuncio").val()
		estadoanun=$("#estadoanuncio").val()
		dimensaoanun=$("#dimensao").val()
		        if((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 7))){
					alert("E-mail errado!")
				return false
				}
				if(nome.length==0 || email.length==0 || msg.length==0 || cidadeanun.length==0 || estadoanun.length==0 ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
					
		$.ajax({
			type:"POST",
			url:"contratar_anuncio_mensagem.php",
			data:{txtnome:nome , txtemail:email , txtmsg:msg , txtass:ass ,txtempresa:empresaanun , txtcidade:cidadeanun , txtestado:estadoanun , txtdimensao:dimensaoanun , enviado:"anuncie"},
			success: function(r){
				$("#retorno_anuncie").html(r)
				$("#enviaranuncie").slideDown("slow").hide("slow")
				$("#denovo").slideUp("slow").show("slow")
			}
		})
return false
	}//fim else
	})
	
	
	  
	  
	  $("#empresaanuncio").addClass("valor2")
	
		$("#empresaanuncio").livequery("click",function(){
		  $(this).attr("value","")
		  $(this).removeClass("valor2")
		})
		$("#empresaanuncio").livequery("blur",function(){
		  valor=$(this).val()
		  if(valor.length==0){
		  $(this).addClass("valor2")
		  $(this).attr("value","Pessoa fisica manter em branco")
		  }
		})
	/*fim --- anuncie*/

	 	 
	 /*início parceiro*/
	  $("#telefoneparceiro").mask("99-9999-9999");
	  $("#celularparceiro").mask("99-9999-9999");
	  $("#enviarparceiro").livequery("click",function(){
		nome=$("#nomeparceiro").val()
		email=$("#emailparceiro").val()
		msg=$("#telefoneparceiro").val()
		ass=$("#celularparceiro").val()
		empresaanun=$("#empresaparceiro").val()
		cidadeanun=$("#cidadeparceiro").val()
		estadoanun=$("#estadoparceiro").val()
		dimensaoanun=$("#assuntoparceiro").val()
		
		
		        if((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 7))){
					alert("E-mail errado!")
				return false
				}
				if(nome.length==0 || email.length==0 || msg.length==0 || cidadeanun.length==0 || estadoanun.length==0 ){
					alert("Preecha o formulario corretamente!")
				return false
				}
				else{
			$.ajax({
			type:"POST",
			url:"contratar_parceiro_mensagem.php",
			data:{txtnome:nome , txtemail:email , txtmsg:msg , txtass:ass ,txtempresa:empresaanun , txtcidade:cidadeanun , txtestado:estadoanun , txtdimensao:dimensaoanun , enviado:"anuncie"},
			success: function(r){
				$("#retorno_parceiro").html(r)
				$("#enviarparceiro").slideDown("slow").hide("slow")
				$("#denovo2").slideUp("slow").show("slow")
			}
		   })
    return false
	}//fim else
	})
	

	  
	  
	  $("#empresaparceiro").addClass("valor2")
	
		$("#empresaparceiro").livequery("click",function(){
		  $(this).attr("value","")
		  $(this).removeClass("valor2")
		})
		$("#empresaparceiro").livequery("blur",function(){
		  valor=$(this).val()
		  if(valor.length==0){
		  $(this).addClass("valor2")
		  $(this).attr("value","Pessoa fisica manter em branco")
		  }
		})
	/*fim --- parceiro*/
	
	
	
	
    });

});
	 	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 



