function Hover(obj, isPop)
{
	Out();

	var left=document.getElementById('l1');
	var right=document.getElementById('r1');
	var bleft=document.getElementById('lb1');
	var bright=document.getElementById('rb1');

	bleft.style.marginTop=60;
	bright.style.marginTop=60;

	var width=0;
	var cur=obj.previousSibling;
	if(Defined(cur)&&cur.nodeType==3)cur=cur.previousSibling;
	while(Defined(cur))
	{
		width+=cur.offsetWidth;
		cur=cur.previousSibling;
		if(Defined(cur)&&cur.nodeType==3)cur=cur.previousSibling;
	}

	left.style.marginLeft=width;
	left.style.display="block";
	if(!isPop)
	{
		bleft.style.marginLeft=width;
		bleft.style.display="block";
	}

	right.style.marginLeft=width+obj.offsetWidth-4;
	right.style.display="block";
	if(!isPop)
	{
		bright.style.marginLeft=width+obj.offsetWidth-4;
		bright.style.display="block";
	}
}
function Out()
{
	document.getElementById('l1').style.display="none";
	document.getElementById('r1').style.display="none";
	document.getElementById('lb1').style.display="none";
	document.getElementById('rb1').style.display="none";
}

var animation=false;
var fps=100;
function StartScrollAnimation(begin, end)
{
	animation=true;
	var time=200, frms=Math.ceil(time/1000*fps), delta=(end-begin)/frms;
	for(var i=0, tmout=0; i<frms; i++, tmout+=1000/fps, begin+=delta)setTimeout('document.getElementById("gallery").scrollLeft='+begin, tmout);
	setTimeout('animation=false; document.getElementById("gallery").scrollLeft='+end+'; InstallScrollBars();', tmout);
}
function DoScroll(direct)
{
	if(!animation)
	{
		var el=document.getElementById("gallery");
		var delt=168+12;
		StartScrollAnimation(el.scrollLeft, el.scrollLeft+delt*direct);
	}
}
function ScrollDown()
{
	DoScroll(1);
}
function ScrollUp()
{
	DoScroll(-1);
}
function InstallScrollBars()
{
	var el=document.getElementById("gallery");
	if(Defined(el))
	{
		if(el.scrollLeft)document.getElementById("scrollup").style.visibility="visible";
		else document.getElementById("scrollup").style.visibility="hidden";

		if(el.scrollWidth>el.offsetWidth&&(el.scrollLeft+el.offsetWidth!=el.scrollWidth))document.getElementById("scrolldown").style.visibility="visible";
		else document.getElementById("scrolldown").style.visibility="hidden";
	}
}
if(isIE)
{
	document.write('<style>div.menu a { height:100%; } a.button { padding-top:0px; padding-bottom:0px; } a.button img {margin-bottom:-2px} </style>');
}
if(isOpera)
{
	document.getElementById("correction").innerHTML='div.grey b, div.blue b { padding-top:3px; padding-bottom:4px; } a.button img {margin-bottom:-1px;}';
}
if(isFirefox)
{
	document.getElementById("correction").innerHTML='div.grey b, div.blue b { padding-top:2px; padding-bottom:5px; }';
}
if(isSafari)
{
	document.write('<style>div.grey b, div.blue b { padding-top:3px; padding-bottom:5px; }</style>');
}
