
$(document).ready(function() {   	
	
   $("#global").append('<div class="clearfooter"></div>');        
   $("ul.menu-bas li:first").css('border-width',0);
   $("ul.menu-bas li:first").css('padding-left',0);
   
   $("#global").append('<div id="escalier-tourni"></div>');
   
	$(".menuhaut li").hover(function(){    	
		$(".menuhaut li.current").addClass('excurrent');
		$(".menuhaut li.current").removeClass('current');
	},function(){
		$(".menuhaut li.excurrent").addClass('current');
		$(".menuhaut li.excurrent").removeClass('excurrent');
	});
	
	
	 $('a[rel="nofollow"]').click(function(){
	 	return false;
	});
	
	$('a[name="audit-referencement"]').css('cursor','pointer');
	$('a[name="audit-referencement"]').qtip({
	       content: {
	          // Set the text to an image HTML string with the correct src URL to the loading image you want to use
	          text: '<div style="margin:30px auto;width:32px;text-align:center;"><img src="../img/loader.gif" alt="Loading..." /></div>',
	          url: '../phps/ajax.php?mod=form-audit', // Use the rel attribute of each element for the url to load
	          title: {
	             text: 'Recevez sans engagement un audit clair et pr&eacute;cis de votre r&eacute;f&eacute;rencement', // Give the tooltip a title using each elements text
	             button: 'Close' // Show a close link in the title
	          }
	       },
	       position: {
	          corner: {
	             target: 'bottomMiddle', // Position the tooltip above the link
	             tooltip: 'topMiddle'
	          },
	          adjust: {
	             screen: true // Keep the tooltip on-screen at all times
	          }
	       },
	       show: { 
	          when: 'click', 
	          solo: true // Only show one tooltip at a time
	       },
	       hide: 'unfocus',
	       style: {
	          tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
	          border: {
	             width: 0,
	             radius: 4
	          },
	          name: 'light', // Use the default light style
	          width: 620 // Set the tooltip width
	       }
	
	});
	
	$("#demande-audit").livequery('submit',function() { 
	    // submit the form 
	    var flag = true;
	    $("#demande-audit input").each(
		    function(){
		    	if($(this).val() == ""){
		    		flag = false;
		    	}
		    }
	    );
	    if(flag){
		    $(this).ajaxSubmit({
		    	target: '#dde-essai'
		  	}); 
		  } else {
		  	alert('Veuillez noter que tous le champs sont obligatoires. Merci');
		  }
	    // return false to prevent normal browser submit and page navigation 
	    return false; 
		});
	
	 $('a[rel="nofollow"]').each(function()
   {
      // Create image content using websnapr thumbnail service
      var content = '<img src="';
      content += $(this).attr('rev');
      content += '" alt="'+$(this).attr('title')+'" />';
      
      // Setup the tooltip with the content
      $(this).qtip(
      {
         content: content,
         position: {
            corner: {
               tooltip: 'rightMiddle',
               target: 'leftMiddle'
            }
         },
         style: {     
         		tip: true,                   
            width:600
         }
      });
   });

	

         
});