    var numButtons = 0;
    var sliderImage;
    var imageLeft = 0;
    var sectionWidth = 900
    var startLeft = 0;
	var autoPlayInterval;
	var mainNavDivObj;
	var t;
	//Set to 10 seconds origionallly. This is probably too long.
	var inactiveTime = 3000;
	
    
	
	include('/genJS/tween.js');
	addEventHandler(window, 'load', loadSlider, false)
	
    function loadSlider() {
        t = new Tween();
        iniSlider();
        openingTween();
		autoPlayInterval = setInterval(autoNav, inactiveTime)
    }

    function iniSlider()
    {

        //sliderID is defined on default.aspx so we can get clientID from asp
        sliderImage = document.getElementById(sliderID);  
        var buttonObj
		mainNavDivObj = getMainNavDivObj();

		var navImageObjects = mainNavDivObj.getElementsByTagName('img');

		for (var i = 0;i<navImageObjects.length;i++)
		{
			numButtons += 1;
            buttonObj = navImageObjects[i];
			//each button knows where the navImage should end up when over the button
            buttonObj.imageLeft = i*sectionWidth*-1;
			addEventHandler(buttonObj, 'mouseover', overButtonSlide, false);
		}

    }
    
	function openingTween() {
	    var openTween = new Tween(sliderImage.style, 'top', Tween.strongEaseInOut, 307, 0, 1, 'px');
	    openTween.onMotionFinished = openDone;
	    openTween.start();
    }

    //hook is there
    function openDone() {

    }
    
	//If the user is on the page for inactiveTime  without naving, move the nav for them
	function autoNav()
	{
		var startLeftForSlide = getLeft();	
		slideNav(startLeftForSlide - sectionWidth);
		//If we are fullly to the left, stop the auto play
		if (startLeftForSlide == sectionWidth*(numButtons-2)*-1)
			clearInterval(autoPlayInterval);
	}
	
	//Slide the nav from where it is now to where it should be. endLeft is where the left edge of the image should end up.
	//endLeft is almost always off the screen (-)
	function slideNav(endLeft)
	{
	    var startLeftForSlide = getLeft();	

        t.stop()
        t = new Tween(sliderImage.style, 'left', Tween.strongEaseInOut, parseInt(startLeftForSlide), endLeft, 1, 'px');
        t.start();
	}
	
    function overButtonSlide() {
		//We do not want auto play on once the user is in the menu themselves
		clearInterval(autoPlayInterval);
		//overImage is setup at page load
		slideNav(this.imageLeft);
    }

    function getLeft() {
	    //If the image has no style.left defined, it is 0 (If it is defined in css style.left may be undefined.
	    if (!sliderImage.style.left)
	        return 0;
		return parseInt(sliderImage.style.left.substring(0, sliderImage.style.left.length - 2));
	}

	

    
