var exected=false, duration=700, duration2=400, fps=100;
function Animate()
{
	if(exected)return;
	exected=true;
	
	var img=document.getElementById("ani");
	img.style.left=-1000;
	img.style.display="block";
	img.style.left=-img.offsetWidth;

	var width=parseInt(img.offsetWidth), timestep=parseFloat(1000*fps)/duration, delta=width/timestep, timedelta=duration/timestep;
	for(var i=0, j=(width-delta); i<timestep; i++, j-=delta)
	{
		var exp='document.getElementById("ani").style.left=-'+Math.round(j);
		setTimeout(exp, i*timedelta);
	}
	setTimeout('document.getElementById("ani").style.left=0', duration);
}
var animtns={};
function Animate2(img)
{
	if(animtns[img.id]==true)return;
	animtns[img.id]=true;
	
	img.style.display="block";

	var width=img.offsetWidth, width2=3*width, timestep=parseFloat(1000*fps)/duration, timedelta=duration/timestep, delta=(width2-width)/timestep;
	img.width=width2;
	for(var i=0, j=(width2-delta); i<timestep; i++, j-=delta)
	{
		var exp='document.getElementById("'+img.id+'").width='+Math.round(j);
		setTimeout(exp, i*timedelta);
	}
	setTimeout('document.getElementById("'+img.id+'").width='+width+';animtns["'+img.id+'"]=false;', duration);
}
function Animate3(id)
{
	if(animtns[id]==true)return;
	animtns[id]=true;

	img=document.getElementById(id);

	var width=img.offsetWidth, width2=3*width, timestep=parseFloat(1000*fps)/duration2, timedelta=duration2/timestep, delta=(width2-width)/timestep;
	img.width=width2;
	for(var i=0, j=width+delta; i<Math.round(timestep/2); i++, j+=delta)
	{
		var exp='document.getElementById("'+img.id+'").width='+Math.round(j);
		setTimeout(exp, i*timedelta);
	}
	for(; i<timestep; i++, j-=delta)
	{
		var exp='document.getElementById("'+img.id+'").width='+Math.round(j);
		setTimeout(exp, i*timedelta);
	}
	setTimeout('document.getElementById("'+img.id+'").width='+width+';animtns["'+img.id+'"]=false;', duration2);
}


var animation=false;
function StartScrollAnimation(begin, end, id)
{
	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("'+id+'").scrollLeft='+begin, tmout);
	setTimeout('animation=false; document.getElementById("'+id+'").scrollLeft='+end+'; InstallScrollBars("'+id+'");', tmout);
}
function DoScroll(direct, id)
{
	if(!animation)
	{
		var el=document.getElementById(id);
		var delt=152;
		StartScrollAnimation(el.scrollLeft, el.scrollLeft+delt*direct, id);
	}
}
function ScrollDown(id)
{
	DoScroll(1, id);
}
function ScrollUp(id)
{
	DoScroll(-1, id);
}
function InstallScrollBars(id)
{
	var el=document.getElementById(id);
	if(Defined(el))
	{
		if(el.style.width=='')
		{
			el.style.width=el.parentNode.offsetWidth;
			el.style.display="block";
		}
		
		if(el.scrollLeft)document.getElementById(id+"_scrollup").style.visibility="visible";
		else document.getElementById(id+"_scrollup").style.visibility="hidden";

		if(el.scrollWidth>el.offsetWidth&&(el.scrollLeft+el.offsetWidth!=el.scrollWidth))document.getElementById(id+"_scrolldown").style.visibility="visible";
		else document.getElementById(id+"_scrolldown").style.visibility="hidden";
	}
}