//Rail Declarations
var upperwidth=170;
var upperindent=150;	//upper and lower indent are in the styles below
var lowerwidth=202;
var lowerleftindent=141;
var lowerrightindent=35;
var direction="ltr";	//ltr== left to right, rtl== right to left
var pause=2000;
var pauseat;	//where to pause on the left to right move
var step=7;
var speed=15;		//timeout milliseconds
var rightmost
var leftmost;	//rightmost is how far the left side of the object can travel

function SetUpRail(){
	var currpos=0;	//for laying down upper rail
	var upperpieces;
	var RailObj;
	var prestr='<div style="position: absolute; top: 0; left: '
	var poststr=';"><img src="pic/upperrail.gif"></div>';
	var textstring="";
	var count=0;
	var LowerObj=eval(doc+'["lowerrail"]'+sty);	//needs to be set for future reads
	GetScreenDimensions();
	upperpieces=parseInt((screen_width - upperindent)/upperwidth);
	if(((screen_width - upperindent)%upperwidth)>0)upperpieces++;
	RailObj=eval(doc+'["upperrail"]'+htm);
	for(count=0;count<upperpieces;count++){
		textstring+=prestr+currpos+poststr;
		currpos+=upperwidth;
	}
	if(is.ns){
		RailObj.write(textstring);
		RailObj.close();
	}else if(is.ie)RailObj.innerHTML=textstring;
	if(screen_width>(lowerwidth*2))pauseat=parseInt(screen_width/2-lowerwidth/2);
	else pauseat=0;
	leftmost=lowerleftindent;
	rightmost=screen_width-lowerrightindent-lowerwidth;
	LowerObj.left=lowerleftindent;
	setTimeout("AnimateRail();", pause);
}

function AnimateRail(){
//	alert("in animate");
	var RailObj=eval(doc+'["lowerrail"]'+sty);
	var currpos=parseInt(RailObj.left);
	var nextleft;
	var nexttimeout;
	if(direction=="ltr"){
		if((currpos+step)>=rightmost){
			nextleft=rightmost;
			direction="rtl";
			nexttimeout=pause;
		}else{
			nextleft=currpos+step;
			nexttimeout=speed;
		}
		if(currpos<pauseat&&(currpos+step)>=pauseat){
			nextleft=pauseat;
			nexttimeout=pause;
		}	//overides if is to pause

	}else {
		if((currpos-step)<=leftmost){
			nextleft=leftmost;
			direction="ltr";
			nexttimeout=pause;
		}else{
			nextleft=currpos-step;
			nexttimeout=speed;
		}
	}
	RailObj.left=nextleft;
	setTimeout("AnimateRail();", nexttimeout);
}



