var galtopfest = 465;
if (window.ie) galtopfest = 200;


doclhook[doclhook.length] = function()
{
	$(document.body).addEvent("click",function()
	{
		if(nimg)closeFullpic();
	}
	);
};


	function bilgal_showImg(imgid)
	{
		if(current == imgid)return;
		
		$("bilgala_"+current).toggleClass("active");
		$("bilgala_"+imgid).toggleClass("active");
		
		$("bilgal_diz_"+current).setStyle("display","none");
		$("bilgal_diz_"+imgid).setStyle("display","block");
		
		$("medimg").setStyle("background","url("+images[imgid]['medium']+")");
		
		current = imgid;
	}
	
	function bilgal_showFull()
	{

		var mycoords = $("zoombtn").getCoordinates();
		var doccoords = $("body").getCoordinates();
		if(window.ie)var iecoords = $(document.body).getCoordinates();
		concoords = $("content").getCoordinates();

		var myBox = new Element("div",{"id":"zoombox","styles":
			{'position':'absolute',
			'top':window.ie?mycoords.top:parseInt(mycoords.top - concoords.top),
			'left':window.ie?mycoords.left - iecoords.left:parseInt(mycoords.left - concoords.left),
			'height':23,
			'width':23,
			'background':"#000",
			'opacity':0.5}
		});

						if(window.ie)
						{
							$(document.body).appendChild(myBox);
							var iecoords = $(document.body).getCoordinates();
							var Eleft = (iecoords.width - 640) / 2;
							var Etop = 250;
						}
						else
						{
							$('content').appendChild(myBox);
							var Eleft = -42;
							var Etop = -20;
						}
						
		Etop = mycoords.top - galtopfest;	
		
		myBox.effects({duration:500,onComplete:function(){
			
			$("zoombox").appendChild(new Element("a",{'id':'zb-cbtn','href':'javascript:closeFullpic()','styles':{
					color:'#fff',
					textDecoration:'none'
					
				}}).appendText(closelabel));
			
			}}).start({
			'left':Eleft,
			'width':640,
			'height':480,
			'top':Etop
			
			});		
		
		setTimeout("bilgal_loadFullPic()",600);
	}
	

function bilgal_loadFullPic()
{
		nimg = new Asset.image(images[current]['full'], {id: 'newImage', title: 'myImage', onload: function()
			{
				
				var doccoords = $("body").getCoordinates();
	
				if(window.ie)var iecoords = $(document.body).getCoordinates();
				
				//


				// Julian
				var mycoords = $("zoombtn").getCoordinates();
				Etop = mycoords.top - galtopfest;	
				/////////
				
				
				
				$("zoombox").effects({duration:500,onComplete : function()
					{
						
						if(window.ie)var iecoords = $(document.body).getCoordinates();





						
						nimg.setStyles({
								'position':'absolute',
								'left':(window.ie? ((parseInt(iecoords.width) - parseInt(nimg.width)) / 2) : (-42 + ((640 - parseInt(nimg.width)) / 2))) ,
								//'top':window.ie?270:0
								'top':Etop
							});
						
						if(window.ie)
						{
							$(document.body).appendChild(nimg);
							
						}
						else
						{
							$('content').appendChild(nimg);
						}
					}
				
						
					}).start({
					'left':window.ie?((iecoords.width - nimg.width) / 2):(-42 + ((640 - nimg.width) / 2)),
					'width':this.width,
					'height':this.height + 20,
					//'top':window.ie?250:-20
					'top':Etop	
					});
			}});
}
	
	function closeFullpic()
	{
		nimg = false;
		if($("newImage"))$("newImage").remove();
		if($("zoombox"))$("zoombox").remove();
	}
	
	
	function bilgal_nextslide()
	{
		if(currentslide < slides-1)
		{
			currentslide++;
			$("blockcontainer").effects({duration:500}).start({'left':currentslide * -188});
			
			if(currentslide == slides - 1)$("bilgal_nslide").setStyle("display","none");
			
			$("bilgal_pslide").setStyle("display","block");
		}
		else
		{
			
		}
	}
	
	function bilgal_prevslide()
	{
		if(currentslide > 0)
		{
			currentslide--;
			$("blockcontainer").effects({duration:500}).start({'left':currentslide * -188});
			if(currentslide == 0)$("bilgal_pslide").setStyle("display","none");
			
			$("bilgal_nslide").setStyle("display","block");
		}
		else
		{
			
		}
	}