// JavaScript Document
var access=false;
function show(id)
{
	closeAllsub();
	if(document.getElementById(id))
	{
		document.getElementById(id).style.display='block';
		//ChangeClass(document.getElementById('m1'),"m1_sel");
		access=false;
	}
}
function closeSubs()
{
	access=true;
}
function closeAllsub()
{
	for(var i=1;i<=4;i++)
	{
		if(document.getElementById('m'+i+'_s'))
		document.getElementById('m'+i+'_s').style.display='none';
	}
}
function subOver()
{
	access=false;
}
function subOut()
{
	access=true;
}
setInterval(closesubdeley,300);
function closesubdeley()
{
	if(access)
	for(var i=1;i<=4;i++)
	{
		if(document.getElementById('m'+i+'_s'))
		document.getElementById('m'+i+'_s').style.display='none';
		//ChangeClass(document.getElementById('m'+i),"m1");
	}
}
function ChangeClass(obj,cl)
{
	if(!obj.getAttribute("class"))
	{
			obj.className=cl;
	}
	else
	{
			obj.setAttribute("class",cl);
	}
}

















function ShowPopUp()
{
	var p=document.getElementById("pop");
	p.style.display='';
	var w=GetWidth();
	var h=GetHeight();
	p.style.left=(w/2-400)+"px";
	p.style.top=(50)+"px";
	window.scrollTo(0,0);
	window.onscroll=function() { window.scrollTo(0,0) }
	openImg();
}
function ClosePopUp()
{
	var p=document.getElementById("pop");
	p.style.display='none';	
	window.onscroll=function() {}
}
function Next()
{
	++imgsel;
	if(imgsel>ar.length-1)
	{
		--imgsel;
	}
	openImg()
}
function Previous()
{
	--imgsel;
	if(imgsel<0)
	{
		imgsel=0;
	}
	openImg()
}
function openImg()
{
	var img=document.getElementById("popImg");
	img.src='files/photo_galleries/big/'+gallery+'/'+ar[imgsel];
}
function GetHeight()
{
	var y = 0;
	if (self.innerHeight)
	{
			y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
			y = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
			y = document.body.clientHeight;
	}
	return y;
}
function GetWidth()
{
	var y = 0;
	if (self.innerWidth)
	{
			y = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
			y = document.documentElement.clientWidth;
	}
	else if (document.body)
	{
			y = document.body.clientWidth;
	}
	return y;
}



function searchLink(id)
{
	if(document.getElementById(id).value.length>3)
		window.location='index.php?page=3&s='+document.getElementById(id).value;
}

var y=0;
var Y=0;
setTimeout(moveNews,1000)
function moveNews()
{
	if(y>4)y=4;
	if(y<0)y=0;
	var YY=-y*120;
	Y+=(YY-Y)/5;
	document.getElementById("news").style.top=Y+"px";
	setTimeout(moveNews,30)
}
function UP()
{
	--y;
}
function DOWN()
{
	++y;
}