// JavaScript Document
var sel=-1;
var access=false;
function show(id)
{
	closeAllsub();
	if(document.getElementById(id))
	{
		document.getElementById(id).style.display='block';
		ChangeClass(document.getElementById(id.replace("_s","")),id.replace("_s","")+"_sel");
		ss=-1;
	}

	access=false;
}
function closeSubs()
{
	access=true;
}
function closeAllsub()
{
	for(var i=1;i<=10;i++)
	{
		if(document.getElementById('m'+i+'_s'))
		{
			document.getElementById('m'+i+'_s').style.display='none';
			ChangeClass(document.getElementById('m'+i),"m"+i);
		}
	}
}
function subOver()
{
	access=false;
}
function subOut()
{
	access=true;
}
var ss=-1;
setInterval(closesubdeley,300);
function closesubdeley()
{
	if(!access)return;
	for(var i=1;i<=10;i++)
	{
		if(document.getElementById('m'+i+'_s'))
		{
			document.getElementById('m'+i+'_s').style.display='none';
			ChangeClass(document.getElementById('m'+i),"m"+i);
		}
	}
	
	selectMenu()
}
function selectMenu()
{
	for(var i=1;i<=10;i++)
	{
		
		if(i==sel)
		{
			if(document.getElementById('m'+i+'_s'))
			{
				ChangeClass(document.getElementById('m'+i),"m"+i+"_sel");
				document.getElementById('m'+i+'_s').style.display='block';
			}
			
		}
	}
	
}
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=6&s='+document.getElementById(id).value;
}

function checkfloat(e)
{
	if(e.keyCode==190)return true;
	if(e.keyCode>=96&&e.keyCode<=106)return true;
	if(e.keyCode==35||e.keyCode==36||e.keyCode==37||e.keyCode==39||e.keyCode==8||e.keyCode==46||(e.keyCode>47&&e.keyCode<58))return true;
	else return false;
}
