////////////////////////////////
// READY FUNCTION LAYOUT //////
///////////////////////////////
$(document).ready(function () {



$('div.panohome a')
   .css({ 'backgroundPosition': '0 0' })
        .hover(
     function(){
       $(this).stop()
         .animate({
           'opacity': 0
         }, 500);
          },
          function(){
       $(this).stop()
         .animate({
           'opacity': 1
         }, 500);
          }
        );
function affichage_popup(nom_de_la_page, nom_interne_de_la_fenetre)
{
window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height=480, width=800, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}


myLayout = $('#conteneur').layout({
	   fxName:"slide"
	,  fxSpeed:"slow"
    ,  closable:true
});
$('#conteneur').layout();
var $resizer_east = $(".ui-layout-resizer-east").css({ overflow: "visible" });
var $resizer_west = $(".ui-layout-resizer-west").css({ overflow: "visible" });
var $toggler_west = $(".ui-layout-toggler-west").css({ overflow: "visible" });
var $toggler_east = $(".ui-layout-toggler-east").css({ overflow: "visible" });
$("<div></div>")
    .css({
        background:  "#FFF"
    ,   width:            "100%"
    ,   height:           "100%"
	,	padding:		  "0 10px"
	,	marginLeft:		  "-20px"
    ,   opacity:         .65
    })
    .prependTo( $resizer_east ); 
$("<div></div>")
    .css({
        background:  "#000"
    ,   width:            "100%"
    ,   height:           "100%"
	,	padding:		  "10px"
    ,   opacity:         .75
    })
    .prependTo( $resizer_west ); 
$("<div></div>")
    .css({
        width:            "100%"
    ,   height:           "100%"
	,	padding:		  "10px"
    ,   opacity:         .75
    })
    .prependTo( $toggler_west ); 
$("<div></div>")
    .css({
        width:            "100%"
	,	padding:		  "0 10px"
	,	marginLeft:		  "-20px"
    ,   height:           "100%"
    ,   opacity:         .75
    })
    .prependTo( $toggler_east ); 
});
////////////////////////////////
// READY FUNCTION HISTORY /////
///////////////////////////////
$(document).ready(function () {
	getPage();
	$.history.init(pageload);	
	$('a[href=' + document.location.hash + ']').addClass('selected');
	$('a[rel=ajax]').click(function () {
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');
	 	$.history.load(hash);	
	 	$('a[rel=ajax]').removeClass('selected');
	 	$(this).addClass('selected');
	 	$('#gal_home').hide();
	 	myLayout.hide('east');
	 	$('#content').hide();
	 	$('#loading').show();
		getPage();
		return false;
	});	
});
function pageload(hash) {
	if (hash) getPage();    
}
function getPage() {
	if (document.location.hash=='') 
		var data = 'page=' + encodeURIComponent('#home');
	if (document.location.hash=='') 
		$('#gal_home').load('contenu/gal/home.php');
	else var data = 'page=' + encodeURIComponent(document.location.hash);
	$.ajax({
		url: "library/loader.php",	
		type: "GET",		
		data: data,		
		cache: false,
		success: function (html) {	
			$('#loading').hide();	
			$('#content').html(html);
			var pageactuel = document.location.hash;
			var realpage = pageactuel.replace(/^.*#/, '');
			$('#gal_home').load('contenu/gal/' + realpage + '.php');
			$('#gal_home').fadeIn('slow');
			$('#content').fadeIn('slow');//.delay(1600)
			myLayout.show('east');
	}		
	});
}
//////////////////////////////
// READY FUNCTION MODAL /////
/////////////////////////////


