var zxcSpeed=2;
var zxcDelay=1000;

var zxcIB,zxcIT,zxcTO;
var zxcCnt=0;
var zxcLk;

var loadedfor5seconds=false;
var fadeOnceOnly=(function(i){
    return function(){
        if(loadedfor5seconds && 0<i--)
            zxcFadeLink('navHelper',null);};})(1);


function zxcFadeLink(obj,obj2){
document.Show.Show1.value=zxcLk;
 if (zxcLk){ return }
 zxcLk=true;
document.Show.Show2.value=zxcLk;
 zxcIB=document.getElementById(obj);
 zxcIT=document.getElementById(obj2);
 if (zxcIT){  zxcIT.style.visibility='visible'; }
 zxcFade();
}

function zxcFade(){
 zxcCnt+=zxcSpeed;
 if (zxcIB){ zxcOpacity(zxcIB,2-zxcCnt); }
 if (zxcIT){ zxcOpacity(zxcIT,zxcCnt);  }
 if (zxcCnt<2){ zxcTO=setTimeout("zxcFade()",2); }
 else {
  if (zxcIB){ zxcOpacity(zxcIB,0);  }
  if (zxcIT){ zxcOpacity(zxcIT,100);  }
  zxcLk=false;
  zxcCnt=0;

 }
}

function zxcOpacity(obj,op) {
 if (obj.style.MozOpacity!=null){ obj.style.MozOpacity=(op/100)-.001; }
 else if (obj.style.opacity!=null){ obj.style.opacity=(op/100)-.001; }
 else if (obj.style.filter!=null){ obj.style.filter = 'alpha(opacity='+op+')';   }
}


// New Code
var zxcTxtOffsetX=20;
var zxcTxtOffsetY=-20;


var zxcTxtObj,zxcWW,zxcWH,zxcWS,zxcTxtY;

function zxcWWHS(){
 if (document.all){
  zxcCur='hand';
  zxcWH=document.documentElement.clientHeight;
  zxcWW=document.documentElement.clientWidth;
  zxcWS=document.documentElement.scrollTop;
  if (zxcWH==0){
   zxcWS=document.body.scrollTop;
   zxcWH=document.body.clientHeight;
   zxcWW=document.body.clientWidth;
  }
  zxcTxtY=zxcWS;
 }
 else if (document.getElementById){
  zxcCur='pointer';
  zxcWH=window.innerHeight-15;
  zxcWW=window.innerWidth-15;
  zxcWS=window.pageYOffset;
  zxcTxtY=0;
 }
 zxcWC=Math.round(zxcWW/2);
 return [zxcWW,zxcWH,zxcWS];
}

function zxcMseOverTxt(id,evt){
 zxcTxtObj=document.getElementById('trail'+id+'');
 zxcWWHS();
 zxcMseMove(evt);
 document.onmousemove=function(event){zxcMseMove(event);}
 zxcIT=zxcTxtObj;
 zxcIB=null;
 zxcTxtObj.style.visibility='visible';
 zxcOpacity(zxcTxtObj,0);
 zxcFade();
 //zxcTxtObj.firstChild.data='';
}

function zxcMseOutTxt(id){
zxcTxtObj=document.getElementById('trail'+id+'');

  zxcTxtObj.style.visibility='hidden';


}

function zxcMseMove(event){
 if(!event) var event=window.event;
 if (document.all){ zxcMseX=event.clientX; zxcMseY=event.clientY; }
 else {zxcMseX=event.pageX; zxcMseY=event.pageY; }
 zxcTxtObj.style.left=(zxcMseX+zxcTxtOffsetX)+'px';
 zxcTxtObj.style.top=(zxcMseY+zxcTxtOffsetY+zxcTxtY)+'px';
}

function show_file(id,type)
{
		if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}//fin if
		else
		{
		    //Mozilla
			var XhrObj = new XMLHttpRequest();
		}//fin else

		//définition de l'endroit d'affichage:
		//document.frames("load").document.getElementById("currentfolder").value=rep;
		
		      var content = document.getElementById("show_file");
		      
		
		     content.innerHTML = '<img src="./components/gallery/images/load.gif" />' ;
		
	
	XhrObj.open("GET",'./components/gallery/dyna_file.php?id='+id+'&type='+type+'&d='+ (new Date()).getTime(), true);

    XhrObj.send(null);


		//Ok pour la page cible
		XhrObj.onreadystatechange = function()
		{
			
			
			
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				content.innerHTML = XhrObj.responseText ;
			
		}
		
}


