// JavaScript Document
function ajouteClasses()
{
	div = $('div_content');
	if (div)
	{
		h = div.getStyle('height').toInt();
		if (h>450)
			{ div.setStyle('height','450px'); }		
	}
	

	$$('.ligne1').each(function(el)
		{
			el.addEvent('mouseover',function(el2){ el.setStyle('background-color','EDDDED'); });
			el.addEvent('mouseout',function(el2){ el.setStyle('background-color','FFFFFF'); });
		});

	$$('.ligne2').each(function(el)
		{
			el.addEvent('mouseover',function(el2){ el.setStyle('background-color','DDF1FB'); });
			el.addEvent('mouseout',function(el2){ el.setStyle('background-color','FFFFFF'); });
		});

	$$('.ligne4').each(function(el)
		{
			el.addEvent('mouseover',function(el2){ el.setStyle('background-color','FFFFCF'); });
			el.addEvent('mouseout',function(el2){ el.setStyle('background-color','FFFFFF'); });
		});

	$$('.ligne5').each(function(el)
		{
			el.addEvent('mouseover',function(el2){ el.setStyle('background-color','CFF3E1'); });
			el.addEvent('mouseout',function(el2){ el.setStyle('background-color','FFFFFF'); });
		});
	div_center();
}

function getPageSize() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}



function div_cache_visible(isVisible,width)
{
	if (isVisible==true)
		{
			$('div_cache').setStyle('width',window.screen.width);
			//$size = getPageSize();
			//$('div_cache').setStyle('height',$size[1]+'px');
			$('div_cache').setStyle('left','0px');
			$('div_cache').style.display = 'block';
			$('div_list').setStyle('display','block');
			$('div_list').setStyle('opacity','0');
			$('div_list').setStyle('width',width+'px');
			div_center();
			$('div_list').setStyle('top',(window.getScrollTop() + 100)+'px');
			new Fx.Styles('div_list', {duration: 500, transition: Fx.Transitions.Circ.easeInOut, onComplete:ajouteClasses}).start({
				'opacity':1});
			try
				{ $$('embed,object').setStyle('display','none'); }
			catch(e) { };
			
		}
	else
		{
			try
				{ $$('embed,object').setStyle('display','block'); }
			catch(e) { };
			$('div_cache').style.display='none';
			$('div_list').style.width='400px'; 
			$('div_list').style.display='none';
		}
}


function div_center(div_width)
{
	var h=document.body.clientHeight;
	var w=document.body.clientWidth;			
		
	d= $('div_cache');
	d.style.width = w+'px';
	d.style.height = h+10+'px';
										
	d= $('div_list');
	d.style.top = '0px';
	if (((h-d.clientHeight)/2) > 20) 
		{d.style.top = (h-d.clientHeight)/2+'px';}
	else
		{d.style.top = '20px';}



	d.style.left = (w-d.clientWidth)/2+'px';	
}

