/*************************************************************************************************************/
/*************************************************************************************************************/
/*************************************************************************************************************/
$(document).ready(function(){
  $('input#autocomplete-input').val("Recherche de rubrique");
  $('input#autocomplete-input').click(function(){
    if($('input#autocomplete-input').val() == 'Recherche de rubrique') $('input#autocomplete-input').val('');  
  });
  $('input#autocomplete-input').blur(function(){
    $('#autocomplete-result').hide('slow'); 
  });
  $('input#autocomplete-input').keyup(function(){
    searchAjax = $('input#autocomplete-input').val();
    if(searchAjax.length >2){
      $('#ajax-loader').html('<img src="js/autocomplete/images/ajax-loader.gif" alt="..." />');
      $.ajax({
        type: "POST",
        url: "function_ajax.php",
        data: "op=autocompleteAjax&query="+searchAjax+"",
        success: function(msg)
        {
        if(msg != '') {
          $('#autocomplete-result').show('slow');
          $('#autocomplete-result').html(msg);
        }else{
          $('#autocomplete-result').hide('slow');       
        }
        $('#ajax-loader').html('');
        }  
      });
     }  
  }); 
/*************************************************************************************************************/  
  $('input#autocomplete-input-etp2').click(function(){
    if($('input#autocomplete-input-etp2').val() == 'Recherche de rubrique') $('input#autocomplete-input-etp2').val('');  
  });
  $('input#autocomplete-input-etp2').blur(function(){
    $('#autocomplete-result-etp2').hide('slow'); 
  });
  $('input#autocomplete-input-etp2').keyup(function(){
    searchAjax = $('input#autocomplete-input-etp2').val();
    if(searchAjax.length >2){
      $('#ajax-loader-etp2').html('<img src="js/autocomplete/images/ajax-loader.gif" alt="..." />');
      $.ajax({
        type: "POST",
        url: "function_ajax.php",
        data: "op=autocompleteAjax&query="+searchAjax+"",
        success: function(msg)
        {
        if(msg != '') {
          $('#autocomplete-result-etp2').show('slow');
          $('#autocomplete-result-etp2').html(msg);
        }else{
          $('#autocomplete-result-etp2').hide('slow');       
        }
        $('#ajax-loader-etp2').html('');
        }  
      });
     }  
  }); 
});
/*************************************************************************************************************/
function autoCgo_hover(){
  $('img#autoCgoBTN').css('display','none');
  $('img#autoCgoBTNhover').css('display','block'); 
}
function autoCgo_out(){
  $('img#autoCgoBTNhover').css('display','none');
  $('img#autoCgoBTN').css('display','block');  
}
function autocompleteSubmit(){
  $('#autocomplete-result').hide('slow');
  f=document.getElementById('form_autocomplete');
  f.submit();
}
/*************************************************************************************************************/
function autoCgo_hover2(){
  $('img#autoCgoBTN-etp2').css('display','none');
  $('img#autoCgoBTNhover-etp2').css('display','block'); 
}
function autoCgo_out2(){
  $('img#autoCgoBTNhover-etp2').css('display','none');
  $('img#autoCgoBTN-etp2').css('display','block');  
}
function autocompleteSubmit2(){
  $('#autocomplete-result-etp2').hide('slow');
  f=document.getElementById('form_autocomplete-etp2');
  f.submit();
}
/*************************************************************************************************************/
function autocompleteLink(id,pid,nameLink) {
  if(pid==0){
    document.location.href="devis-comparatif-"+nameLink+"-reference-"+id+".html";
  }else{
    document.location.href="demande-de-devis-gratuit-"+nameLink+"-formulaire-"+id+".html";
  }
}
