/*
	$imgPath[]=$photo1_s;
	$imgName[]=addSlashes($description);


if(!empty($imgPath)){
		$imgList=implode('","',$imgPath);
}
if(!empty($imgName)){
		$imgName=implode('","',$imgName);
}


<script>
var imgList=new Array("<?=$imgList?>");
var imgName=new Array("<?=$imgName?>");
</script>
<script src="fade.js"></script>


*/
  function FadeEffect(element){
          
       new Effect.Opacity(element, { from: 1.0, to: 0, duration: 0.5 });


   }
   function ShowEffect(element){
       
       
        new Effect.Opacity(element, { from: 0, to: 1.0, duration: 0.5 });
   }





var currentIndex=0;

function $(id){
	return document.getElementById(id);
}

function funPrev(){
	if(currentIndex>0){
	$('next').style.display="";
	currentIndex--;
	funChangeImg();
	}
	
	if(currentIndex==0){
		$('next').style.display="";
		$('prev').style.display="none";
		if($('eye')){
		$('eye').style.background = 'url(images/col_eye_bg.jpg)';
		}
	}


}

function funNext(){



	if(currentIndex<imgList.length-1){
	$('prev').style.display="";
	currentIndex++;
	funChangeImg();
	}
	
	if(currentIndex==imgList.length-1){
		$('next').style.display="none";
		$('prev').style.display="";
	}
	
	


	
}

function funOpen(obj){
	var temp=obj.src;
	temp=temp.replace("/s_","/");
	window.open("view.php?img="+temp);

}
function funChangeImg(){


	// start preloading
	if(!$('empty')){
		obj = document.createElement('div');
		obj.id = 'empty';
		obj.style.display = 'none';
		document.body.appendChild(obj);
	}else{
		
	}		
	
     $('empty').innerHTML+=('<img style="height:80px;display:block" src="'+imgList[currentIndex+1]+'"/>');
	/* preloading */
	
	
	FadeEffect($("my_area"));


    if (document.images)
    {
      preload_image = new Image(25,25); 
      preload_image.src=imgList[currentIndex]; 
    }

	
	setTimeout(function(){
			
			$("img").innerHTML='<img onclick="funOpen(this)" style="cursor:pointer" src="'+imgList[currentIndex]+'">';
			$("description").innerHTML=" "+imgName[currentIndex]+" ";
			/*
		
			ShowEffect($("img_"+id));
			ShowEffect($("display_name_"+id));
			*/
			ShowEffect($("my_area"));
	
			
		
			
		
	},500);
}

