 
// SLIDER START  

// Browser Check
iens6 = document.all || document.getElementById;
ns4 = document.layers;
	      
var scrollspeed = 1;
var autospeed = 4000;
		  
var step = 8;
var stoplength = 0;
var stoplengthback = 0;
var contentobj;
var contentheight;
var theobj;
var thewidth;
var thename;
var thecontainer;
var timerup;
var timerdown;
var timerupname;
var timerdownname;
var autoright;
var autoleft;
      
function director(theFunction, size) 
{
	stopall();
	theobj = "contentobj";
	thewidth = "contentheight";
	if (iens6) 
	{
		theobj = document.getElementById ? document.getElementById("content") : document.all.content;
		thewidth = theobj.offsetWidth;
		if (document.getElementById && !document.all) {
			step = 8;
		}
	} 
	else if (ns4) 
	{
		thename = "nscontent";
		thecontainer = "nscontainer";
		theobj = eval("document." + thecontainer + ".document." + thename);
		thewidth = theobj.clip.width;
	}
		   	
	if (theFunction == "sd") 
	{
		timerdown = "window.down";
		timerdownname = "down";
		scrollleft(size);
	} 
	else if (theFunction == "su") 
	{
		timerup = "window.up";
		timerupname = "up";
		scrollright();
	} 
}

function hello()
{
	timerdown = "window.down";
	timerdownname = "down";
	autoleft = setInterval("scrollleft(3)", autospeed);
}

// scroll down function
function scrollleft(BannerSize) 
{
	if (stoplengthback == 0) {
		if (iens6 && parseInt(theobj.style.left) > (thewidth * (-1) + 460) && stoplength < movieboxlength) {
			theobj.style.left = parseInt(theobj.style.left) - step;
			stoplength++;
			
			if (BannerSize == 3) {
				if (parseInt(theobj.style.left) == -800) {
					document.getElementById("rightArrow").innerHTML = "&nbsp;";
				}
				else {
					document.getElementById("rightArrow").innerHTML = "&gt;&nbsp;";
				}
			} else {
				if (parseInt(theobj.style.left) == -480) {
					document.getElementById("rightArrow").innerHTML = "&nbsp;";
				}
				else {
					document.getElementById("rightArrow").innerHTML = "&gt;&nbsp;";
				}
			}
			document.getElementById("leftArrow").innerHTML = "&nbsp;&lt;";
		} 
		else if (ns4 && theobj.left > (thewidth * (-1) + 460) && stoplength < movieboxlength) {
			theobj.left -= step;
			stoplength++;
		}
	
		if (BannerSize == 3) {
			timerdownname = setTimeout("scrollleft(3)", scrollspeed);
		}
		else {
			timerdownname = setTimeout("scrollleft(4)", scrollspeed);
		}
		
		if (stoplength == movieboxlength) {
			stopall();
			stoplength = 0;
		}
	}
	else {
		scrollright();
	}
	if (parseInt(theobj.style.left) <= (thewidth * (-1) + 460)) {
		timerup = "window.up";
		timerupname = "up";
		stopauto();
		autoright = setInterval("scrollright()", autospeed); 
	}
}
   
	
// scroll up function
function scrollright() 
{
	if (stoplength == 0) {
		if (iens6 && parseInt(theobj.style.left) < 0 && stoplength < movieboxlength) {
			theobj.style.left = parseInt(theobj.style.left) + step;
			stoplengthback++;
				
			if (theobj.style.left == "0px") {
				document.getElementById("leftArrow").innerHTML = "&nbsp;";
			}
			else {
				document.getElementById("leftArrow").innerHTML = "&nbsp;&lt;";
			}
			document.getElementById("rightArrow").innerHTML = "&gt;&nbsp;";
		}
		else if (ns4 && theobj.left < 0 && stoplength < movieboxlength) { 
			theobj.left += step;
			stoplengthback++;	 
		}
			
		timerupname = setTimeout("scrollright()", scrollspeed);
			
		if (stoplengthback == movieboxlength) {
			stopall();
			stoplengthback = 0;
		}
	}
	else {
		scrollleft();
	}
	
	if (parseInt(theobj.style.left) >= 0) {
		timerdown = "window.down";
		timerdownname = "down";
		stopauto();
		autoleft = setInterval("scrollleft(3)", autospeed);
	}
}
   
function enableArrows()
{
	document.getElementById("leftArrow").style.visibility = "visible";
	document.getElementById("leftArrowBack").style.visibility = "visible";
	document.getElementById("rightArrow").style.visibility = "visible";
	document.getElementById("rightArrowBack").style.visibility = "visible";
}

function disableArrows()
{
	document.getElementById("leftArrow").style.visibility = "hidden";
	document.getElementById("leftArrowBack").style.visibility = "hidden";
	document.getElementById("rightArrow").style.visibility = "hidden";
	document.getElementById("rightArrowBack").style.visibility = "hidden";
}

// function to stop all scroll timers
function stopall() 
{
	if (timerup) {
		clearTimeout(timerupname);
	}
	if (timerdown) {
		clearTimeout(timerdownname);
	}
}

function stopauto()
{
	if (autoright) {
		clearInterval(autoright);
	}
	if (autoleft) {
		clearInterval(autoleft);
	}
}

// SLIDE SHOW START 

var curcontentindex = 0;
var intervalID;
var timerInterval = 15000;
var slides = new Array();
	   
if (document.all || document.getElementById)
{  
	document.write('<style type="text/css">\n')
	document.write('.dyncontent{display: none; width: 460px; height: 180px;}\n')
	document.write('</style>')
}
      
function getElementByClass(classname)
{
	var inc = 0;
	var alltags = document.all ? document.all : document.getElementsByTagName("*");
	for (i = 0; i < alltags.length; i++) 
	{
		if (alltags[i].className==classname) 
		{
			slides[inc++] = alltags[i];
		}
	}
}
	   
function DoBoxes(prev, next)
{
	var prevBox = document.getElementById(prev);
	prevBox.className = "OffBox";
	var nextBox = document.getElementById(next);
	nextBox.className = "ActiveBox";
}
	
function Highlight(i) {
	if (curcontentindex == i) {
		var nextBox = document.getElementById(i);
		nextBox.className = "ActiveBox";
	}
}

function GotoRandomIndex(qty){
	var r = Math.floor(Math.random()*qty);
	GotoIndex(r);
}

function GotoIndex(i)
{			
	slides[curcontentindex].style.display = "none"; 
	slides[i].style.display = "block";
	DoBoxes(curcontentindex, i);
	curcontentindex = i;
	clearInterval(intervalID);
	intervalID = setInterval("NextSlide()", timerInterval)
}
			 
function PrevSlide()
{
	curcontentindex = (curcontentindex == 0) ? slides.length - 1 : curcontentindex - 1;
	prevcontentindex = (curcontentindex < slides.length - 1) ? curcontentindex + 1 : 0;
	slides[prevcontentindex].style.display = "none"; 
	slides[curcontentindex].style.display = "block";
	DoBoxes(prevcontentindex, curcontentindex);
}
	      
function NextSlide()
{	
	curcontentindex = (curcontentindex < slides.length - 1) ? curcontentindex + 1 : 0;
	prevcontentindex = (curcontentindex == 0) ? slides.length - 1 : curcontentindex - 1;
	slides[prevcontentindex].style.display = "none"; 
	slides[curcontentindex].style.display = "block"; 
	DoBoxes(prevcontentindex, curcontentindex);
}

function StopRotate()
{
	clearInterval(intervalID);
}

function StartRotate()
{
	intervalID = setInterval("NextSlide()", timerInterval)
}
