
//ROLLOVER ADD
var a
a=new Array();
a[0]=new Image;
a[0].src="images/add_facebook_on.png";
a[1]=new Image;
a[1].src="images/add_facebook.png";
a[2]=new Image;
a[2].src="images/add_twitter_on.png";
a[3]=new Image;
a[3].src="images/add_twitter.png";

//change l'image
function roll(img,nb) {
eval("img.src=a["+nb+"].src");
}
//END OF ROLLOVER ADD

//ACCORDION MENU

$(document).ready( function () {							 
							
    /*$(".content_left").hide();
    $(".content_left").stop().fadeTo("normal", 0);*/
	  
	// On cache les sous-menus :
    $("#nav ul.subMenu").hide();
    // On sélectionne tous les items de liste portant la classe "toggleSubMenu"

    // et on remplace l'élément span qu'ils contiennent par un lien :
    $("#nav li.toggleSubMenu span").each( function () {
        // On stocke le contenu du span :
        var TexteSpan = $(this).text();
        $(this).replaceWith('<a href="" title="show submenu">' + TexteSpan + '<\/a>') ;
    } ) ;

    // On modifie l'évènement "click" sur les liens dans les items de liste
    // qui portent la classe "toggleSubMenu" :
    $("#nav li.toggleSubMenu > a").click( function () {
        // Si le sous-menu était déjà ouvert, on le referme :
        if ($(this).next("ul.subMenu:visible").length != 0) {
            $(this).next("ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("opens") });
        }
        // Si le sous-menu est caché, on ferme les autres et on l'affiche :
        else {
            $("ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("opens") });
			$(this).next("ul.subMenu").slideDown("normal", function () { $(this).parent().addClass("opens") });
        }
		
        // On empêche le navigateur de suivre le lien :
        return false;
    });
	$("#nav li#about > a").click( function () {
        // Si le sous-menu était déjà ouvert, on le referme :
        
            $("ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("opens") });		
        // On empêche le navigateur de suivre le lien :
        return false;
    });
	$("#nav li#contact > a").click( function () {
        // Si le sous-menu était déjà ouvert, on le referme :
        
            $("ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("opens") });		
        // On empêche le navigateur de suivre le lien :
        return false;
    });
//END OF ACCORDION MENU

//OPACITY ON MOUSEOVER HOME
$("img.imgHome").mouseover(function () {
      $(this).stop().fadeTo("normal", 0);
    });

$("img.imgHome").mouseout(function () {
      $(this).stop().fadeTo("normal", 1);
    });

//END OF OPACITY ON MOUSEOVER HOME

//AJAX PAGE LOAD MENU

    var hash = window.location.hash.substr(1);
	 if(window.location.href.indexOf('#') > 0 && window.location.hash != '')
	 { 
	 	window.location.href = hash;
		return false;
	 }
	
    $('a.link').click(function(event){
	
		event.preventDefault();
		
		
		var toLoad = $(this).attr('href');
		//get the name of the page and the id of the container the data are loaded from
		$('.container').fadeOut('slow',loadContent);

		$('a.link').css('text-decoration','none');
		$(this).css('text-decoration','line-through');

		
		//$('#load').remove();
		//if not removed, every page load adds a loader on the page
		window.location.hash = $(this).attr('href');
		//$('#loader').append('<span id="load"></span>');
		//$('#load').fadeIn('normal');
		function loadContent() {
			
			$('.container').load(toLoad,'',showNewContent);
		}
		function showNewContent() {
			$('.content_right').css('padding-right','100px');
			$('.container').fadeIn('slow');
		}
		//function hideLoader() {  
			//$('#load').fadeOut('normal');  
		//}
		return false;
    });
//END OF AJAX PAGE LOAD

//HISTORY PLUGIN
/*

	$.historyInit(pageload);


	// sélection de tous les liens a ayant l'attribut rel égal à history (valeur arbitraire)
	$("a[@rel='history']").click(function(){
 
   		//suppression du mot cle history, pour que les liens ne soient surchargés qu'une seule fois
   		this.rel = this.rel.replace(/history/, '');
       
   		// mise à jour de l'ancre
   		var hash = this.href;
       
   		// suppression du caractère #
   		hash = hash.replace(/^.*#/, '');
       
   		// chargement dans l'historique et appel de pageload
   		$.history.load(hash);
       
   		// trés important : désactivation du clic du lien a
   		return false;
 	});
	*/

//END OF HISTORY PLUGIN

});
	

//End of document ready...// JavaScript Document