function vote_over(id)
{
	document.getElementById(id).innerHTML='<img src="./components/gallery/images/act_star.png" border="0" onClick="session();" >';
}

function vote_out(id)
{
	document.getElementById(id).innerHTML='<img src="./components/gallery/images/des_act_star.png" border="0" onClick="session();" >';
}
function session()
{
alert("vous devez etre connectez pour votez");	
}

function vote(id_file,id_user,rate)
{
 //alert(id_file);
 
 //alert(id_user);
//alert(rate);
 
 	if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}//fin if
		else
		{
		    //Mozilla
			var XhrObj = new XMLHttpRequest();
		}//fin else

		//définition de l'endroit d'affichage:
		//document.frames("load").document.getElementById("currentfolder").value=rep;
		
		      var content = document.getElementById("envoyer");
		      
		     content.innerHTML = '<img src="./components/gallery/images/load.gif" />' ;
		//setAttribute('',donnée)
		
	
	XhrObj.open("GET",'./components/gallery/dyna_rate.php?id_file='+id_file+'&id_user='+id_user+'&rate='+rate+'&d='+ (new Date()).getTime(), true);

    XhrObj.send(null);


		//Ok pour la page cible
		XhrObj.onreadystatechange = function()
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				//content.innerHTML = XhrObj.responseText ;
				alert(XhrObj.responseText);
		}
		//content.innerHTML = '<img src="./components/gallery/images/load.gif" />' ;
		//var type='images';
		//show_file(id_file,type);
		
}
/*function download(path)
{
   
alert(path);
 
 	if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}//fin if
		else
		{
		    //Mozilla
			var XhrObj = new XMLHttpRequest();
		}//fin else

		//définition de l'endroit d'affichage:
		//document.frames("load").document.getElementById("currentfolder").value=rep;
		
		      //var content = document.getElementById("show_file");
		      
		
		
		
	
	XhrObj.open("GET",'./components/gallery/download_img.php?path='+path+'&d='+ (new Date()).getTime(), true);

    XhrObj.send(null);


		//Ok pour la page cible
		XhrObj.onreadystatechange = function()
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				//content.innerHTML = XhrObj.responseText ;
				alert(XhrObj.responseText);
		}
		
}*/


////////////////////////////////////////////////////////////////////////////////////////////////////



isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function submit_comment(id_file,id_user)
{
  	//alert(id_file);
	//alert(id_user);
	if(document.getElementById("comment").value=='')
	{
	   alert("Vous devez saisir un commentaire");
	   return false;
	}
	else
	{
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		var cnt=document.getElementById("comment").value;

 
 	if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}//fin if
		else
		{
		    //Mozilla
			var XhrObj = new XMLHttpRequest();
		}//fin else

		//définition de l'endroit d'affichage:
		//document.frames("load").document.getElementById("currentfolder").value=rep;
		
		      //var content = document.getElementById("show_file");
		      
		
		
		
	
	XhrObj.open("GET",'./components/gallery/comment_img.php?id_file='+id_file+'&id_user='+id_user+'&cnt='+cnt+'&d='+ (new Date()).getTime(), true);

    XhrObj.send(null);


		//Ok pour la page cible
		XhrObj.onreadystatechange = function()
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				//content.innerHTML = XhrObj.responseText ;
				alert(XhrObj.responseText);
				document.getElementById('theLayer').style.visibility="hidden";
		}
		
		
		
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	}
	
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function list_all(id_file,type)

{

	
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		var cnt=document.getElementById("comment").value;

 
 	if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}
		else
		{
		    
			var XhrObj = new XMLHttpRequest();
		}

		
		
		     var content = document.getElementById("show_file");
		      
		
		
		
	
	XhrObj.open("GET",'./components/gallery/all_comment.php?id='+id_file+'&type='+type+'&d='+ (new Date()).getTime(), true);

    XhrObj.send(null);


		//Ok pour la page cible
		XhrObj.onreadystatechange = function()
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				content.innerHTML = XhrObj.responseText ;
				//alert(XhrObj.responseText);
				
		}
		
	
}

