var regExpBeginning = /^\s+/;
var regExpEnd       = /\s+$/;
var version;
var  NavName;
var i=0;
var cObj;
var timer;
var MOUSE_OVER=false;
var myDiv;
var pageHeight;
var pageWidth;
var CATEGORIE;


function check_login(etat)
{
if(etat==1)
{
var log=document.getElementById("login").value;
var pass=document.getElementById("pass").value;
data = "pass=" + pass + "&login=" + log;
}
if(etat==0)
{
data ="";
}




if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);

		  
	xhr_object.open("POST","pages/check.php",true);
	xhr_object.onreadystatechange = function()
	{ 
		//document.getElementById(madiv).innerHTML ='<div align="center" style="padding-top:30px;"><img src="images/indicator_verybig.gif" width="54" height="55" /></div>';

	   if(xhr_object.readyState == 4 ) 
	   {
			
			document.getElementById("ident").innerHTML=	xhr_object.responseText;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	
	xhr_object.send(data);


}


function affiche_ssmenu(DivMenu)
{
document.getElementById(DivMenu).style.display="block";
document.getElementById(DivMenu).style.top=130 + "px";

}

function hide_ssmenu(DivMenu)
{

document.getElementById(DivMenu).style.display="none";

}

/***********************************************************************/
/*                                                                                                                                         */
/*                           FONCTION CREATE LOGIN                                                              */
/*                                                                                                                                         */
/***********************************************************************/


function login(etat)
{

if(version=='MSIE 6.0')	
document.getElementById('log').innerHTML="<div class='close'><a href='javascript:;' onclick='hide_imgclick(\"log\")' title='fermer la fenetre'><img border='0' src='images/croix.gif'></a></div>";
else
document.getElementById('log').innerHTML="<div class='close'><a href='javascript:;' onclick='hide_imgclick(\"log\")' title='fermer la fenetre'><img border='0' src='images/croix.png'></a></div>";

if(etat==0)
document.getElementById('log').innerHTML+="<div id=\"ident\"></div><table><tr><td>Login : </td><td><input type=\"text\" name=\"login\" id=\"login\"></td><tr><td>Password : </td><td><input type=\"password\" name=\"pass\" id=\"pass\"></td><tr><td colspan=\"2\" align=\"right\"><input type=\"button\" name=\"valid\" id=\"valid\" value=\"Valider\" onclick=\"check_login(1)\"></td></table>";
if(etat==1)
document.getElementById('log').innerHTML+="<div id=\"ident\"><a href=\"javascript:;\" onclick=\"check_login(0);\"><span style=\"font-size:25px;\">Deconnexion</span></a></div>";



document.getElementById('log').style.width=250 + "px" ;
document.getElementById('log').style.height=100 + "px";
document.getElementById('log').className="display_log";

document.getElementById("alpha").style.left=0 +"px";

posDiv('log');

//alert("offsetHeight:" + document.getElementById('viewer_img').offsetHeight);


if(pageHeight<document.getElementById('log').offsetHeight)
	document.getElementById("alpha").style.height=document.getElementById('viewer_img').offsetHeight + "px";
else
	document.getElementById("alpha").style.height=pageHeight + "px";
	
if(pageWidth<document.getElementById('log').offsetwidth)
	document.getElementById("alpha").style.width=document.getElementById('viewer_img').offsetwidth + "px";
else
	document.getElementById("alpha").style.width=pageWidth + "px";
	
document.getElementById("alpha").style.display="block";




}

function view_img_click(img,width,height)
{
	
if(version=='MSIE 6.0')	
document.getElementById('viewer_img').innerHTML="<div class='close'><a href='javascript:;' onclick='hide_imgclick(\"viewer_img\")' title='fermer la fenetre'><img border='0' src='images/croix.gif'></a></div>";
else
document.getElementById('viewer_img').innerHTML="<div class='close'><a href='javascript:;' onclick='hide_imgclick(\"viewer_img\")' title='fermer la fenetre'><img border='0' src='images/croix.png'></a></div>";

document.getElementById('viewer_img').innerHTML+="<img  src="+img+ " width=" + width + "  height=" + height + " alt="+img+" />";



document.getElementById('viewer_img').style.width=width;
document.getElementById('viewer_img').style.height=height;
document.getElementById('viewer_img').className="display_div";

document.getElementById("alpha").style.left=0 +"px";

posDiv('viewer_img');

//alert("offsetHeight:" + document.getElementById('viewer_img').offsetHeight);


if(pageHeight<document.getElementById('viewer_img').offsetHeight)
	document.getElementById("alpha").style.height=document.getElementById('viewer_img').offsetHeight + "px";
else
	document.getElementById("alpha").style.height=pageHeight + "px";
	
if(pageWidth<document.getElementById('viewer_img').offsetwidth)
	document.getElementById("alpha").style.width=document.getElementById('viewer_img').offsetwidth + "px";
else
	document.getElementById("alpha").style.width=pageWidth + "px";
	
document.getElementById("alpha").style.display="block";

}
/*************************************************************************************************************************************************/
function getWindow(){
 pageWidth = 0;pageHeight = 0;
  pageWidth =  window.innerWidth;
  pageWidth = (pageWidth)? pageWidth : document.documentElement.clientWidth;
  pageWidth = (pageWidth)? pageWidth: document.body.clientWidth;



  pageHeight =  window.innerHeight;
  pageHeight = (pageHeight)? pageHeight: document.documentElement.clientHeight;
  pageHeight = (pageHeight)? pageHeight: document.body.clientHeight;

}



function posDiv(ladiv){

  getWindow();
var posTop=0;

 

var posLeft = (pageWidth-document.getElementById(ladiv).offsetWidth)/2;

document.getElementById(ladiv).style.left = (posLeft<0)?0+"px":posLeft+"px";

var posTop = (pageHeight-document.getElementById(ladiv).offsetHeight)/2;
//alert("offsetHeight:"+ myDiv.offsetHeight + ", pageHeight:" + pageHeight);
document.getElementById(ladiv).style.top = (posTop<0)?0+"px":posTop+"px";

}


/****************************************************************************************************************************************************/
function hide_imgclick(ladiv)
{

document.getElementById(ladiv).className="cache_div";
document.getElementById("alpha").style.display="none";
}

/***********************************************************************/
/*                                                                                                                                         */
/*                           FONCTION MODIFIER CONTENU                                                               */
/*                                                                                                                                         */
/***********************************************************************/
function modifier(id,img,width,height,miniature)
{
var contenu_a_modifer=document.getElementById("desc_"+id).value;
img_split=img.split('.');
textid="desc_"+id;
data = "file=" + img_split[0] +  "&content=" + contenu_a_modifer;
madiv="portfolio_"+id;
mini_croix="mini_croix_"+id;

if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);

		  
	xhr_object.open("POST","pages/modifier.php",true);
	xhr_object.onreadystatechange = function()
	{ 
		//document.getElementById(madiv).innerHTML ='<div align="center" style="padding-top:30px;"><img src="images/indicator_verybig.gif" width="54" height="55" /></div>';

	   if(xhr_object.readyState == 4 ) 
	   {
			var contenu_a_modifer=document.getElementById("desc_"+id).value;
			MOUSE_OVER=false;
		
			var intro_desc="<div class=\"description\">Description de la miniature</div><br /><a href=\"javascript:;\" onclick=\"view_img_click('galerie/"+img+"',"+width+","+height+")\" ><strong>Agrandir la miniature</strong></a><br /><div id=\"descriptif_"+id+"\" class=\"descriptif\" onclick=\"ajoute_textarea('descriptif_"+id+"',"+id+","+width+","+height+",'"+img+"')\">";
			document.getElementById(madiv).className="overmouse";
			document.getElementById(madiv).innerHTML=intro_desc + contenu_a_modifer;
			document.getElementById(madiv).innerHTML+="</div>";
			
			
			if(version=='MSIE 6.0')
			initScrollBar_ie4(id,id,img,mini_croix,miniature);
			else
			initScrollBar(id,id,img,mini_croix,miniature);

			document.getElementById(mini_croix).style.display="block";
			
			
			
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	
	xhr_object.send(data); 
}

/***********************************************************************/
/*                                                                                                                                         */
/*                           FONCTION CHARGE PAGE                                                               */
/*                                                                                                                                         */
/***********************************************************************/

function charge_page(page,variable,type,div)
{


MOUSE_OVER=false;
if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);

		  if(page=="")
		  echo_page="pages/accueil.php";
		  else
		  echo_page=page;
		  
		  
		switch(page)
		{
			case "pages/accueil.php": change_menu("accueil");
			break;
			case "pages/portfolio.php": change_menu("galerie") ;
			break;
			case "pages/cv.php": change_menu("cv");
			break;
			case "pages/contact.php": change_menu("contact") ;
			break;
			case "": change_menu("accueil");
		}		
		  
		 
	
		document.getElementById(div).innerHTML ='<div align="center" style="padding-top:50px;font-size:20px;color:#666666;">Chargement de la page...<br /><br /><img src="images/indicator_verybig.gif" width="54" height="55" /></div>';

    xhr_object.open("POST",echo_page,true);
	xhr_object.onreadystatechange = function()
	{ 
	    if(xhr_object.readyState == 4 ) 
	    {
			document.getElementById(div).innerHTML=xhr_object.responseText;   
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	
	xhr_object.send(variable); 
}
function change_menu(id_menu)
{

	switch(id_menu)
	{
		case "accueil": document.getElementById("accueil").src="images/accueil_over.jpg";
		document.getElementById('galerie').src="images/galerie.jpg";
		document.getElementById('contact').src="images/contact.jpg";
		document.getElementById('cv').src="images/cv.jpg";
		break;
		case "galerie": document.getElementById("galerie").src="images/galerie_over.jpg";
		document.getElementById('accueil').src="images/accueil.jpg";
		document.getElementById('contact').src="images/contact.jpg";
		document.getElementById('cv').src="images/cv.jpg";
		break;
		case "contact": document.getElementById("contact").src="images/contact_over.jpg";
		document.getElementById('galerie').src="images/galerie.jpg";
		document.getElementById('accueil').src="images/accueil.jpg";
		document.getElementById('cv').src="images/cv.jpg";
		break;
		case "cv": document.getElementById("cv").src="images/cv_over.jpg";
		document.getElementById('galerie').src="images/galerie.jpg";
		document.getElementById('accueil').src="images/accueil.jpg";
		document.getElementById('contact').src="images/contact.jpg";
		break;
	}
}


function retour_textarea(id,contenu,width,height,img,miniature)
{
MOUSE_OVER=false;
var DivScrollBar="scrollbar_" + id;
var Divportfolio="portfolio_" + id; /*contenue*/
var DivSlideBar="slidebar_" + id;

var DivMiniCroix="mini_croix_" + id;
affiche_infobulle(Divportfolio,contenu,id,id,img,DivMiniCroix,width,height,miniature)


}
function ajoute_textarea(ou_modifier,id,width,height,img,miniature)
{
var DivMiniCroix="mini_croix_" + id;
var DivScrollBar="scrollbar_" + id;
contenu_textarea=document.getElementById("descriptif_"+id).innerHTML;

document.getElementById("portfolio_"+id).innerHTML = '<input type="hidden" name="cat_'+id+'" value="'+id+'"><textarea onfocus="return(0)" id="desc_'+id+'" name="desc" cols="18" rows="5">'+contenu_textarea+'</textarea><br /><a href=\"javascript:;\" onclick="modifier(\''+id+'\',\''+img+'\',\''+width+'\',\''+height+'\',\''+miniature+'\')"/>Valider</a>&nbsp;&nbsp;<a href=\"javascript:;\" onclick="retour_textarea(\''+id+'\',\''+contenu_textarea+'\',\''+width+'\',\''+height+'\',\''+img+'\',\''+miniature+'\')">Retour</a>';
MOUSE_OVER=true;
document.getElementById(DivScrollBar).style.display="none";
document.getElementById(DivMiniCroix).style.display="none";
}
/*******************************   infobulle   *******************************************************************************************************/

function affiche_infobulle(madiv,texte,indice_scroll,indice_plus,img,mini_croix,width,height,miniature)
{

	if(MOUSE_OVER==false)
	{
	img_split=img.split('.');
	data = "file=" + img_split[0];
	
	
	
	if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);

		  
		  
	document.getElementById(madiv).innerHTML ='<div align="center" style="padding-top:30px;"><img src="images/indicator_verybig.gif" width="54" height="55" /></div>';
		  
	xhr_object.open("POST","pages/afficher.php",true);
	xhr_object.onreadystatechange = function()
	{ 
	
	   if(xhr_object.readyState == 4 ) 
	   {
		response=xhr_object.responseText;   
		response=response.split("|");
		
		if(response[1]=="1")
			var intro_desc="<div class=\"description\">Description de la miniature</div><br /><a href=\"javascript:;\" onclick=\"view_img_click('galerie/"+img+"',"+width+","+height+")\" ><strong>Agrandir la miniature</strong></a><br /><div id=\"descriptif_"+indice_scroll+"\" class=\"descriptif\" onclick=\"ajoute_textarea('descriptif_"+indice_scroll+"',"+indice_scroll+","+width+","+height+",'"+img+"')\">";
		if(response[1]=="0")
			var intro_desc="<div class=\"description\">Description de la miniature</div><br /><a href=\"javascript:;\" onclick=\"view_img_click('galerie/"+img+"',"+width+","+height+")\" ><strong>Agrandir la miniature</strong></a><br /><div id=\"descriptif_"+indice_scroll+"\" class=\"descriptif\" >";
		
			document.getElementById(madiv).className="overmouse";
			document.getElementById(madiv).innerHTML=intro_desc + response[0];
			document.getElementById(madiv).innerHTML+="</div>";
			
			
			if(version=='MSIE 6.0')
			initScrollBar_ie4(indice_scroll,indice_plus,img,mini_croix,width,height,miniature);
			else
			initScrollBar(indice_scroll,indice_plus,img,mini_croix,width,height,miniature);

			document.getElementById(mini_croix).style.display="block";
			
			
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	
	xhr_object.send(data); 
			
	}
}

function desaffiche_infobulle(madiv,img,indice_scroll,indice_plus,mini_croix,width,height,miniature)
{
MOUSE_OVER=false;
			var DivScrollBar="scrollbar_" + indice_scroll;
			var Divportfolio="portfolio_" + indice_scroll; /*contenue*/
			var DivSlideBar="slidebar_" + indice_scroll;
			var DivTrackBar="track_" + indice_scroll;
			var DivMiniCroix="mini_croix_" + indice_scroll;
			var DivFondContenu="fond_contenu_" + indice_scroll;

			document.getElementById(Divportfolio).innerHTML="<img src=\"images/indicator_verybig.gif\" width=\"54\" height=\"55\" />";


			document.getElementById(mini_croix).style.display="none";
			document.getElementById(DivScrollBar).style.display="none";
			document.getElementById(Divportfolio).className="overmouse_rel";



			document.getElementById(Divportfolio).innerHTML="<div class=\"filigrane\"></div><div class=\"filigrane2\" onclick=\"view_img_click('galerie/"+img+"','"+width+"' ,'"+height+"')\"></div><img  src=\"" + miniature + "\" border='0'  alt=\"" + img + "\">";
	
}
  /*********************************** init scrollbar ie7,firefox **************************************************************************/
function initScrollBar(indice,indice_plus,img,mini_croix,width,height,miniature)
{

var DivScrollBar="scrollbar_" + indice;
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivSlideBar="slidebar_" + indice;
var DivTrackBar="track_" + indice;
var DivMiniCroix="mini_croix_" + indice;
var DivFondContenu="fond_contenu_" + indice;
var IMG=img;


document.getElementById(mini_croix).innerHTML="<a href=\"javascript:;\" onclick=\"desaffiche_infobulle('"+Divportfolio+"','"+img+"',"+indice+","+indice_plus+",'"+mini_croix+"','"+width+"','"+height+"','"+miniature+"');\" ><img src=\"images/mini_croix.gif\" border=\"0\"  width=\"15px\" height=\"11px\" /></a>";







if(document.getElementById(Divportfolio).offsetHeight<document.getElementById(DivFondContenu).offsetHeight)
{

document.getElementById(DivScrollBar).style.display="none";


	switch (indice_plus)
	{
		case 0 :
		document.getElementById(mini_croix).style.top=40 + "px";
		break;
		case 1 :
		
		document.getElementById(mini_croix).style.top=38 + "px";
		document.getElementById(mini_croix).style.left=445 + "px";
		break;
		case 2 :
		document.getElementById(mini_croix).style.top=247 + "px";
		break;
		case 3 :
		
		document.getElementById(mini_croix).style.top=245 + "px";
		document.getElementById(mini_croix).style.left=445 + "px";
		break;
	}




}
else
{
switch (indice_plus)
{
case 0 :document.getElementById(DivScrollBar).style.top=63 + "px";
document.getElementById(mini_croix).style.top=40 + "px";
break;
case 1 :document.getElementById(DivScrollBar).style.top=63 + "px";
document.getElementById(DivScrollBar).style.left=600 + "px";
document.getElementById(mini_croix).style.top=38 + "px";
document.getElementById(mini_croix).style.left=445 + "px";
break;
case 2 :document.getElementById(DivScrollBar).style.top=273 + "px";
document.getElementById(mini_croix).style.top=247 + "px";
break;
case 3 :document.getElementById(DivScrollBar).style.top=273 + "px";
document.getElementById(DivScrollBar).style.left=600 + "px";
document.getElementById(mini_croix).style.top=245 + "px";
document.getElementById(mini_croix).style.left=445 + "px";
break;

}
document.getElementById(DivScrollBar).style.display="block";
	cObj=document.getElementById(DivSlideBar);
	
	cObj.style.top="0px";

	contenu_div=document.getElementById(Divportfolio).offsetHeight;
	
	fond_contenu_div=document.getElementById(DivFondContenu).offsetHeight;
	pourcent=(fond_contenu_div*100)/contenu_div;
	hauteur=(pourcent/100)*document.getElementById(DivTrackBar).offsetHeight;
	
	cObj.style.height=parseInt(hauteur) + "px";
	
}

}
/********************************************************  INIT SCROLLBAR ie6**********************************************************************************/

function initScrollBar_ie4(indice,indice_plus,img,mini_croix,width,height,miniature)
{

var DivScrollBar="scrollbar_" + indice;
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivSlideBar="slidebar_" + indice;
var DivTrackBar="track_" + indice;
var DivMiniCroix="mini_croix_" + indice;
var DivFondContenu="fond_contenu_" + indice;
var IMG=img;


document.getElementById(mini_croix).innerHTML="<a href=\"javascript:;\" onclick=\"desaffiche_infobulle('"+Divportfolio+"','"+img+"',"+indice+","+indice_plus+",'"+width+"','"+height+"','"+miniature+"');\" ><img src=\"images/mini_croix.gif\" border=\"0\"  width=\"15px\" height=\"11px\" /></a>"
document.getElementById(mini_croix).style.display="block";

if(document.getElementById(Divportfolio).offsetHeight<document.getElementById(DivFondContenu).offsetHeight)
{
	document.getElementById(DivScrollBar).style.display="none";

	switch (indice_plus)
	{
	case 0 :document.getElementById(DivScrollBar).style.top=63 + "px";
	document.getElementById(mini_croix).style.top=40 + "px";
	break;
	case 1 :document.getElementById(DivScrollBar).style.top=63 + "px";
	document.getElementById(DivScrollBar).style.left=585 + "px";
	document.getElementById(mini_croix).style.top=38 + "px";
	document.getElementById(mini_croix).style.left=425 + "px";
	break;
	case 2 :document.getElementById(DivScrollBar).style.top=265 + "px";
	document.getElementById(mini_croix).style.top=247 + "px";
	break;
	case 3 :document.getElementById(DivScrollBar).style.top=265 + "px";
	document.getElementById(DivScrollBar).style.left=585 + "px";
	document.getElementById(mini_croix).style.top=245 + "px";
	document.getElementById(mini_croix).style.left=425 + "px";
	break;

	}

}
else
{
switch (indice_plus)
{
case 0 :document.getElementById(DivScrollBar).style.top=63 + "px";
document.getElementById(mini_croix).style.top=40 + "px";
break;
case 1 :document.getElementById(DivScrollBar).style.top=63 + "px";
document.getElementById(DivScrollBar).style.left=585 + "px";
document.getElementById(mini_croix).style.top=38 + "px";
document.getElementById(mini_croix).style.left=425 + "px";
break;
case 2 :document.getElementById(DivScrollBar).style.top=265 + "px";
document.getElementById(mini_croix).style.top=247 + "px";
break;
case 3 :document.getElementById(DivScrollBar).style.top=265 + "px";
document.getElementById(DivScrollBar).style.left=585 + "px";
document.getElementById(mini_croix).style.top=245 + "px";
document.getElementById(mini_croix).style.left=425 + "px";
break;

}
document.getElementById(DivScrollBar).style.display="block";
	cObj=document.getElementById(DivSlideBar);
	
	cObj.style.top="0px";

	contenu_div=document.getElementById(Divportfolio).offsetHeight;
	
	fond_contenu_div=document.getElementById(DivFondContenu).offsetHeight;
	pourcent=(fond_contenu_div*100)/contenu_div;
	hauteur=(pourcent/100)*document.getElementById(DivTrackBar).offsetHeight;
	
	cObj.style.height=parseInt(hauteur) + "px";
	
}

}






/******************************************************************************************************************************************************/
function scroll_plus(indice)
{



var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;

var dif=document.getElementById(Divportfolio).offsetHeight-document.getElementById(DivFondContenu).offsetHeight;
	
	
	if(parseInt(document.getElementById(Divportfolio).style.top)<=-dif)  
	{
		clearTimeout(timer);
	}
	else
	{
		i=i-10;
		
		document.getElementById(Divportfolio).style.top=i + "px";
		position_scroll=calcul(indice);
		cObj.style.top=position_scroll + "px";
		
	}

}



function scroll_moins(indice)
{
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;
	if(parseInt(document.getElementById(Divportfolio).style.top)>=0)  
	{
	
		
	}
	else
	{
		i=i+10;
		document.getElementById(Divportfolio).style.top=i + "px";
		position_scroll=calcul(indice);
		cObj.style.top=position_scroll + "px";
		
	}
}


function scroll_Plusvite(indice)
{
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;
	
	
	
	var dif=document.getElementById(Divportfolio).offsetHeight-document.getElementById(DivFondContenu).offsetHeight;
if(parseInt(document.getElementById(Divportfolio).style.top)<-dif)  
	{
		
		clearTimeout(timer);
	}
	else
	{
		i=i-10;
		
		document.getElementById(Divportfolio).style.top=i + "px";
		position_scroll=calcul(indice);
		cObj.style.top=position_scroll + "px";
		timer=setTimeout("scroll_Plusvite("+indice+")",50);
	}
}
function scroll_Moinsvite(indice)
{
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;


	if(parseInt(document.getElementById(Divportfolio).style.top)>=0)  
	{
	
		
	}
	else
	{
		i=i+10;
		
		document.getElementById(Divportfolio).style.top=i + "px";
		position_scroll=calcul(indice);
		cObj.style.top=position_scroll + "px";
		timer=setTimeout("scroll_Moinsvite("+indice+")",50);
	}
}

function totop(indice)
{
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;

document.getElementById(Divportfolio).style.top=0 + "px";
position_scroll=calcul(indice);
		cObj.style.top=position_scroll + "px";
i=0;
}
function tobottom(indice)
{
var Divportfolio="portfolio_" + indice; /*contenue*/
var DivFondContenu="fond_contenu_" + indice;

var dif=document.getElementById(Divportfolio).offsetHeight-document.getElementById(DivFondContenu).offsetHeight;
document.getElementById(Divportfolio).style.top=-dif + "px";
position_scroll=calcul(indice);
cObj.style.top=position_scroll + "px";
i=-dif;

	
}


function calcul(indice)
{


var Divportfolio="portfolio_" + indice; /*contenue*/
var DivTrackBar="track_" + indice;




tHp	= Math.abs((document.getElementById(Divportfolio).offsetTop*100)/document.getElementById(Divportfolio).offsetHeight)	;

return (tHp/100)*document.getElementById(DivTrackBar).offsetHeight;
}

function gerer_molette(e)
{


	if(!e)
	{
	if(event.wheelDelta) //IE
	{
	
		if (event.wheelDelta >= 120)
		{
		scroll_moins();
		scroll_moins();
		}
		if (event.wheelDelta <= -120)
		{
		scroll_plus();
		scroll_plus();
		}
	}
	}
	else
	{
			if(e.detail)
			{
			delta = -e.detail/3;
				if(delta==-1)
				{
					scroll_plus();
					scroll_plus();
				}
				else
				{				
					scroll_moins();
					scroll_moins();
				}		
			}	
	}
}



	 
 
 function active_style(title) {


  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
	   
	   switch (title)
		{
		  case "style":
		     
		   break;
		  case "ie4":
		   
		    break;
		  default:
		    
		   break;
		}
	  

      if(a.getAttribute("title") == title) a.disabled = false;
	  
    }
  }
}
 

function trim(aString) {
    return aString.replace(regExpBeginning, "").replace(regExpEnd, "");
}






NavName = navigator.appName;
NavVers = navigator.appVersion;
Nav = NavName + " " + NavVers;

NavVers=navigator.appVersion.split(';')
version=trim(NavVers[1]);

if(NavName=='Microsoft Internet Explorer')
	if(version=='MSIE 6.0')
		active_style("ie6");
	if(version=='MSIE 7.0')
		active_style("ie7");	  
else
	if(NavName=='Netscape')
		active_style("style");


	 
 
if (window.addEventListener)
        /**Firefox*/
        window.addEventListener('DOMMouseScroll', gerer_molette, false);

document.onmousewheel = gerer_molette;
