/**
 * @author Administrateur
 */
jQuery(function(){

	jQuery("#fooword").focus(function(){
		jQuery("#fooword").val('');
	});
	
	jQuery("#fooword").blur(function(){
		if (jQuery("#fooword").val() == '') {
			jQuery("#fooword").val('Rechercher...');
		}
	});	

	jQuery("a#forward").click(function(){
		jQuery("#carousel_wrapper").animate({opacity: 0.1}, 200).animate({ 
			opacity: 1.0,
	        marginLeft: "-935px"
      	}, 1000 );
		return false;
	});
	
	jQuery("a#backward").click(function(){
		jQuery("#carousel_wrapper").animate({opacity: 0.1}, 200).animate({ 
	        opacity: 1.0,
	        marginLeft: "0"
      	}, 1000 );
		return false;
	});
	
	// Vérification de l'exitence de tweets	
	if (document.getElementById('mytweets')) {
		var tweet_width = 900; // largeur d'une ligne de tweet
		var mytweet_width_px = jQuery("#mytweets").css('width');
		var cur_pos = -2700;
		mytweets_width = 0; // largeur correspondant à l'ensemble des tweets, désolé il faut le saisir à la main
		
		// Affectation de la fonction de défilement des tweets		
		jQuery("a#mytweets_next").click(function(){

			// Calcul de la position suivante
			cur_pos += tweet_width;
			// Vérification que l'on n'a pas fait défilé tout les tweets
			if (cur_pos >= 900) {
				cur_pos = -2700;
			}
			// Défilement
				jQuery("#mytweets").animate({opacity: 0.5}, 200).animate({ 
				opacity: 1.0,
		        marginLeft: cur_pos+"px"
	      	}, 1000 );
			return false;
		});			
	}
	
	if (jQuery.browser.mozilla || $.browser.opera || $.browser.safari) {
	}


	jQuery('.tooltip').tipsy({gravity: 'n',fade: true});
});