/*
$(function(){
  $('#contenu').jScrollPane();
});
*/

$(document).ready(function(){    
  // Gestion print.
  $('a.print').click(function () {
	  var o = $('div.print');
    var c = o.css("color");
		$.jPrintArea('div.print'); 
		o.css("color",c)
  });

  // Gestion admin.
  $('button#admin').click(function () {
    //alert('admin');
    //  var o = $("#contenu").html(); 
    $("#windowContent").text("Admin");
    $("#windowOpen").click()
  });
	
  // Gestion des ouvertures et fermeture des box dans les marges.
  $('ul.top').click(function () {
      
  	 $("ul.middle").each(function(j){
       $(this).hide(); // nom du champ 
			 $(this).prev(".top").css("background-position", "right bottom");
  	 });		 
	
  	var o = $(this).next(".middle");
  	if (o.is(":hidden")) { 
			$(this).css("background-position", "right top");
		  o.show(); 
		} 
  	else { 
			$(this).css("background-position", "right bottom");
		  o.hide(); 
		}		
  });
	

/*
		// simple accordion
		// second simple accordion with special markup
		jQuery('#navigation').accordion({
			active: false,
			header: '.head',
			navigation: true,
			event: 'mouseover',
			fillSpace: true,
//			animated: 'easeslide'
//			animated: "bounceslide",			
			autoheight: false
		});
		// bind to change event of select to control first and seconds accordion
		// similar to tab's plugin triggerTab(), without an extra method
		var accordions = jQuery('#list1a, #navigation');

*/
});


function IT_init(){
	var page=(IT_init.arguments[0])?IT_init.arguments[0]:""; 
  var bas = 20;
  var ww = $(window).width();
  var hh = $(window).height() - bas;   
  $("div#enveloppe").animate({height: hh}, "slow");
  //$("div#enveloppe").height(hh);
	var a="";
  if(page!=""){
  	$("ul.middle li a").each(function(j){
      var reg=new RegExp("[=]+", "g");
      var t=$(this).attr("href").split(reg);
      var end=t[t.length-1];
      if(end==page){
  		  $(this).addClass("selected");
  		  var li = $(this).parent('li');
  		  var ul = li.parent('ul.middle');
  			var ul1 = ul.prev('.top');
        ul.show(); 
        ul1.css("background-position", "right top");
  		}
    });		 

  	$("div#menubas a").each(function(j){
      var reg=new RegExp("[=]+", "g");
      var t=$(this).attr("href").split(reg);
      var end=t[t.length-1];
      if(end==page){
  		  $(this).addClass("selected");
  		}
    });
				 
	}
}