//Scrolling IFRAME code

//3. global vars initialised for use by scrolling routine
var t1,t2,done,y=0;
var num_film_images=filmData.length;
var film_table_height=3500;
var wndo_height, orig_height, topmost_film_image_no, min_film_images;
var film_image_layers=new Array();
var inc = 1;
var timer = 20; // 
var dloop = true;

//4.function definitions

function getCntTop() {
	cntTop = (ns4||ns5)? parseInt(this.css.top): this.css.pixelTop;
	return cntTop;
}

function timeloop() {
	done=true;
	t2 = setTimeout("inchDown()",timer);
}

function inchDown() {
	if ((!done)) {
		return;
	}
	//dloop=false;
	if(parent.document.getElementById("filmstrip").clientHeight>orig_height) {
		initObjs();
		return;
	}
	var iframe=document.getElementById('film_iframe');
	if (y>0 && (y/(film_table_height))==Math.ceil(y/(film_table_height))) {
		film_image_layers[topmost_film_image_no-1].css.top=wndo_height+px;
		wndo_height+=film_table_height;
		topmost_film_image_no=(topmost_film_image_no==min_film_images) ? 1 : topmost_film_image_no+1;
	}
	y+=inc;
	if(ie4 || ie5) {
		iframe.contentWindow.document.body.scrollTop=y;
	} else {
		iframe.contentWindow.scrollTo(0,y);
	}
	inc = 1;
	timer = 20; // 
	t2 = setTimeout("inchDown()",timer);
}

function createObj(obj,nest) {
	var iframedoc=document.getElementById('film_iframe').contentWindow.document;
	this.el = (ns4)? (nest)? iframedoc.layers[nest].document.layers[obj]: iframedoc.layers[obj]: (ie4)? iframedoc.all[obj]: (ie5||ns5)? iframedoc.getElementById(obj): null;
	this.css = (ns4)? this.el: (ie4||ie5||ns5)? this.el.style: null;
	this.height = (ns4)? this.el.clip.height: (ie4||ie5)? this.el.clientHeight: (ns5)? this.el.offsetHeight: 0;
	this.getTop = getCntTop;
}

function initObjs() {
	topmost_film_image_no=1;
	if(mmIsOpera) {
		return false;
	} else {
		wndo_height=parent.document.getElementById("filmstrip").clientHeight;
		orig_height=wndo_height;
		//alert(document.getElementById("operaHide").style.height+","+orig_height);
		if(ns5 && document.getElementById("operaHide").style.height=="100%") document.getElementById("operaHide").style.height=(orig_height-22)+"px";
		min_film_images=Math.ceil(wndo_height/film_table_height)+1;
		min_film_images=(Math.ceil(min_film_images/num_film_images))*num_film_images;
		wndo_height=min_film_images*film_table_height;
		var html="<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td width='100%' height='100%'><DIV id=right style='position:absolute; top:0px; left:0px; width:100%; height:100%'>";
		var film_image=0;
		for(i=0;i<min_film_images;i++) {
			html+="<div id='film_"+(i+1)+"' style='position:absolute; top:1px; left:0px'>";
			html+="<table width='0' border='0' cellpadding='0' cellspacing='0'><tr><td width='0' rowspan='3' valign='top' background='../images/sprocket.gif'><img src='../images/sprocket.gif' width='13' height='8'></td><td height='0' valign='top' background='../images/sprocket_bg.gif'><img src='../images/sprocket_bg.gif' width='1' height='4'></td><td width='0' rowspan='3' valign='top' background='../images/sprocket.gif'><img src='../images/sprocket.gif' width='13' height='8'></td></tr><tr><td width='137' valign='top'>";
			html+="<a href='"+filmData[film_image].url+"' target='_top'><img src='"+filmData[film_image].image+"' width='137' height='80' border='0' onMouseOver=javascript:parent.done=false; onMouseOut=javascript:parent.done=true;parent.inchDown();></a>";
			html+="</td></tr><tr><td height='12' bgcolor='#DEDBCA' style='font-family:Arial,Helvetica,sans-serif;font-weight:bolder;font-size:9px;color:#000000;'>"+filmData[film_image].title+" ["+filmData[film_image].rating+"]</td></tr></table></div>";
			film_image=(film_image==(num_film_images-1)) ? 0 : film_image+1;
		}
		html+="</td></tr></table>";
		var iframe=document.getElementById('film_iframe');
		//iframe.src.replace("/filmstrip/blank.asp");
		iframe.src="/filmstrip/blank.asp";

		//S("blank.asp");
		iframe.contentWindow.document.close();
		iframe.contentWindow.document.write(html);
		iframe.contentWindow.document.close();
		y=0;
		for(i=0;i<min_film_images;i++) {
			film_image_layers[i]=new createObj('film_'+(i+1));
			film_image_layers[i].css.top=(i*film_table_height) + px;
		}
		resetLoop();
	}
}

function resetLoop() {
	done = false;
	if(mmIsOpera || nspre7 || iepre55) return false;
	inc = 1;
	timer=40;
	var t2 = setTimeout("timeloop()",timer);
}

//window.onload = load_IFRAME;