var uloop=true;
var dloop=true;
function Is() {
    agent  = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
                 ((agent.indexOf('spoofer')   ==   -1) &&
                 (agent.indexOf('compatible') ==   -1)));
    this.ns2   = (this.ns && (this.major      ==    3));
    this.ns3   = (this.ns && (this.major      ==    3));
    this.ns4b  = (this.ns && (this.major      ==    4) &&
                 (this.minor                  <= 4.03));
    this.ns4   = (this.ns && (this.major      >=    4));
    this.ns6    = (this.ns && (this.major     >=    5));
    this.ie    = (agent.indexOf("msie")       !=   -1);
    this.ie3   = (this.ie && (this.major      <     4));
    this.ie4   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   ==   -1));
    this.ie5   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   !=   -1));
    this.ie55  = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.5")   !=   -1));
}

var is = new Is();
if(is.ns4) {
    doc = "document.all['";
    sty = "'].style";
    htm = ""
    xpos = "e.pageX";
    ypos = "e.pageY";
} else if(is.ie4 || is.ie5) {
    doc = "document.all['";
    sty = "'].style";
    htm = ""
    xpos = "event.x";
    ypos = "event.y";
}
function movelayer(nsn,loc)
{
	lyr1Obj = eval(doc + nsn + sty);
	lyr1Obj.left = loc;
}

function noScroll() {
	if (dloop) dloop=false;
	if (uloop) uloop=false;
}

function check()
{
	if (!dloop) dloop=true;
	if (!uloop) uloop=true;	
}

function fade() {
	noScroll();
	//setTimeout("check()", 103);
	//setTimeout("alert('103')", 103);
	
	//setTimeout("scroll('WhatsOnGuide',-1,-800)", 105);
	//setTimeout("alert('105')", 105);
	//alert('');
}

function unfade() {
	noScroll();
	//setTimeout("check()", 103);
	//setTimeout("alert('103')", 103);
	
	//setTimeout("scroll('WhatsOnGuide',3,0)", 105);
	//setTimeout("alert('105')", 105);
	//alert('');
}
function scroll(obj,step,pos) {
	//alert(pos);
	lyr1Obj = eval(doc + obj + sty);
	var x_pos1 = parseInt(lyr1Obj.left);
	//alert('x_pos1 : ' + x_pos1 + ' pos : ' + pos + ' step : ' + step);
	if (step>0) {
		if(x_pos1+step < pos) {
			//alert('1');	
			lyr1Obj.left = x_pos1+step;
			if (uloop) 
{dloop=false;setTimeout("scroll('"+obj+"',"+step+","+pos+")", 100);}
		}else{
			//alert('2');
			lyr1Obj.left = pos;
			fade();
/*
			step=-1*step;
			if (pos==0){
				pos=-1567;
			}else{
				pos=0;
			}
			check();			
			if (uloop) 
{dloop=false;setTimeout("scroll('"+obj+"',"+step+","+pos+")", 200);}
			//alert('2__x_pos1 : ' + x_pos1 + ' pos : ' + pos + ' step : ' + 
step);
*/			
		}
	}
	if (step<0) {
		if(x_pos1+step > pos) {
			//alert('3');
			lyr1Obj.left = x_pos1+step;
			if (uloop) 
{dloop=false;setTimeout("scroll('"+obj+"',"+step+","+pos+")", 100);}
		}else{
			//alert('4');
			lyr1Obj.left = pos;
			unfade();
/*
			step=-1*step;
			if (pos==0){
				pos=-1567;
			}else{
				pos=0;
			}			
			check();
			if (uloop) 
{dloop=false;setTimeout("scroll('"+obj+"',"+step+","+pos+")", 200);}
			//alert('4__x_pos1 : ' + x_pos1 + ' pos : ' + pos + ' step : ' + 
step);
*/			
		}
	}
}
