//K
function xhr(){
	if(window.XMLHttpRequest) return new XMLHttpRequest(); // FF
	else if(window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); // IE
	else {alert("Ajax is not available");return;}
}
function $(id){return document.getElementById(id);}
function exist(id){return ($(id)!=null);}
function clearDiv(out){$(out).innerHTML="";}

function evalJS(o){
	var allscript = o.getElementsByTagName('script');
	for(var i=0;i<allscript.length;i++){eval(allscript[i].innerHTML);}
}

// preload images
function prechargimg() { 
	var doc=document; 
	if(doc.images){ if(!doc.precharg) doc.precharg=new Array();
		var i,j=doc.precharg.length,x=prechargimg.arguments; for(i=0; i<x.length; i++)
			if (x[i].indexOf("#")!=0){ doc.precharg[j]=new Image; doc.precharg[j++].src=x[i];}}
}

function Havepagewidth(){
var width = window.availHeight;
alert(width);
return width;

}


function launch(pg){
	var xhr_object = xhr();
	if(xhr_object ==null){return;}
	var method="POST";
	var asynchrone=true;
	var data="";
	xhr_object.open(method, pg , asynchrone);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
	xhr_object.send(data);
}
function launch_arg(out,p,arg,whatIfOk){
	var xhr_object = xhr();
	if(xhr_object ==null){return;}

	var method="POST";
	var asynchrone=true;
	var data=arg;
	xhr_object.open(method, pg , asynchrone);
	xhr_object.onreadystatechange = function() {   
		switch (xhr_object.readyState){
			case 0 : window.status = "loading";break;
			case 1 : window.status = "loading.";break;
			case 2 : window.status = "loading..";break;
			case 3 : window.status = "loading...";break;
			case 4 : window.status = "";eval(whatIfOk);break;
			default: break;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
	xhr_object.send(data);
}
function content_arg(out,p,arg,whatIfOk,whatIfKo){
	var xhr_object = xhr();
	if(xhr_object ==null){return;}

	var pg = "content/ct_" + p + ".php";
	var method="POST";
	var asynchrone=true;
	var data=arg;
	xhr_object.open(method, pg , asynchrone);
	xhr_object.onreadystatechange = function() {   
		switch (xhr_object.readyState){
			case 0 : window.status = "loading";break;
			case 1 : window.status = "loading.";break;
			case 2 : window.status = "loading..";break;
			case 3 : window.status = "loading...";break;
			case 4 : out.innerHTML= xhr_object.responseText;
				 evalJS(out);
				 window.status = "";
				 eval(whatIfOk);
				 break;
			default: break;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
	xhr_object.send(data);
}

//
// APPLICATION
//

function start(out,pg,arg){
	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;


	// CREATE BG DIV
	var bg = document.createElement('div');
	bg.setAttribute('id', 'bg');

//	bg.style.position ='absolute';
//	bg.className='bgOpacity';	
//	bg.style.top=0;
//	bg.style.left=0;
//	bg.style.zIndex=1;
	document.body.appendChild(bg);
	content_arg($('bg'),'bgImg','','','');


	// CREATE LEFT DIV
	var l = document.createElement('div');
	l.setAttribute('id', 'l');
	l.style.position ='absolute';
	//l.style.top=85; // 110
	l.style.top=80; // 110
	//l.style.left=60;
	l.style.left=40;
	l.style.width=250; // 196
	l.style.zIndex=2;
	document.body.appendChild(l);
	content_arg($('l'),'clientList','','','');

	// CREATE MN DIV
	var mn = document.createElement('div');
	mn.setAttribute('id', 'mn');
	mn.style.position ='absolute';
	mn.style.top=50;
	mn.style.left=500;//240
	mn.style.width=parseInt(maxWidth)-1270;
	mn.style.zIndex=6;
	document.body.appendChild(mn);
	content_arg($('mn'),'mn','','','');

	// CREATE PG DIV
	var ct = document.createElement('div');
	ct.setAttribute('id', 'pg');
	ct.style.position ='absolute';
	ct.style.top=130;
	ct.style.left=280;
	ct.style.width=parseInt(w)-parseInt($('l').style.left)-parseInt($('l').style.width)-20-20-200;
	ct.style.zIndex=3;
	document.body.appendChild(ct);

	switch (pg){
		case 'link':links();break;
		case 'contact':contact();break;
		case 'talent':talent();break;
		case 'info':info();break;
		case 'contact_sent_feedback':contactSent();break;
		case '':break;
		default:content_arg($(out),pg,arg,'','');break;
	}
	if(exist('mediaList')){$('mediaList').style.width= parseInt($('pg').style.width);}

	if(exist('logo')){
		//$('logo').style.position ='absolute';
		$('logo').style.margin='28px 0 0 30px';
		$('logo').style.top=200;
		// 16/11/2008
		//$('logo').style.left=40;
		$('logo').style.left=35;
		$('logo').style.zIndex=9;
	}

	if(exist('scrollLeftClient')){
		$('scrollLeftClient').style.height=parseInt(h)-180;
	}
	if(exist('scrollImageList')){
		$('scrollImageList').style.height=parseInt(h)-300;
		$('scrollImageList').style.width=parseInt(w)-320;
	}
	autoMoveScrollNavigation();
}


function Idimage_arg(out,p,arg,whatIfOk,whatIfKo)
{
//	alert(arg);
	 var xhr_object = xhr();
        if(xhr_object ==null){return;}

        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        var data=arg;
	xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
//				alert("Je vaux maintenant" + xhr_object.responseText);
                                document.getElementById("MediaID").value=xhr_object.responseText;

				window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}


function image_arg(out,p,arg,whatIfOk,whatIfKo){
        var xhr_object = xhr();
        if(xhr_object ==null){return;}

        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        var data=arg;
        xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
                               // alert(xhr_object.responseText);
				$(out).src=xhr_object.responseText;
				 window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}


function imagecat_arg(out,p,arg,arg2,whatIfOk,whatIfKo){
        var xhr_object = xhr();
        if(xhr_object ==null){return;}
        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
	var data="id="+arg+"&catid="+arg2;
        xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
//                          alert(" image cat " + xhr_object.responseText);
				$(out).src=xhr_object.responseText;
				 window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}


function Idimagecat_arg(out,p,arg,arg2,whatIfOk,whatIfKo){
	 var xhr_object = xhr();
        if(xhr_object ==null){return;}
	//alert("je suis argument" + arg);
        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        	var data="id="+arg+"&catid="+arg2;
	//var toto= "id="+arg:
	xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
//				alert(" MON ID " + xhr_object.responseText);
                                document.getElementById("MediaID").value=xhr_object.responseText;

				window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}



function onResize(){
	var w = document.body.clientWidth;
	var h = document.body.clientHeight;

	if(exist('site_bgImg')){$('site_bgImg').style.width=parseInt(w);}
	if(exist('pg') && exist('l')){$('pg').style.width=parseInt(document.body.clientWidth)-parseInt($('l').style.left)-parseInt($('l').style.width)-240;}
	if(exist('scrollContainer2') && exist('pg')){$('scrollContainer2').style.width= parseInt($('pg').style.width);}
	if(exist('bgBox')){$('bgBox').style.width=parseInt(document.body.scrollWidth);$('bgBox').style.height=parseInt(document.body.scrollHeight);}
	if(exist('bgBox_behindLogo')){$('bgBox_behindLogo').style.width=parseInt(document.body.scrollWidth);$('bgBox_behindLogo').style.height=parseInt(document.body.scrollHeight);}
	if(exist('mn')){$('mn').style.width=parseInt(w)-1270;}
	if(exist('scrollImageList')){$('scrollImageList').style.width=parseInt(w)-320;}
	initScroll('scrollContainer','scrollLeftClient');
	initScroll2('scrollContainer2','scrollImageList');
	initAutoNavigation();
}

window.onscroll=function(){}
window.onresize=function(){onResize();}

function iniDocument(){
	document.body.scrollTop=0;
	document.body.scrollLeft=0;
}
/*function checkScroll(){
  var documentScrollTop = document.body.scrollTop;
  var documentHeight = document.body.scrollHeight;
  var browserHeight = document.body.clientHeight;

  if (documentScrollTop>0)
  {
  if(!exist('scrollTopArrow')){
// CREATE scrollTopArrow DIV
var scrollTopArrow = document.createElement('div');
scrollTopArrow.setAttribute('id', 'scrollTopArrow');
scrollTopArrow.style.position ='absolute';
scrollTopArrow.style.left=10;
scrollTopArrow.innerHTML="<img src='design/images/top_arrow.gif' width='15px'>";
scrollTopArrow.style.zIndex=6;
document.body.appendChild(scrollTopArrow);
}
$('scrollTopArrow').style.top=parseInt(documentScrollTop) +20;
}
else 
{
if(exist('scrollTopArrow')){document.body.removeChild($('scrollTopArrow'));}
}

if (documentHeight>browserHeight+documentScrollTop){
if(!exist('scrollBottomArrow')){
// CREATE scrollBottomArrow DIV
var scrollBottomArrow = document.createElement('div');
scrollBottomArrow.setAttribute('id', 'scrollBottomArrow');
scrollBottomArrow.style.position ='absolute';
scrollBottomArrow.style.left=10;
scrollBottomArrow.innerHTML="<img src='design/images/bottom_arrow.gif' width='15px'>";
scrollBottomArrow.style.zIndex=6;
document.body.appendChild(scrollBottomArrow);
}
$('scrollBottomArrow').style.top=parseInt(browserHeight) + parseInt(documentScrollTop) -25;
}
else
{
if(exist('scrollBottomArrow')){document.body.removeChild($('scrollBottomArrow'));}
}
}

 */


function showHideContext(){
	select('leftMenu');
	select('mn');
	select('scrollContainer2');
	 select('before');
        select('next');
        select('beforevi');
	select('backLink');
	select('zoomLink');
	select('toto');
select('playlist');
	bgZone();
}

function showHideContext2(){
        select('leftMenu');
        select('mn');
        select('scrollContainer2');
	select('toto');
        select('beforeimcat');
  	select('Previousim');
        select('Nextim');
        select('nextimcat');
        select('beforevi');
        select('backLink2');
        select('zoomLink');
//	select('toto');
select('playlist2');
        bgZone();
}


function bgZone(){

	if(exist('bgZone')){
		window.document.body.removeChild($('bgZone'));
	}
	else {
		// CREATE PG DIV
		var bgZone = document.createElement('div');
		bgZone.setAttribute('id', 'bgZone');
		bgZone.style.position ='absolute';
		bgZone.style.top=0;
		bgZone.style.left=0;
		bgZone.style.width=document.body.scrollWidth;
		bgZone.style.height=document.body.scrollHeight;
		bgZone.style.zIndex=0;
		bgZone.onclick=function(){showHideContext();}
		document.body.appendChild(bgZone);

	}



}
function zoomImage(id){
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	iniDocument();
	initAutoNavigation();
	/*if(exist('autoMoveScrollNavigationLeft')){
	  $('autoMoveScrollNavigationLeft').style.zIndex=1000;
	  }*/
	if(!exist('zoomImage_bgBox')){
		// CREATE BOX DIV
		var zoomImage_bgBox = document.createElement('div');
		zoomImage_bgBox.setAttribute('id', 'zoomImage_bgBox');
		zoomImage_bgBox.style.position ='absolute';
		zoomImage_bgBox.style.top=0;
		zoomImage_bgBox.style.left=0;
		//zoomImage_bgBox.className='bgBoxOpacity';	
		zoomImage_bgBox.style.width=maxWidth;
		zoomImage_bgBox.style.height=maxHeight;
		zoomImage_bgBox.style.cursor='pointer';
		zoomImage_bgBox.style.background='#FFFFFF';
		zoomImage_bgBox.style.zIndex=9;
		zoomImage_bgBox.onclick=function(){closeZoomImage();}
		document.body.appendChild(zoomImage_bgBox);
	}
	if(!exist('zoomImage_box')){
		// CREATE BOX DIV
		var zoomImage_box = document.createElement('div');
		zoomImage_box.setAttribute('id', 'zoomImage_box');
		zoomImage_box.style.position ='absolute';
		zoomImage_box.style.top=0;
		zoomImage_box.style.left=0;//225
		zoomImage_box.style.zIndex=10;
		zoomImage_box.style.padding=0;
		zoomImage_box.style.background='#FFFFFF';
		document.body.appendChild(zoomImage_box);
	}

	content_arg($('zoomImage_box'),'zimage','id='+id,'','');
}

function beforeimage(id){
	image_arg('intermediateImg','test','id='+id,'','');
	Idimage_arg('MediaID','test2','id='+id,'','');
}

function nextImage(id){
	image_arg('intermediateImg','nextim','id='+id,'','');
        Idimage_arg('MediaID','nextid','id='+id,'','');
}

function nextImageCat(id, catid){
	imagecat_arg('intermediateImg','nextimcat',id,catid,'','');
       Idimagecat_arg('MediaID','nextidcat',id,catid,'','');
} 

function beforeimageCat(id, catid){
	imagecat_arg('intermediateImg','previousimcat',id,catid,'','');
	Idimagecat_arg('MediaID','previousidcat',id,catid,'','');
}


function changecat(out,p,arg,whatIfOk,whatIfKo){
	 var xhr_object = xhr();
        if(xhr_object ==null){return;}
        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        	var data=arg;
	//var toto= "id=arg:
	xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
				//alert("Je vaux maintenant" + xhr_object.responseText);
                                document.getElementById("catalogueID").value=xhr_object.responseText;
				window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}

function Idvideo_arg(out,p,arg,whatIfOk,whatIfKo)
{
         var xhr_object = xhr();
        if(xhr_object ==null){return;}

        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        var data=arg;
	var source = "bo/ressources/videos/";
        xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
                                //enlever pour l'alerte
                     //          alert("Je vaux maintenant" + xhr_object.responseText);
				var sourcefile = source + xhr_object.responseText;
				$(out).src = sourcefile;
				document.getElementById("MediaFile").value=xhr_object.responseText;
				//alert("voici ma source" + $(out).src );
				//document.getElementByID("film2").innerHTML = "<embed id='film2' src='".$sourcefile."' menu='false' quality='high' scale='exactfit' bgcolor='#000' width='$w' height='$h' name='video' align='middle' play='true' loop='false' quality='high' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
                                window.status = "";

                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}



function replayvideo(id){
Idvideo_arg('film2','replayvid','id='+id,'','');
}

function beforevideo(id){
Idvideo_arg('film2','beforevid','id='+id,'','');
}

function nextvideo(id){
Idvideo_arg('film2','nextvid','id='+id,'','');
}

function Idimagecatfirst_arg(out,p,arg,arg2,whatIfOk,whatIfKo){
	 var xhr_object = xhr();
        if(xhr_object ==null){return;}
        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
        	var data="id="+arg+"&catid="+arg2;
	xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
                                //enlever pour l'alerte
//				alert(" MON ID " + xhr_object.responseText);
                                document.getElementById("MediaID").value=xhr_object.responseText;
				window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}



function imagecatfirst_arg(out,p,arg,arg2,whatIfOk,whatIfKo){
        var xhr_object = xhr();
        if(xhr_object ==null){return;}

//	alert("je suis argument2" + arg2);
        var pg = "content/ct_" + p + ".php";
        var method="POST";
        var asynchrone=true;
	var data="id="+arg+"&catid="+arg2;
        xhr_object.open(method, pg , asynchrone);
        xhr_object.onreadystatechange = function() {
                switch (xhr_object.readyState){
                        case 0 : window.status = "loading";break;
                        case 1 : window.status = "loading.";break;
                        case 2 : window.status = "loading..";break;
                        case 3 : window.status = "loading...";break;
                        case 4 :
				//enlever pour l'alerte
//                          alert(" image cat " + xhr_object.responseText);
				$(out).src=xhr_object.responseText;
				 window.status = "";
                        default: break;
                }
        }
        xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
        xhr_object.send(data);
}





function Nextcat(id, imid){
	imid++;
	changecat('pg', 'nextcat', 'id='+imid,'','');
	imagecatfirst_arg('intermediateImg','imcatfirst',id,imid,'','');
       Idimagecatfirst_arg('MediaID','nextidcatfirst',id,imid,'','');


}

function Previouscat(id, imid){
	imid--;
//	alert(imid);
	changecat('pg', 'previouscat', 'id='+imid,'','');
imagecatfirst_arg('intermediateImg','previousimcat',id,imid,'','');
       Idimagecatfirst_arg('MediaID','previousidcatfirst',id,imid,'','');
}

function zoomVideo(id){
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	document.body.scrollTop=0;
	document.body.scrollLeft=0;
	initAutoNavigation();

	if(!exist('zoomVideo_bgBox')){
		// CREATE BOX DIV
		var zoomVideo_bgBox = document.createElement('div');
		zoomVideo_bgBox.setAttribute('id', 'zoomVideo_bgBox');
		zoomVideo_bgBox.style.position ='absolute';
		zoomVideo_bgBox.style.top=0;
		zoomVideo_bgBox.style.left=0;
		//zoomVideo_bgBox.className='bgBoxOpacity';	
		zoomVideo_bgBox.style.width=maxWidth;
		zoomVideo_bgBox.style.height=maxHeight;
		zoomVideo_bgBox.style.cursor='pointer';
		zoomVideo_bgBox.style.background='#000000';
		zoomVideo_bgBox.style.zIndex=9;
		zoomVideo_bgBox.onclick=function(){closeZoomVideo();}
		document.body.appendChild(zoomVideo_bgBox);
	}
	if(!exist('zoomVideo_box')){
		// CREATE BOX DIV
		var zoomVideo_box = document.createElement('div');
		zoomVideo_box.setAttribute('id', 'zoomVideo_box');
		zoomVideo_box.style.position ='absolute';
		zoomVideo_box.style.top=0;
		zoomVideo_box.style.left=0;//225
		zoomVideo_box.style.zIndex=10;//10
		zoomVideo_box.style.padding=0;
		zoomVideo_box.style.background='#000000';
		document.body.appendChild(zoomVideo_box);
	}

	content_arg($('zoomVideo_box'),'zfilm','id='+id,'','');
}









//
// MESSAGE BOX
//
function iniOpenBox(){
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;
	if(exist('bgBox_behindLogo')){
		$('bgBox_behindLogo').style.width = maxWidth;
		$('bgBox_behindLogo').style.width = maxHeight;
	}
	if(exist('bgBox')){
		$('bgBox').style.width = maxWidth;
		$('bgBox').style.width = maxHeight;
	}
	if(exist('box')){
		$('box').style.width = maxWidth;
		$('box').style.width = maxHeight;
	}
}
function openBox(ct,bgColor,frontColor,arg){
	iniDocument();
	initAutoNavigation();
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	if(!exist('bgBox_behindLogo')){
		// CREATE BOX DIV BEHIND LOGO
		var bgBox_behindLogo = document.createElement('div');
		bgBox_behindLogo.setAttribute('id', 'bgBox_behindLogo');
		bgBox_behindLogo.style.position ='absolute';
		bgBox_behindLogo.style.top=0;
		bgBox_behindLogo.style.left=0;
		//bgBox_behindLogo.className='bgBoxOpacity';	
		bgBox_behindLogo.style.width=maxWidth;
		bgBox_behindLogo.style.height=maxHeight;
		bgBox_behindLogo.style.background=bgColor;
		bgBox_behindLogo.style.zIndex=7;//7
		bgBox_behindLogo.onclick=function(){closeBox();}
		document.body.appendChild(bgBox_behindLogo);
	}

	if(!exist('bgBox')){
		// CREATE BOX DIV
		var bgBox = document.createElement('div');
		bgBox.setAttribute('id', 'bgBox');
		bgBox.style.position ='absolute';
		bgBox.style.top=0;
		bgBox.style.left=0;
		//bgBox.className='bgBoxOpacity';	
		bgBox.style.width=maxWidth;
		bgBox.style.height=maxHeight;
		bgBox.style.cursor='pointer';
		bgBox.style.background=bgColor;
		bgBox.style.zIndex=9;
		bgBox.onclick=function(){closeBox();}
		document.body.appendChild(bgBox);
	}
	if(!exist('box')){
		// CREATE BOX DIV
		var box = document.createElement('div');
		box.setAttribute('id', 'box');
		box.style.position ='absolute';
		box.style.top=85;
		box.style.left=255;//225
		box.style.zIndex=10;//10
		box.style.padding=25;
		box.style.background=frontColor;
		document.body.appendChild(box);
	}

	content_arg($('box'),ct,arg,'','');
	//fadeInBox();
	//ok();
}


function autoMoveScrollNavigation(){

	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;
	if(!exist('autoMoveScrollNavigationTop')){
		// CREATE BOX DIV
		var autoMoveScrollNavigationTop = document.createElement('div');
		autoMoveScrollNavigationTop.setAttribute('id', 'autoMoveScrollNavigationTop');
		autoMoveScrollNavigationTop.style.position ='absolute';
		autoMoveScrollNavigationTop.style.top=0;
		autoMoveScrollNavigationTop.style.left=0;
		//bgBox.className='bgBoxOpacity';	
		autoMoveScrollNavigationTop.style.width=w;
		autoMoveScrollNavigationTop.style.height=20;
		autoMoveScrollNavigationTop.style.cursor='pointer';
		autoMoveScrollNavigationTop.style.background='white';
		autoMoveScrollNavigationTop.style.zIndex=1000;
		autoMoveScrollNavigationTop.onmousemove=function(){scrollingDocumentTop(15);}
		autoMoveScrollNavigationTop.onclick=function(){scrollingDocumentTop(15);}
		autoMoveScrollNavigationTop.onmouseout=function(){stopScroll(timerDoc_id);}
		autoMoveScrollNavigationTop.ondblclick=function(){window.status='alltop';}
		document.body.appendChild(autoMoveScrollNavigationTop);
	}

	if(!exist('autoMoveScrollNavigationBottom')){
		// CREATE BOX DIV
		var autoMoveScrollNavigationBottom = document.createElement('div');
		autoMoveScrollNavigationBottom.setAttribute('id', 'autoMoveScrollNavigationBottom');
		autoMoveScrollNavigationBottom.style.position ='absolute';
		autoMoveScrollNavigationBottom.style.bottom=0;
		autoMoveScrollNavigationBottom.style.left=0;
		//bgBox.className='bgBoxOpacity';	
		autoMoveScrollNavigationBottom.style.width=w;
		autoMoveScrollNavigationBottom.style.height=25;
		autoMoveScrollNavigationBottom.style.cursor='pointer';
		autoMoveScrollNavigationBottom.style.background='white';
		autoMoveScrollNavigationBottom.style.zIndex=1000;
		autoMoveScrollNavigationBottom.onmousemove=function(){scrollingDocumentBottom(15);}
		autoMoveScrollNavigationBottom.onclick=function(){scrollingDocumentBottom(15);}
		autoMoveScrollNavigationBottom.onmouseout=function(){stopScroll(timerDoc_id);}
		autoMoveScrollNavigationBottom.ondblclick=function(){window.status='allbottom';}

		document.body.appendChild(autoMoveScrollNavigationBottom);
	}
	if(!exist('autoMoveScrollNavigationLeft')){
		// CREATE BOX DIV
		var autoMoveScrollNavigationLeft = document.createElement('div');
		autoMoveScrollNavigationLeft.setAttribute('id', 'autoMoveScrollNavigationLeft');
		autoMoveScrollNavigationLeft.style.position ='absolute';
		autoMoveScrollNavigationLeft.style.top=0;
		autoMoveScrollNavigationLeft.style.left=0;
		autoMoveScrollNavigationLeft.style.width=10;
		autoMoveScrollNavigationLeft.style.height=h;
		autoMoveScrollNavigationLeft.style.cursor='pointer';
		autoMoveScrollNavigationLeft.style.background='white';
		autoMoveScrollNavigationLeft.style.zIndex=1000;
		autoMoveScrollNavigationLeft.onmousemove=function(){scrollingDocumentLeft(15);}
		autoMoveScrollNavigationLeft.onclick=function(){scrollingDocumentLeft(15);}
		autoMoveScrollNavigationLeft.onmouseout=function(){stopScroll(timerDoc_id);}
		autoMoveScrollNavigationLeft.ondblclick=function(){window.status='allleft';}

		document.body.appendChild(autoMoveScrollNavigationLeft);
	}
	if(!exist('autoMoveScrollNavigationRight')){

		// CREATE BOX DIV
		var autoMoveScrollNavigationRight = document.createElement('div');
		autoMoveScrollNavigationRight.setAttribute('id', 'autoMoveScrollNavigationRight');
		autoMoveScrollNavigationRight.style.position ='absolute';
		autoMoveScrollNavigationRight.style.top=0;
		autoMoveScrollNavigationRight.style.right=0;
		autoMoveScrollNavigationRight.style.width=25;
		autoMoveScrollNavigationRight.style.height=h;
		autoMoveScrollNavigationRight.style.cursor='pointer';
		autoMoveScrollNavigationRight.style.background='white';
		autoMoveScrollNavigationRight.style.zIndex=1000;
		autoMoveScrollNavigationRight.onmousemove=function(){scrollingDocumentRight(15);}
		autoMoveScrollNavigationRight.onclick=function(){scrollingDocumentRight(15);}
		autoMoveScrollNavigationRight.onmouseout=function(){stopScroll(timerDoc_id);}
		autoMoveScrollNavigationRight.ondblclick=function(){window.status='allright';}

		document.body.appendChild(autoMoveScrollNavigationRight);
	}
	if(exist('bak')){$('bak').style.top=100;$('bak').style.left=parseInt(document.body.scrollLeft) + 10;}
	// hide sensible zone
	setOpacity('autoMoveScrollNavigationTop',0);
	setOpacity('autoMoveScrollNavigationRight',0);
	setOpacity('autoMoveScrollNavigationBottom',0);
	setOpacity('autoMoveScrollNavigationLeft',0);
}

var timerDoc_id;
function scrollingDocumentRight(length){

	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	//stopScroll(timerDoc_id);

	if(length>0){
		if(parseInt(maxWidth)<=w){document.body.style.scrollLeft=maxWidth;}
		else {
			document.body.scrollLeft=parseInt(document.body.scrollLeft)+length;
			length=length-1;
			initAutoNavigation();
			timerDoc_id = setTimeout("scrollingDocumentRight("+length+")", 15);
		}
	}
	else {
		stopScroll(timerDoc_id);
	}
}

function scrollingDocumentLeft(length){

	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	//stopScroll(timerDoc_id);
	if(length>0){
		if(parseInt(maxWidth)<=w){document.body.style.scrollLeft=maxWidth;}
		else {
			document.body.scrollLeft=parseInt(document.body.scrollLeft)-length;
			length=length-1;
			initAutoNavigation();
			timerDoc_id = setTimeout("scrollingDocumentLeft("+length+")", 15);
		}
	}
	else {
		stopScroll(timerDoc_id);
	}

}
function scrollingDocumentTop(length){

	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	//stopScroll(timerDoc_id);
	if(length>0){
		if(parseInt(maxHeight)<=h){document.body.style.scrollTop=maxHeight;}
		else {
			document.body.scrollTop=parseInt(document.body.scrollTop)-length;
			length=length-1;
			initAutoNavigation();
			timerDoc_id = setTimeout("scrollingDocumentTop("+length+")", 15);
		}
	}
	else {
		stopScroll(timerDoc_id);
	}

}
function scrollingDocumentBottom(length){

	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;

	//stopScroll(timerDoc_id);
	if(length>0){
		if(parseInt(maxHeight)<=h){document.body.style.scrollTop=maxHeight;}
		else {
			document.body.scrollTop=parseInt(document.body.scrollTop)+length;
			length=length-1;
			initAutoNavigation();
			timerDoc_id = setTimeout("scrollingDocumentBottom("+length+")", 15);
		}
	}
	else {
		stopScroll(timerDoc_id);
	}
}


function initAutoNavigation(){
	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var maxWidth =document.body.scrollWidth;
	var maxHeight =document.body.scrollHeight;
	var positionLeft =document.body.scrollLeft;
	var positionTop =document.body.scrollTop;


	if(exist('autoMoveScrollNavigationTop')){
		$('autoMoveScrollNavigationTop').style.width=w;
		$('autoMoveScrollNavigationTop').style.top=positionTop;	
		$('autoMoveScrollNavigationTop').style.left=positionLeft;
	}
	if(exist('autoMoveScrollNavigationRight')){
		$('autoMoveScrollNavigationRight').style.height=h;
		$('autoMoveScrollNavigationRight').style.top=positionTop;	
		$('autoMoveScrollNavigationRight').style.left=w+positionLeft-parseInt($('autoMoveScrollNavigationRight').style.width);
	}
	if(exist('autoMoveScrollNavigationBottom')){
		$('autoMoveScrollNavigationBottom').style.width=w;
		$('autoMoveScrollNavigationBottom').style.top=h+positionTop-parseInt($('autoMoveScrollNavigationBottom').style.height);
		$('autoMoveScrollNavigationBottom').style.left=positionLeft;	
	}
	if(exist('autoMoveScrollNavigationLeft')){
		$('autoMoveScrollNavigationLeft').style.height=h;
		$('autoMoveScrollNavigationLeft').style.top=positionTop;	
		$('autoMoveScrollNavigationLeft').style.left=positionLeft;	
	}

}


function closeZoomImage(){
	if(exist('zoomImage_box')){window.document.body.removeChild($('zoomImage_box'));}
	if(exist('zoomImage_bgBox')){window.document.body.removeChild($('zoomImage_bgBox'));}
	if(exist('zoomImage_bgBox_behindLogo')){window.document.body.removeChild($('zoomImage_bgBox_behindLogo'));}
	if(exist('zoomImage_backBox')){window.document.body.removeChild($('zoomImage_backBox'));}
	if(exist('zoomImage_Box')){window.document.body.removeChild($('zoomImage_Box'));}
	if(exist('logoImg')){$('logoImg').src='design/images/air_logo.gif';}
	iniDocument();
}


function closeBox(){
	if(exist('box')){window.document.body.removeChild($('box'));}
	if(exist('bgBox')){window.document.body.removeChild($('bgBox'));}
	if(exist('bgBox_behindLogo')){window.document.body.removeChild($('bgBox_behindLogo'));}
	if(exist('backBox')){window.document.body.removeChild($('backBox'));}
	if(exist('zoomBox')){window.document.body.removeChild($('zoomBox'));}
	if(exist('logoImg')){$('logoImg').src='design/images/air_logo.gif';}
	document.body.style.backgroundColor='#FFFFFF';
}

function closeMediaBox(){
	closeBox();
	iniDocument();
}


//
// thumb opacity
//
function mouseOverThumb(id,total) {
	$('thumb'+id).className = 'mouseOverThumb';
	for (i=0;i<total;i++){
		if (i!=id){mouseOutThumb(i)}
	}
}
function mouseOutThumb(id) {
	$('thumb'+id).className = 'mouseOutThumb';
}

//
// FORMULAIRE
//
function frmOnFocus(field,type){
	switch(type){
		case "text" : field.className='textFocus';break;
		case "textarea" : field.className='textareaFocus';break;
		case "select" : field.className='selectFocus';break;
	}
}

function frmOnBlur(field,type){
	switch(type){
		case "text" : field.className='textBlur';break;
		case "textarea" : field.className='textareaBlur';break;
		case "select" : field.className='selectBlur';break;
	}

}

//
// PAGE
//
function links(){openBox('link','#000000','','');}
function contact(){
	//openBox('contact','#FFFFFF','','');
	showHideContext();
	content_arg($('pg'),'contact','');
}
function contactSent(){openBox('contact_sent_feedback','#FFFFFF','','');}
function talent(){openBox('talent','talent','');}
function info(){openBox('info','#000000','','');}

function displayImageList(out,NodeID){
//	alert(NodeID);
	content_arg($(out),'imageList','NodeID='+NodeID,'','');
	hideScroll2();
	onResize();
}
function displayImageListRight(out,NodeID){content_arg($(out),'imageListRight','NodeID='+NodeID,'','');}
function displayMediaInfo(out,id){content_arg($(out),'mediaInfo','id='+id,'','');}
function displayMediaInfoRight(out,id){content_arg($(out),'mediaInfoRight','id='+id,'','');}
function displayVideo(id){displayMedia('displayMedia',id);}
function displayImage(id){displayMedia('displayMedia',id);}

//
// FULLSCREEN
//
function fullscreen(){
	window.moveTo(10,10);
	if (document.getElementById || document.all) 
	{
		window.resizeTo(screen.availWidth, screen.availHeight);
	}
	else if (document.layers)
	{
		if (window.outerHeight<screen.availHeight || window.outerWidth<screen.availWidth)
		{
			window.outerHeight = screen.availHeight;
			window.outerWidth = screen.availWidth;
		}
	}
}



// DETECTION DU NAVIGATEUR
function isBrowser(nav){
	agent = navigator.userAgent.toLowerCase();
	var mac = (agent.indexOf("macintosh") != -1);
	var safari = (agent.indexOf("safari") != -1);
	var ie = 
		(
		 (agent.indexOf("msie") != -1) &&
		 (agent.indexOf("opera") == -1)
		);
	var ff=(agent.indexOf("firefox") != -1);
	var ns = 
		(
		 (agent.indexOf("mozilla") != -1) && 
		 (agent.indexOf("spoofer") == -1) &&
		 (agent.indexOf("compatible") == -1) &&
		 (agent.indexOf("opera") == -1) &&
		 (agent.indexOf("webtv") == -1) &&
		 (agent.indexOf("hotjava") == -1)
		);
	var opera = 
		(
		 (window.opera == 1) || 
		 (agent.indexOf('opera') != -1)
		);

	switch(nav){
		case 'ie' : return ie;
		case 'ff' : return ff;
		case 'safari' : return safari;
		case 'mac' : return mac;
		case 'opera' : return opera;
		case 'ms' : return ns;
		default : return false;
	}
}


// SHOW / HIDE MENU
function show(id) 
{
	$(id).style.visibility='visible';
	$(id).style.display='block';
}
function hide(id) 
{
	$(id).style.visibility='hidden';
	$(id).style.display='none';
}
function showPlusMinus(id) 
{
	$(id).style.visibility='visible';
	$(id).style.display='inline';
}
function hidePlusMinus(id) 
{
	$(id).style.visibility='hidden';
	$(id).style.display='none';
}

function removeDom(id_content, id_todel){
	id_content.removeChild(id_todel);
}

function showMedium(MediumID) 
{
	$('medium'+MediumID).style.visibility='visible';
	$('medium'+MediumID).style.display='inline';
}
function show_hide_Medium(MediumID){
	if ($('plus'+MediumID).innerHTML=='+'){$('plus'+MediumID).innerHTML='-';showMedium(MediumID);}
	else{$('plus'+MediumID).innerHTML='+';hideMedium(MediumID);}
}

function hideMedium(MediumID) 
{
	$('medium'+MediumID).style.visibility='hidden';
	$('medium'+MediumID).style.display='none';
}

function show_hide(id) 
{
	if($(id).style.visibility=='visible'){
		$(id).style.visibility='hidden';
		$(id).style.display='none';
	}
	else {
		$(id).style.visibility='visible';
		$(id).style.display='block';
	}
}

function checkField(out,type,value, defaultValue){
	var xhr_object = xhr();
	if(xhr_object ==null){return;}
	var pg = "functions/php/checkField_process.php";
	var method="POST";
	var asynchrone=true;
	var data="type="+type+"&value="+value+"&defaultValue="+defaultValue;
	xhr_object.open(method, pg , asynchrone);
	xhr_object.onreadystatechange = function() {   
		if(xhr_object.readyState ==4){
			var color =xhr_object.responseText;
			$(out).style.color = color;
			evalJS($(out));
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded;");
	xhr_object.send(data);
}


// INTRO
var fadingTimer;

function goHome(){document.location='go.php';}
function goIntro(){document.location='./';}



function fadeInIntro(){fade('introImg',0,2,'');}
function fadeDiap(){fade('diap',-20,2,'');}
function defadeDiap(){fade('diap',100,-10,'');}
function fadeOutIntro(){fade('introImg',100,-10,'goHome();');}
function fadeInBox(){
	fade('bgBox_behindLogo',0,30,'');
	fade('bgBox',0,10,'');
	fade('box',0,10,'');
}
function fadeOutBox(){
	fade('bgBox_behindLogo',100,-30,'');
	fade('bgBox',100,-10,'');
	fade('box',100,-10,'ok();');
}

function ok(){
	if(exist('box')){window.document.body.removeChild($('box'));}
	if(exist('bgBox')){window.document.body.removeChild($('bgBox'));}
	if(exist('bgBox_behindLogo')){window.document.body.removeChild($('bgBox_behindLogo'));}
	if(exist('backBox')){window.document.body.removeChild($('backBox'));}
	if(exist('zoomBox')){window.document.body.removeChild($('zoomBox'));}
	if(exist('logoImg')){$('logoImg').src='design/images/air_logo.gif';}
}
function fadeInIntermediate(){fade('imgInformation',0,33,'');}
function fadeOutIntermediate(whatIfOk){fade('imgInformation',100,-33,whatIfOk);}
function fadeInThumb(id){fade('thumb'+id,0,5,'');}

function fade(o,opacity,speed,whatIfOk) {
	if (exist(o)) {
		if (Math.abs(opacity) <= 100) {
			$(o).style.visibility='visible';
			if (!isBrowser('opera')){setOpacity(o,opacity);}else {eval(whatIfOk);}
			opacity+=speed;
			o_fadingTimer = window.setTimeout('fade("'+o+'",'+opacity+','+speed+',"'+whatIfOk+'")');
		}
		else {eval(whatIfOk);}
	}
}
function setOpacity(o,opacity) {
	if(exist(o)){
		opacity = parseInt(opacity);
		if (isBrowser('ie')){$(o).style.filter = "alpha(opacity:"+opacity+")";}  // IE/Win
		else if (isBrowser('opera')){$(o).visibility='visible';} // opera
		else {$(o).style.opacity = opacity/100;} // Safari 1.2, newer Firefox and Mozilla, CSS3
	}

}

function fadeLogo() {fade('logo',0,5,'');}
function stopTimer(timer) {if (timer){clearTimeout(timer);}}

//SCROLL

function addScroll(out,o){

	var scrollTopPosition = document.createElement('input');
	scrollTopPosition.setAttribute('id','scrollTopPosition');
	scrollTopPosition.setAttribute('type','hidden');
	scrollTopPosition.value=0;
	$(out).appendChild(scrollTopPosition);

	var isLeftScrollMouseOver = document.createElement('input');
	isLeftScrollMouseOver.setAttribute('id','isLeftScrollMouseOver');
	isLeftScrollMouseOver.setAttribute('type','hidden');
	isLeftScrollMouseOver.value=0;
	$(out).appendChild(isLeftScrollMouseOver);


	var isDragStart = document.createElement('input');
	isDragStart.setAttribute('id','isDragStart');
	isDragStart.setAttribute('type','hidden');
	isDragStart.value=0;
	$(out).appendChild(isDragStart);



	var scroll_up = document.createElement('div');
	scroll_up.setAttribute('id', 'scroll_up');
	scroll_up.onclick=function(){scrollingUp(o,20);}	
	scroll_up.ondblclick=function(){scrollingAllUp(o,20);}	
	$(out).appendChild(scroll_up);
	$('scroll_up').innerHTML="<img src='design/images/top_arrow.gif' style='width:15px;'>";

	var scroll = document.createElement('div');
	scroll.setAttribute('id', 'scroll');
	scroll.onmousedown= function(){$('isDragStart').value='1';}
	$(out).appendChild(scroll);
	document.onmouseup= function(){$('isDragStart').value='0';}

	var scroll_cursor_before = document.createElement('div');
	scroll_cursor_before.setAttribute('id', 'scroll_cursor_before');
	scroll_cursor_before.onclick=function(){scrollingUp(o,20);}	
	$('scroll').appendChild(scroll_cursor_before);

	var scroll_cursor_back = document.createElement('div');
	scroll_cursor_back.setAttribute('id', 'scroll_cursor_back');
	scroll_cursor_back.onmousedown=function(){$('isDragStart').value='1';stopScroll(timer_id);}	
	scroll_cursor_back.onmouseup=function(){$('isDragStart').value='0';}	

	$('scroll').appendChild(scroll_cursor_back);

	var scroll_cursor = document.createElement('div');
	scroll_cursor.setAttribute('id', 'scroll_cursor');
	scroll_cursor.onmousedown=function(){$('isDragStart').value='1';stopScroll(timer_id);}	
	scroll_cursor.onmouseup=function(){$('isDragStart').value='0';}	

	$('scroll').appendChild(scroll_cursor);

	var scroll_cursor_after = document.createElement('div');
	scroll_cursor_after.setAttribute('id', 'scroll_cursor_after');
	scroll_cursor_after.onclick=function(){scrollingDown(o,20);}	
	$('scroll').appendChild(scroll_cursor_after);

	var scroll_down = document.createElement('div');
	scroll_down.setAttribute('id', 'scroll_down');
	scroll_down.onclick=function(){scrollingDown(o,20);}	
	scroll_down.ondblclick=function(){scrollingAllDown(o,20);}	
	$(out).appendChild(scroll_down);
	$('scroll_down').innerHTML="<img src='design/images/bottom_arrow.gif' style='width:15px;'>";
	//window.status = $('scroll').style.height;
	hideScroll2();
	initScroll(out,o);
}


var timer_id;

function initScroll(out,o)
{
	var h = parseInt(document.body.clientHeight);
	var largeurScroll=15;
	//hideScroll();
	//var divScrollHeight=parseInt(document.body.clientHeight)-173;
	//	var divScrollHeight=parseInt(document.body.clientHeight)-123;
	//var divScrollHeight=parseInt(document.body.clientHeight)-170;
	var divScrollHeight=parseInt(document.body.clientHeight)-120;
	//var divScrollHeight=parseInt(document.body.clientHeight)-370;
	//	if(exist('brand')){$('brand').style.top=parseInt(document.body.clientHeight)-340};

	if(exist(out)){
		$(out).style.position='absolute';	
		$(out).style.top=40;
		$(out).style.left=-20;		
		$(out).style.height=divScrollHeight;
		$(out).style.width=largeurScroll;
		$(out).style.zIndex=0;	
	}

	if(exist('scroll_up')){
		$('scroll_up').style.position='absolute';	
		$('scroll_up').style.top=0;	
		$('scroll_up').style.left=0;	
		$('scroll_up').style.height=8;
		$('scroll_up').style.width=largeurScroll;
		$('scroll_up').style.zIndex=2;
	}
	if(exist('scroll_down')){
		$('scroll_down').style.position='absolute';	
		$('scroll_down').style.left=0;
		$('scroll_down').style.height=8;
		$('scroll_down').style.width=largeurScroll;
		$('scroll_down').style.zIndex=3;
	}
	if(exist('scroll')){
		$('scroll').style.position='absolute';
		$('scroll').style.left=0;
		$('scroll').style.top=parseInt($('scroll_up').style.top)+parseInt($('scroll_up').style.height);
		$('scroll').style.height=parseInt($('scrollContainer').style.height) - parseInt($('scroll_up').style.height) - parseInt($('scroll_down').style.height);
		$coef = parseInt($('scroll').style.height) / parseInt($(o).scrollHeight);
		$('scroll').style.width=largeurScroll;
		$('scroll').style.zIndex=1;
	}
	if(exist('scroll_down')){
		$('scroll_down').style.top=parseInt($('scroll').style.top) + parseInt($('scroll').style.height)-4;
	}
	if(exist(o)){
		$(o).style.position='absolute';
		// 16/11/2008
		//$(o).style.left=20;
		$(o).style.left=25;
		//$(o).style.top=$('scroll').style.top;
		$(o).style.top=parseInt($('scroll').style.top)-10+"px";
		//$(o).style.height=$('scroll').style.height;
		$(o).style.height=parseInt($('scroll').style.height)+17+"px";
	}
	if(exist('scroll_cursor_back')){
		$('scroll_cursor_back').style.position='absolute';	
		$('scroll_cursor_back').style.top=0;
		$('scroll_cursor_back').style.height=parseInt($(o).style.height)*$coef;
		$('scroll_cursor_back').style.left=0;
		$('scroll_cursor_back').style.zIndex=5;
	}
	if(exist('scroll_cursor')){
		$('scroll_cursor').style.position='absolute';	
		if(exist('scrollTopPosition')){
			$('scroll_cursor').style.top=$('scrollTopPosition').value;
		}
		else{ 
			$('scroll_cursor').style.top=0;
		}
		$('scroll_cursor').style.width=largeurScroll;
		$('scroll_cursor').style.height=parseInt($(o).style.height)*$coef;
		$('scroll_cursor').style.left=0;
		$('scroll_cursor').style.zIndex=5;
	}
	if(exist('scroll_cursor_after')){
		$('scroll_cursor_after').style.position='absolute';
		$('scroll_cursor_after').style.top=parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height);
		$('scroll_cursor_after').style.left=0;
		$('scroll_cursor_after').style.zIndex=6;
	}
	if(exist('scroll_cursor_before')){
		$('scroll_cursor_before').style.position='absolute';
		$('scroll_cursor_before').style.zIndex=4;
		$('scroll_cursor_before').style.top=0;
		$('scroll_cursor_before').style.left=0;
		$('scroll_cursor_before').style.height=parseInt($('scroll_cursor').style.top);
	}

	updateScrollCursorSize(o);
}
/*function scrollDown(o){
//$(o).scrollTop=$(o).scrollHeight;
$(o).scrollTop=$(o).scrollTop+8;
}
function scrollUp(o){
//$(o).scrollTop=0;
$(o).scrollTop=$(o).scrollTop-8;
}
 */


function updateScrollCursorSize(o){
	if(exist('scroll_cursor_after')){
		$('scroll_cursor_after').style.top=parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height);
		$('scroll_cursor_after').style.height=parseInt($('scroll').style.height)-parseInt($('scroll_cursor').style.top)-parseInt($('scroll_cursor').style.height);	
	}

	if(exist('scroll_cursor_before')){
		$('scroll_cursor_before').style.top=0;
		$('scroll_cursor_before').style.height=parseInt($('scroll_cursor').style.top);
	}
	if(exist('scroll_cursor_back')){
		$('scroll_cursor_back').style.top=parseInt($('scroll_cursor').style.top);
	}
	/*	hideScroll();
		if(exist(o)){


		if(parseInt($(o).scrollHeight) > parseInt($(o).style.height))
		{
	//hideScroll();
	//}
	//else {

	showScroll();
	}

	}
	 */

	if(exist(o)){
		if(parseInt($(o).scrollHeight) <= parseInt($(o).style.height)){
			hideScroll();
		}
		else {
			showScroll();
		}
	}


}

function stopScroll(TimerID) { if (TimerID) clearTimeout(TimerID); }
function scrollingDown(o,length){
	//stopScroll(timer_id);
	if(length>0){
		if(parseInt($(o).scrollTop)>=parseInt($(o).style.scrollHeight)-parseInt($('scroll_cursor').style.height)){
			length=0;stopScroll(timer_id);}
		else {
			$(o).scrollTop=parseInt($(o).scrollTop)+length;
			length=length-1;
			$('scrollTopPosition').value=parseInt($('scroll_cursor').style.top);
			//window.status = $('scrollTopPosition').value;
			coef = parseInt($('scroll').style.height) / parseInt($(o).scrollHeight);
			$('scroll_cursor').style.top=parseInt($(o).scrollTop)*coef;


			timer_id = setTimeout("scrollingDown('" + o + "',"+length+")", 30);
		}
		updateScrollCursorSize(o);
	}
	else {stopScroll(timer_id);}
}

function scrollingUp(o,length){
	//stopScroll(timer_id);
	if(length>0){
		if(parseInt($(o).scrollTop)<=0){$(o).scrollTop=0;stopScroll(timer_id);}
		else {
			$(o).scrollTop=parseInt($(o).scrollTop)-length;
			length=length-1;
			$('scrollTopPosition').value=parseInt($('scroll_cursor').style.top);
			//window.status = $('scrollTopPosition').value;
			coef = parseInt($('scroll').style.height) / parseInt($(o).scrollHeight);
			$('scroll_cursor').style.top=$(o).scrollTop*coef;

			timer_id = setTimeout("scrollingUp('" + o + "',"+length+")", 30);
		}
		updateScrollCursorSize(o);
	}
	else {stopScroll(timer_id);}
}

function scrollingAllDown(o){
	//stopScroll(timer_id);
	//if(parseInt($(o).scrollTop)+parseInt($('scroll_cursor').style.height)<=parseInt($('scroll').style.height)){
	if(parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height)<=parseInt($('scroll').style.height)){
		$(o).scrollTop=parseInt($(o).scrollTop)+20;
		$('scrollTopPosition').value=parseInt($('scroll_cursor').style.top);	
		coef = parseInt($('scroll').style.height) / parseInt($(o).scrollHeight);
		$('scroll_cursor').style.top=parseInt($(o).scrollTop)*coef;
		updateScrollCursorSize(o);		
		timer_id = setTimeout("scrollingAllDown('" + o + "')", 30);
	}
	else {stopScroll(timer_id);}
}

function scrollingAllUp(o){
	//stopScroll(timer_id);
	if(parseInt($(o).scrollTop)>0){
		$(o).scrollTop=parseInt($(o).scrollTop)-20;
		$('scrollTopPosition').value=parseInt($('scroll_cursor').style.top);
		coef = parseInt($('scroll').style.height) / parseInt($(o).scrollHeight);
		$('scroll_cursor').style.top=parseInt($(o).scrollTop)*coef;
		updateScrollCursorSize(o);
		timer_id = setTimeout("scrollingAllUp('" + o + "')", 30);
	}
	else {stopScroll(timer_id);}
}



function hideScroll(){
	if(exist('scroll_up')){$('scroll_up').style.display='none';}
	if(exist('scroll')){$('scroll').style.display='none';}
	if(exist('scroll_cursor_before')){$('scroll_cursor_before').style.display='none';}
	if(exist('scroll_cursor_back')){$('scroll_cursor_back').style.display='none';}
	if(exist('scroll_cursor_after')){$('scroll_cursor_after').style.display='none';}
	if(exist('scroll_down')){$('scroll_down').style.display='none';}
	if(exist('scroll_cursor')){$('scroll_cursor').style.display='none';}
}
function showScroll(){
	if(exist('scroll_up')){$('scroll_up').style.display='block';}
	if(exist('scroll')){$('scroll').style.display='block';}
	if(exist('scroll_cursor_before')){$('scroll_cursor_before').style.display='block';}
	if(exist('scroll_cursor_back')){$('scroll_cursor_back').style.display='block';}
	if(exist('scroll_cursor_after')){$('scroll_cursor_after').style.display='block';}
	if(exist('scroll_down')){$('scroll_down').style.display='block';}
	if(exist('scroll_cursor')){$('scroll_cursor').style.display='block';}
}









// IMAGE LIST SCROLL


// CREER LE SCROLL
function addScroll2(out,o){
	var scrollTopPosition2 = document.createElement('input');
	scrollTopPosition2.setAttribute('id','scrollTopPosition2');
	scrollTopPosition2.setAttribute('type','hidden');
	scrollTopPosition2.value=0;
	$(out).appendChild(scrollTopPosition2);

	var isLeftScrollMouseOver2 = document.createElement('input');
	isLeftScrollMouseOver2.setAttribute('id','isLeftScrollMouseOver2');
	isLeftScrollMouseOver2.setAttribute('type','hidden');
	isLeftScrollMouseOver2.value=0;
	$(out).appendChild(isLeftScrollMouseOver2);


	var isDragStart2 = document.createElement('input');
	isDragStart2.setAttribute('id','isDragStart2');
	isDragStart2.setAttribute('type','hidden');
	isDragStart2.value=0;
	$(out).appendChild(isDragStart2);



	var scroll_up2 = document.createElement('div');
	scroll_up2.setAttribute('id', 'scroll_up2');
	scroll_up2.onclick=function(){scrollingAllUp2(o,20);}	
	$(out).appendChild(scroll_up2);
	$('scroll_up2').innerHTML="<img src='design/images/top_arrow.gif' style='width:15px;'>";
	var scroll2 = document.createElement('div');
	scroll2.setAttribute('id', 'scroll2');
	scroll2.onmousedown= function(){$('isDragStart2').value='1';}
	$(out).appendChild(scroll2);
	document.onmouseup= function(){$('isDragStart2').value='0';}

	var scroll_cursor_before2 = document.createElement('div');
	scroll_cursor_before2.setAttribute('id', 'scroll_cursor_before2');
	scroll_cursor_before2.onclick=function(){scrollingUp2(o,20);}	
	$('scroll2').appendChild(scroll_cursor_before2);

	var scroll_cursor_back2 = document.createElement('div');
	scroll_cursor_back2.setAttribute('id', 'scroll_cursor_back2');
	scroll_cursor_back2.onmousedown=function(){$('isDragStart2').value='1';stopScroll(timer_id2);}	
	scroll_cursor_back2.onmouseup=function(){$('isDragStart2').value='0';}	

	$('scroll2').appendChild(scroll_cursor_back2);
	//window.status = $('scroll').style.top;
	var scroll_cursor2 = document.createElement('div');
	scroll_cursor2.setAttribute('id', 'scroll_cursor2');
	scroll_cursor2.onmousedown=function(){$('isDragStart2').value='1';stopScroll(timer_id2);}	
	scroll_cursor2.onmouseup=function(){$('isDragStart2').value='0';}	

	$('scroll2').appendChild(scroll_cursor2);

	var scroll_cursor_after2 = document.createElement('div');
	scroll_cursor_after2.setAttribute('id', 'scroll_cursor_after2');
	scroll_cursor_after2.onclick=function(){scrollingDown2(o,20);}	
	$('scroll2').appendChild(scroll_cursor_after2);

	var scroll_down2 = document.createElement('div');
	scroll_down2.setAttribute('id', 'scroll_down2');
	scroll_down2.onclick=function(){scrollingAllDown2(o,20);}
	$(out).appendChild(scroll_down2);
	$('scroll_down2').innerHTML="<img src='design/images/bottom_arrow.gif' style='width:15px;'>";
	hideScroll2();
	initScroll2(out,o);
}
function hideScroll2(){
	if(exist('scroll_up2')){$('scroll_up2').style.display='none';}
	if(exist('scroll2')){$('scroll2').style.display='none';}
	if(exist('scroll_cursor_before2')){$('scroll_cursor_before2').style.display='none';}
	if(exist('scroll_cursor_back2')){$('scroll_cursor_back2').style.display='none';}
	if(exist('scroll_cursor_after2')){$('scroll_cursor_after2').style.display='none';}
	if(exist('scroll_down2')){$('scroll_down2').style.display='none';}
	if(exist('scroll_cursor2')){$('scroll_cursor2').style.display='none';}
}
function showScroll2(){
	if(exist('scroll_up2')){$('scroll_up2').style.display='block';}
	if(exist('scroll2')){$('scroll2').style.display='block';}
	if(exist('scroll_cursor_before2')){$('scroll_cursor_before2').style.display='block';}
	if(exist('scroll_cursor_back2')){$('scroll_cursor_back2').style.display='block';}
	if(exist('scroll_cursor_after2')){$('scroll_cursor_after2').style.display='block';}
	if(exist('scroll_down2')){$('scroll_down2').style.display='block';}
	if(exist('scroll_cursor2')){$('scroll_cursor2').style.display='block';}
}


var timer_id2;

function initScroll2(out,o)
{
	if(exist('scrollContainer2')){
		//hideScroll2();
		var h = document.body.clientHeight;

		var largeurScroll=15;

		//var divScrollHeight=parseInt(h)-300;
		//var divScrollHeight=parseInt(document.body.clientHeight)-parseInt($('scrollContainer2').style.top);

		//var divScrollHeight=200;
		var divScrollHeight=parseInt(document.body.clientHeight)-parseInt($('scrollContainer2').style.top)-150;

		if(exist(out)){
			$(out).style.position='absolute';	
			$(out).style.top=330;	
			$(out).style.left=-24;		
			$(out).style.height=divScrollHeight;
			$(out).style.width=largeurScroll;
			$(out).style.zIndex=0;	
		}

		if(exist('scroll_up2')){
			$('scroll_up2').style.position='absolute';	
			$('scroll_up2').style.top=0;	
			$('scroll_up2').style.left=0;	
			$('scroll_up2').style.height=8;
			$('scroll_up2').style.width=largeurScroll;
			$('scroll_up2').style.zIndex=2;
		}

		if(exist('scroll_down2')){
			$('scroll_down2').style.position='absolute';	
			$('scroll_down2').style.left=0;
			$('scroll_down2').style.height=8;
			$('scroll_down2').style.width=largeurScroll;
			$('scroll_down2').style.zIndex=3;
		}
		if(exist('scroll2')){
			$('scroll2').style.position='absolute';
			$('scroll2').style.left=0;
			$('scroll2').style.top=parseInt($('scroll_up2').style.top)+parseInt($('scroll_up2').style.height);
			//$('scroll2').style.height=parseInt($('scrollContainer2').style.height) - parseInt($('scroll_up2').style.height) - parseInt($('scroll_down2').style.height);

			$('scroll2').style.height = divScrollHeight;
			//coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
			coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
			$('scroll2').style.width=largeurScroll;
			$('scroll2').style.zIndex=1;
		}
		if(exist('scroll_down2')){
			$('scroll_down2').style.top=parseInt($('scroll2').style.top) + parseInt($('scroll2').style.height)-4;
		}
		if(exist(o)){
			$(o).style.position='absolute';
			$(o).style.left=20;
			$(o).style.top=$('scroll2').style.top;
			$(o).style.height=$('scroll2').style.height;
		}
		if(exist('scroll_cursor_back2')){
			$('scroll_cursor_back2').style.position='absolute';	
			$('scroll_cursor_back2').style.top=0;
			$('scroll_cursor_back2').style.height=parseInt($(o).style.height)*coef;
			$('scroll_cursor_back2').style.left=0;
			$('scroll_cursor_back2').style.zIndex=5;
		}
		if(exist('scroll_cursor2')){
			$('scroll_cursor2').style.position='absolute';	

			if(exist('scrollTopPosition2')){
				$('scroll_cursor2').style.top=$('scrollTopPosition2').value;
			}
			else{ 
				$('scroll_cursor2').style.top=0;
			}
			$('scroll_cursor2').style.width=largeurScroll;
			$('scroll_cursor2').style.height=parseInt($(o).style.height)*coef;
			$('scroll_cursor2').style.left=0;
			$('scroll_cursor2').style.zIndex=5;
		}

		if(exist('scroll_cursor_after2')){
			$('scroll_cursor_after2').style.position='absolute';
			$('scroll_cursor_after2').style.top=parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height);
			$('scroll_cursor_after2').style.left=0;
			$('scroll_cursor_after2').style.zIndex=6;
		}
		if(exist('scroll_cursor_before2')){
			$('scroll_cursor_before2').style.position='absolute';
			$('scroll_cursor_before2').style.zIndex=4;
			$('scroll_cursor_before2').style.top=0;
			$('scroll_cursor_before2').style.left=0;
			$('scroll_cursor_before2').style.height=parseInt($('scroll_cursor2').style.top);
		}
		if(o!=''){updateScrollCursorSize2(o);}
	}
}
function updateScrollCursorSize2(o){
	if(exist('scroll_cursor_after2')){
		$('scroll_cursor_after2').style.top=parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height);
		$('scroll_cursor_after2').style.height=parseInt($('scroll2').style.height)-parseInt($('scroll_cursor2').style.top)-parseInt($('scroll_cursor2').style.height);
	}
	if(exist('scroll_cursor_before2')){
		$('scroll_cursor_before2').style.top=0;
		$('scroll_cursor_before2').style.height=parseInt($('scroll_cursor2').style.top);
	}
	if(exist('scroll_cursor_back2')){
		$('scroll_cursor_back2').style.top=$('scroll_cursor2').style.top;
	}

	if(exist('scrollImageList')){
		if(parseInt($('scrollImageList').scrollHeight) <= parseInt($('scrollImageList').style.height)){
			hideScroll2();
		}
		else {
			showScroll2();
		}
	}

}

function scrollingDown2(o,length){
	//stopScroll(timer_id2);
	if(length>0){
		if(parseInt($(o).scrollTop)>=parseInt($(o).style.scrollHeight)-parseInt($('scroll_cursor2').style.height)){
			length=0;stopScroll(timer_id2);}
		else {
			$(o).scrollTop=parseInt($(o).scrollTop)+length;
			length=length-1;
			$('scrollTopPosition2').value=parseInt($('scroll_cursor2').style.top);
			coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
			$('scroll_cursor2').style.top=parseInt($(o).scrollTop)*coef;
			timer_id2 = setTimeout("scrollingDown2('" + o + "',"+length+")", 30);
		}
		updateScrollCursorSize2(o);
	}
	else {stopScroll(timer_id2);}
}

function scrollingUp2(o,length){
	//stopScroll(timer_id2);
	if(length>0){
		if(parseInt($(o).scrollTop)<=0){$(o).scrollTop=0;stopScroll(timer_id);}
		else {
			$(o).scrollTop=parseInt($(o).scrollTop)-length;
			length=length-1;
			$('scrollTopPosition2').value=parseInt($('scroll_cursor2').style.top);
			coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
			$('scroll_cursor2').style.top=$(o).scrollTop*coef;
			timer_id2 = setTimeout("scrollingUp2('" + o + "',"+length+")", 30);
		}
		updateScrollCursorSize2(o);
	}
	else {stopScroll(timer_id2);}
}


function scrollingAllDown2(o){
	//stopScroll(timer_id2);
	if(parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height)<=parseInt($('scroll2').style.height)){
		$(o).scrollTop=parseInt($(o).scrollTop)+20;
		$('scrollTopPosition2').value=parseInt($('scroll_cursor2').style.top);	
		coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
		$('scroll_cursor2').style.top=parseInt($(o).scrollTop)*coef;

		updateScrollCursorSize2(o);		
		timer_id2 = setTimeout("scrollingAllDown2('" + o + "')", 30);
	}
	else {stopScroll(timer_id2);}
}

