$(document).ready(function(){
		/*////////////////////////////////////////////////////////////////////*/
		/*/////////////////     NUAGE DE TAG          ////////////////////*/
		/*///////////////////////////////////////////////////////////////////*/
		$('#tag').tagSphere({
			//height: 180,
			height: 200,
			width: 400,
			slower: 0.50,
			//radius: 45,
			radius: 60,
			timer: 30,
			fontMultiplier: 25,
			tagCSSOver: {
				border: 'none',
				color: '#1a3971'
			}
		});
		/*////////////////////////////////////////////////////////////////////*/
		/*/////////////////     MENU DEROULANT          ////////////////*/
		/*///////////////////////////////////////////////////////////////////*/
		$('ul.sf-menu').superfish();
		/*////////////////////////////////////////////////////////////////////*/
		/*/////////////////     MENU Banniere          ////////////////*/
		/*///////////////////////////////////////////////////////////////////*/
		
		
		/*
		$('#labo').hover(function(){
			//$(this).stop().animate({backgroundColor: 'white'});
			$('#banniere').css({'background' : 'url(design/banniere_lotus.jpg) no-repeat'}).animate({
				opacity: 0
		  	}, 1000, function() {
			// Animation complete.
		  	});
			
			$('#banniere').css({'background' : 'url(banniere_test/tout/labo_pierre.jpg) no-repeat'}).animate({
				opacity: 1
		  	}, 1000, function() {
			// Animation complete.
		  	});
				
		},function(){
			$('#banniere').css({'background' : 'url(design/banniere_lotus.jpg) no-repeat'});
    });
		*/
	
	
	
	function changeBGImageAnime1(Image){
		
		$('#banniere').animate({
				opacity: 0
		  	}, 500, function() {
				// Animation complete.
				$('#banniere').css({'background-image':'url(design/'+Image+')'}).animate({
					opacity: 1
				}, 500, function() {
				// Animation complete.
				});
			});
		//$('#tag').css({'opacity':'1')});
	}
	//width: 'toggle'
	function changeBGImageAnime2(Image){
		
		$('#banniere').animate({
				width: 'toggle',
				//opacity: 0
		  	}, 500, function() {
				// Animation complete.
				$('#banniere').css({'background-image':'url(design/'+Image+')'}).animate({
					width: 'toggle',
					//opacity: 1
				}, 500, function() {
				// Animation complete.
				});
			});		
	}
	 
	 function changeBGImage(Image){
		$("#banniere").css({'background-image':'url(design/'+Image+')'})
	}
	
	
	function precharger_image(url)
	{
		var img = new Image();
		img.src=url;
		return img;
	}
	
	/*
	var bouton = [ "#apro", "#serv","#rela","#labo","#peda","#cont","#vip" ];
    
    $.each(bouton,function(index, item)
    {		
		$(item).hover(function(){
				changeBGImage("bg"+index+".jpg");
		},function(){
				changeBGImage('banniere_lotus.jpg');
		});
		
		precharger_image("design/bg"+index+".jpg");
		
    });
	*/

});
/*////////////////////////////////////////////////////////////////////*/
/*/////////////////     CHOIX BANNIERE           ////////////////*/
/*///////////////////////////////////////////////////////////////////*/
window.onload = initForm;
window.onunload = function() {};

function initForm(){	
	document.getElementById("changeBanniere").selectedIndex = 0;
	document.getElementById("changeBanniere").onchange = changeBan;
}

function changeBan(){
	var newBan = document.getElementById("changeBanniere");
	var valueOption = newBan.options[newBan.selectedIndex].value;
	
	
	if (valueOption != ""){
		//alert ("ban"+valueOption+".jpg");
		document.getElementById("banniere").style.background='url(banniere_test/'+valueOption+')';
	}
}



/*////////////////////////////////////////////////////////////////////*/
/*/////////////////     CALENDRIER           //////////////////////*/
/*///////////////////////////////////////////////////////////////////*/
$(function() {
	$( "#datepicker" ).datepicker();
});
/*////////////////////////////////////////////////////////////////////*/
/*/////////////////     INFO BULLE TITLE           ///////////////*/
/*///////////////////////////////////////////////////////////////////*/
this.contactPreview = function() {
jQuery("a.contact").live('click', function(e){
        //store clicked link
        var $this = jQuery(this);
        //store title
        var title = $this.attr('title');
        //remove title
        $this.attr('title', '');

        //tip !== "" ? "<br />" + title : "";                                    

        jQuery("body").append("<p id='contact-info'>" + title + "<a id='close-contact' class='close-contact' style='color:red;'>Close</a></p>");

        //store reference to anchor and persist title on close-contact anchor
        jQuery('#close-contact').data('anchor', $this).data('title', title);

        jQuery("#contact-info").css("top", (e.pageY - xOffset) + "px")
                               .css("left", (e.pageX + yOffset) + "px")
                               .fadeIn(500);
    });

    jQuery("#close-contact").live('click', function(){
        //store clicked link
        var $this = jQuery(this);
        //get anchor    
        var $anchor = $this.data('anchor');
        //get title
        var title = $this.data('title');
        //set anchors title back
        $anchor.attr('title', title);            
        //remove tip
        jQuery('#contact-info').remove();  

    });
};

// Use jQuery() instead of $()for WordPress compatibility with the included prototype js library which uses $()
// http://ipaulpro.com/blog/tutorials/2008/08/jquery-and-wordpress-getting-started/
// See http://chrismeller.com/using-jquery-in-wordpress
jQuery(document).ready(function(){

    // Call the function here
    contactPreview();

});
