var isIE = /msie|MSIE/.test(navigator.userAgent);

function FadeOut()
{
cc=0;
document.getElementById('p'+cur).style.display='block';
var xx=document.getElementById('p'+opac).style.opacity;
var yy=document.getElementById('p'+cur).style.opacity;
if(xx>0) { xx=xx-0.02; yy=1-xx; }
else xx=0;
document.getElementById('p'+opac).style.opacity=xx;
document.getElementById('p'+cur).style.opacity=yy;

if(isIE) { document.getElementById('p'+opac).style.filter = "alpha(opacity=" + parseInt(xx*100) + ")"; document.getElementById('p'+cur).style.filter = "alpha(opacity=" + parseInt(yy*100) + ")"; }
//alert(xx+'-'+yy);
if(xx>0) setTimeout("FadeOut()",10);
else Gallery(max);
}

function Gallery(max)
{
for(i=0;i<=max;i++) document.getElementById('p'+i).style.display='none';
document.getElementById('p'+cur).style.display='block';
document.getElementById('title').innerHTML=name[cur];
for(i=0;i<=max;i++) document.getElementById('t'+i).className='opac';
document.getElementById('t'+cur).className='nonopac';
opac=cur;
document.getElementById('thumbs').scrollLeft=(80*(cur-1));

if(cur>0)
	{
	document.getElementById('leftar').src='images/left.png';
	document.getElementById('leftar').style.cursor='pointer';
	document.getElementById('leftar').onclick=new Function("if(ok) { cur=cur-1;ok=0;FadeOut(); }");
	}
else
	{
	document.getElementById('leftar').src='images/left.png';
	document.getElementById('leftar').style.cursor='default';
	document.getElementById('leftar').onclick="";
	}
if(cur<max)
	{
	document.getElementById('rightar').src='images/right.png';
	document.getElementById('rightar').style.cursor='pointer';
	document.getElementById('rightar').onclick=new Function("if(ok) { cur=cur+1;ok=0;FadeOut(); }");
	}
else
	{
	document.getElementById('rightar').src='images/right.png';
	document.getElementById('rightar').style.cursor='default';
	document.getElementById('rightar').onclick="";
	}
ok=1;
}