function scrollingAllUp2(o){
	//stopScroll(timer_id2);
	if(parseInt($(o).scrollTop)>0){
		$(o).scrollTop=parseInt($(o).scrollTop)-20;
		$('scrollTopPosition2').value=parseInt($('scroll_cursor2').style.top);
		coef = parseInt($('scroll2').style.height) / parseInt($(o).scrollHeight);
		$('scroll_cursor2').style.top=parseInt($(o).scrollTop)*coef;
		updateScrollCursorSize2(o);
		timer_id = setTimeout("scrollingAllUp2('" + o + "')", 30);
	}
	else {stopScroll(timer_id2);}
}

function music(){launch('functions/php/music_enabled_process.php');content_arg($('music'),'music','','','');}
function nomusic(){launch('functions/php/music_disabled_process.php');content_arg($('music'),'nomusic','','','');}



function select(o){
	if(exist(o)){
		if ($(o).className=='hide')
		{
			$(o).className='show';
		}
		else 
		{
			$(o).className='hide';
		}
	}
}






// MOUSE WHEEL ========================================================

/** This is high-level function.
 * It must react to delta being more/less than zero.
 */
function handle(delta) {
	// LEFT MENU SCROLL
	var speed=0;
	if(isBrowser('safari')){
		speed = 5;
	}
	else {
		speed = 10;
	}


	if (exist('isLeftScrollMouseOver')){
		if ($('isLeftScrollMouseOver').value==1){
			if (delta < 0) {scrollingDown('scrollLeftClient',speed);}
			else {scrollingUp('scrollLeftClient',speed);}
		}
		else {


		}
	}
	// IMAGE LIST SCROLL
	if (exist('isLeftScrollMouseOver2')){
		if ($('isLeftScrollMouseOver2').value==1){
			if (delta < 0) scrollingDown2('scrollImageList',speed);
			else scrollingUp2('scrollImageList',speed);
			//window.status=$('scrollImageList').scrollHeight + " " + parseInt($('scrollImageList').scrollTop) + " " + parseInt($('scrollImageList').style.height);
			//window.status =parseInt(document.body.clientHeight)-parseInt($('scrollContainer2').style.top)-150;

		}
	}

}

