﻿
//checking the DOM for the proper HTML elements

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all){
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}


//the actual clipping occurs here

var clipLeft = 0;
var clipWidth = 890;
var clipTop = 00;
var clipBottom = 94;
var lefter = 15;
var lyrheight = 0;
var lyrwidth = 0;
var time,amount,theTime,theHeight,DHTML;

function filmstripInit(layername)
{
    if ($(layername) ){
	    DHTML = (document.getElementById || document.all || document.layers)
	    if (!DHTML) return;
	    var x = new getObj(layername);
	    if (document.layers)
	    {//ns 
		    lyrheight = x.style.clip.bottom;
		    lyrheight += 20;
		    x.style.clip.top = clipTop;
		    x.style.clip.left = clipLeft;
		    x.style.clip.right = clipWidth;
		    x.style.clip.bottom = clipBottom;
	    }
	    else if (document.getElementById || document.all)
	    {
    		
		    lyrwidth = x.obj.offsetWidth;
		    //alert(lyrwidth);
		    x.style.clip = 'rect('+clipTop+'px,'+(1* clipLeft)+(1*clipWidth)+'px,'+clipBottom+'px,' + clipLeft + 'px)';
	    }
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipLeft += amount;
	
	lefter -= amount;
	if (clipLeft < 0)
	{
	
		
        clipLeft += 2456;
		lefter -= 2456;
	}
	if (clipLeft > 2456)
	{
	
		
        clipLeft -= 2456;
		lefter += 2456;
	}
	var  clipRight = clipLeft + clipWidth;
	if (document.getElementById || document.all)
	{
	   
		clipstring = 'rect('+clipTop+'px,' + clipRight +'px,'+clipBottom+'px,' + clipLeft + 'px)';
		//window.status = clipstring;
		thelayer.style.clip = clipstring;
		thelayer.style.left = lefter + 'px';
		//alert(clipstring);
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}





