// JavaScript Document

var browser=navigator.appName;
var version=navigator.appVersion;

var IntervalId = 0;
var i=1;
var picName="";
var op=0.1;
var SmallIntervalId=0;
maxnb=FilmArray.length;
	
if(maxnb>12) {maxnb=12}
function init()
{

	IntervalId=setInterval('rotation()', 9000);
}

function rotation()
{	if(i>maxnb)
	{i=1;
	deselectPic(maxnb);
	}

	selectPic(i);	
	deselectPic(i-1);
	i++;
	
}


function mouseOver(j)
{	deselectPic(i);
	deselectPic(i-1);
	selectPic(j,i);
	i=j;
	clearInterval(IntervalId);
	
}

function selectPic(j,i)
{	op=0;
	
	//alert(maxnb);
	document.getElementById("num"+j).src="images/red"+j+".jpg?c=3";
	document.getElementById("nowShowingDiv").style.backgroundImage ="url("+FilmArray[j-2]+")";
	document.getElementById("nowShowing").src=FilmArray[j-1];
	
	//alert(FilmArray[j-2]);
	SmallIntervalId=setInterval("fade("+j+")", 55);
	//document.getElementById("nowShowingDiv").style.backgroundImage = "url("+FilmArray[i-1]+")";
}
function fade(j)
{	

	if(browser=="Microsoft Internet Explorer"){
			//document.getElementById("nowShowingDiv").style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity='+op*100+')' ;
			document.getElementById("nowShowing").style.filter='progid:DXImageTransform.Microsoft.Alpha( style=0,opacity='+op*100+')' ;
	}else{
			document.getElementById("nowShowing").style.opacity= op ;
			//document.getElementById("nowShowingDiv").style.opacity= op ;
	}
	//alert(op);
		op=op + 0.01;
		if (op >= 1){
			//op=0;
			//clearInterval(SmallIntervalId);
			//alert(FilmArray[j-2])
			
			//alert('roger')
			//;
		} 
}

function deselectPic(j)
{	if (j==0 || j > maxnb)
		{
		return;
		}
	document.getElementById("num"+j).src="images/grey"+j+".jpg";

}
function mouseOut()
{   
	IntervalId=setInterval('rotation()', 3000);
}

function fadeIn(){
	document.getElementById("nowShowing").className='greyStyle';
	}
function greyStylenone(){
	document.getElementById("nowShowing").className='greyStylenone';
	}	