/** Event handler for mouse wheel event.
 */
function wheel(event){
	var delta = 0;
	if (!event) event = window.event; /* For IE. */

	/* IE/Opera. */
	if (event.wheelDelta) { 
		delta = event.wheelDelta/120;
		/** In Opera 9, delta differs in sign as compared to IE. <-- no 
		 */
		//if (window.opera)
		//delta = -delta;
	} else if (event.detail) { /** Mozilla case. */
		/** In Mozilla, sign of delta is different than in IE.
		 * Also, delta is multiple of 3.
		 */
		delta = -event.detail/3;
	}
	/** If delta is nonzero, handle it.
	 * Basically, delta is now positive if wheel was scrolled up,
	 * and negative, if wheel was scrolled down.
	 */
	if (delta)
		handle(delta);
	/** Prevent default actions caused by mouse wheel.
	 * That might be ugly, but we handle scrolls somehow
	 * anyway, so don't bother here..
	 */
	if (event.preventDefault)
		event.preventDefault();
	event.returnValue = false;
}

/** Initialization code. 
 * If you use your own event management code, change it as required.
 */
/** DOMMouseScroll is for mozilla. */
if (window.addEventListener)window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;

// ==========================================================================

previousX = 0;
previousY = 0;

function position(e)
{
	x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;

	// LEFT SCROLL
	if(exist('isDragStart') && $('isDragStart').value=='1'){

		deltaY = y-previousY;
		// si la souris monte et qu'on est dŽjˆ au dessus
		if(parseInt($('scroll_cursor').style.top)<=0 && deltaY<0){
			$('scroll_cursor_back').style.top=0;
			$('scroll_cursor').style.top=$('scroll_cursor_back').style.top;
			$('scrollLeftClient').scrollTop=0;
			if(exist('scroll_cursor_after')){
				$('scroll_cursor_after').style.top=parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height);
				$('scroll_cursor_after').style.height=parseInt($('scroll').style.height)-parseInt($('scroll_cursor').style.top)-parseInt($('scroll_cursor').style.height);

			}
			if(exist('scroll_cursor_before')){
				$('scroll_cursor_before').style.top=0;
				$('scroll_cursor_before').style.height=parseInt($('scroll_cursor').style.top);
			}
		}
		// si la souris descend et qu'on est dŽjˆ en bas
		else if(parseInt($('scroll_cursor').style.top)>=parseInt($('scroll').style.height)-parseInt($('scroll_cursor').style.height) && deltaY>0){
			coef = parseInt($('scroll').style.height) / parseInt($('scrollLeftClient').scrollHeight);
			$('scroll_cursor').style.top = parseInt($('scrollLeftClient').scrollTop)*coef;
			$('scroll_cursor_back').style.top=$('scroll_cursor').style.top;
			if(exist('scroll_cursor_after')){
				$('scroll_cursor_after').style.top=parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height);
				$('scroll_cursor_after').style.height=parseInt($('scroll').style.height)-parseInt($('scroll_cursor').style.top)-parseInt($('scroll_cursor').style.height);

			}
			if(exist('scroll_cursor_before')){
				$('scroll_cursor_before').style.top=0;
				$('scroll_cursor_before').style.height=parseInt($('scroll_cursor').style.top);
			}
		}

		else {
			$('scroll_cursor_back').style.top=parseInt($('scroll_cursor_back').style.top)+deltaY;
			$('scroll_cursor').style.top=$('scroll_cursor_back').style.top;
			if(exist('scroll_cursor_after')){
				$('scroll_cursor_after').style.top=parseInt($('scroll_cursor').style.top)+parseInt($('scroll_cursor').style.height);
				$('scroll_cursor_after').style.height=parseInt($('scroll').style.height)-parseInt($('scroll_cursor').style.top)-parseInt($('scroll_cursor').style.height);

			}
			if(exist('scroll_cursor_before')){
				$('scroll_cursor_before').style.top=0;
				$('scroll_cursor_before').style.height=parseInt($('scroll_cursor').style.top);
			}
			if(exist('scroll_cursor_back')){
				$('scroll_cursor_back').style.top=$('scroll_cursor').style.top;
			}

			$('scrollTopPosition').value = $('scroll_cursor_back').style.top;
			coef = parseInt($('scroll').style.height) / parseInt($('scrollLeftClient').scrollHeight);
			$('scrollLeftClient').scrollTop=parseInt($('scroll_cursor').style.top)/coef;

		}
	}


	// IMAGE LIST SCROLL
	if(exist('isDragStart2') && $('isDragStart2').value=='1'){

		deltaY = y-previousY;
		// si la souris monte et qu'on est dŽjˆ au dessus
		if(parseInt($('scroll_cursor2').style.top)<=0 && deltaY<0){
			$('scroll_cursor_back2').style.top=0;
			$('scroll_cursor2').style.top=$('scroll_cursor_back2').style.top;
			$('scrollImageList').scrollTop=0;
			if(exist('scroll_cursor_after2')){
				$('scroll_cursor_after2').style.top=parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height);
				$('scroll_cursor_after2').style.height=parseInt($('scroll2').style.height)-parseInt($('scroll_cursor2').style.top)-parseInt($('scroll_cursor2').style.height);

			}
			if(exist('scroll_cursor_before2')){
				$('scroll_cursor_before2').style.top=0;
				$('scroll_cursor_before2').style.height=parseInt($('scroll_cursor2').style.top);
			}
		}
		// si la souris descend et qu'on est dŽjˆ en bas
		else if(parseInt($('scroll_cursor2').style.top)>=parseInt($('scroll2').style.height)-parseInt($('scroll_cursor2').style.height) && deltaY>0){
			coef = parseInt($('scroll2').style.height) / parseInt($('scrollImageList').scrollHeight);
			$('scroll_cursor2').style.top = parseInt($('scrollImageList').scrollTop)*coef;
			$('scroll_cursor_back2').style.top=$('scroll_cursor2').style.top;
			if(exist('scroll_cursor_after2')){
				$('scroll_cursor_after2').style.top=parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height);
				$('scroll_cursor_after2').style.height=parseInt($('scroll2').style.height)-parseInt($('scroll_cursor2').style.top)-parseInt($('scroll_cursor2').style.height);

			}
			if(exist('scroll_cursor_before2')){
				$('scroll_cursor_before2').style.top=0;
				$('scroll_cursor_before2').style.height=parseInt($('scroll_cursor2').style.top);
			}
		}

		else {
			$('scroll_cursor_back2').style.top=parseInt($('scroll_cursor_back2').style.top)+deltaY;
			$('scroll_cursor2').style.top=$('scroll_cursor_back2').style.top;
			if(exist('scroll_cursor_after2')){
				$('scroll_cursor_after2').style.top=parseInt($('scroll_cursor2').style.top)+parseInt($('scroll_cursor2').style.height);
				$('scroll_cursor_after2').style.height=parseInt($('scroll2').style.height)-parseInt($('scroll_cursor2').style.top)-parseInt($('scroll_cursor2').style.height);

			}
			if(exist('scroll_cursor_before2')){
				$('scroll_cursor_before2').style.top=0;
				$('scroll_cursor_before2').style.height=parseInt($('scroll_cursor2').style.top);
			}
			if(exist('scroll_cursor_back2')){
				$('scroll_cursor_back2').style.top=$('scroll_cursor2').style.top;
			}

			$('scrollTopPosition2').value = parseInt($('scroll_cursor_back2').style.top);
			coef = parseInt($('scroll2').style.height) / parseInt($('scrollImageList').scrollHeight);
			$('scrollImageList').scrollTop=parseInt($('scroll_cursor2').style.top)/coef;

		}

	}
	previousX = x;
	previousY = y;
}
/*if(navigator.appName.substring(0,3) == "Net")
  document.captureEvents(Event.MOUSEMOVE);*/
document.onmousemove = position;



function no_error(){return true;}
window.onerror=no_error;

// KEYBOARD COMMAND
function onKeyPress(event){
	if(event.keyCode==27){closeBox();}
}
