/* Alterner */
function alterner(obj1, obj2){
var obj1 = document.getElementById(obj1);
var obj2 = document.getElementById(obj2);
obj1.style.display = (obj1.style.display == "block") ? "none" : "block";
obj2.style.display = (obj2.style.display == "block") ? "none" : "block";
}
        
/* Menu haut jquery */
$(document).ready(function(){
		$(".open_menu").hover(function()
		{
		$("#menu_plus").fadeIn('slow');
		return false;
		});
		
		$(".close_menu").click(function()
		{
		$("#menu_plus").fadeOut('slow');
		return false;
		});
		
		// Hide the modal dialog when someone clicks outside of it.
		$("#menu_plus").bind( "clickoutside", function(event){
		$("#menu_plus").fadeOut('slow');
		});

        //Tinytips
        $('a.tTip').tinyTips('light', 'title');
	    $('img.tTip').tinyTips('orange', 'title');
});
        

/* Bouton share it digg */
$(document).ready(function() {

	$('a[rel=shareit], #shareit-box').mouseenter(function() {		
		
		var height = $(this).height();
		var top = $(this).offset().top;
		
		var left = $(this).offset().left + ($(this).width() /2) - ($('#shareit-box').width() / 2);		

		var value = $(this).attr('href').split('|');
		
		var field = value[0];
		var url = encodeURIComponent(value[0]);
		var title = encodeURIComponent(value[1]);
		
		$('#shareit-header').height(height);

		$('#shareit-box').show();
		
		$('#shareit-box').css({'top':top, 'left':left});
		
		$('#shareit-field').val(field);
		
		$('a.shareit-sm').attr('target','_blank');
		
		$('a[rel=shareit-mail]').attr('href', 'http://mailto:?subject=' + title);
		$('a[rel=shareit-facebook]').attr('href', 'http://www.facebook.com/share.php?u='  + url);
		$('a[rel=shareit-twitter]').attr('href', 'http://twitter.com/home?status=RT @nokenny ' + title + '%20-%20' + url);
		
	});

	$('#shareit-box').mouseleave(function () {
		$('#shareit-field').val('');
		$(this).hide();
	});
	
	$('#shareit-field').click(function () {
		$(this).select();
	});
});


/* Commentaires ajax */
/*
$(document).ready(function(){

$(".submit").click(function()
{
var pseudo = $("#pseudo").val();
var email = $("#email").val();
var texte = $("#texte").val();
var id_module = $("#id_module").val();
var titre = $("#titre").val();
var dataString = 'pseudo='+ pseudo + '&email=' + email + '&texte=' + texte + '&id_module=' + id_module + '&titre=' + titre;
if(pseudo=='' || email=='' || texte=='')
{
alert('Vous n\'avez pas rempli tous les champs.');
}
else
{
$("#form_commentaire").fadeOut("slow");
$("#flash").show();
$("#flash").fadeIn(400).html('<!--<center><img src="/Themes/janvier2010/images/ajax-loader.gif"/></center>-->');
$.ajax({
type: "POST",
url: "/commentaires/poster",
data: dataString,
cache: false,
success: function(html){
$("div#update").append(html);
$("#flash").hide();
}
});
}return false;
}); 

});
*/

