var started=0;
var Id=0;
var counter = 0;
var startpos = 0;
var pixpermotion = 0;
var speed = 0; //120 is max, 1 is min.


function startBar(isSliding, width, slideheight, pixelpermotion, spd)
{
	startpos = slideheight;
	pixpermotion = pixelpermotion;
	speed = spd;
	
	//check to see if the object exists, if not, exit!
	var obj = document.getElementById("jrbar")
	if(typeof obj == "undefined" || obj == null)
	{
		return;
	}
	
	
	if(document.layers)
	{
		document.jrbar.width = width + " px";
	}
	else
	{
		document.getElementById("jrbar").style.width = width + " px";	
	}
	
	

if(isSliding)
{

	if(!Id)
	{movemenu();started=1;}
}
else
{

	staticmenu();
}	


}

function movemenu()
{
	counter = counter+pixpermotion;
	moveit = 0;

	if(document.layers)
	{
		document.barinfo.backgroundPosition = "0px -" + String(startpos - counter) + "px";
	}
	else
	{
		if(document.getElementById("barinfo") != null)
		{
			document.getElementById("barinfo").style.backgroundPosition = "0px -" + String(startpos - counter) + "px";	
			moveit = 1;
		}
	}

	
	if(moveit == 1)
	{
		if (counter >= (startpos - 1))
		{
		window.clearTimeout(Id);
		Id=0; //stop movement
		document.getElementById("bartext").style.visibility="visible";
		}
		else
		{
		Id = window.setTimeout("movemenu();",(120/speed)); //still moving
		}
	}

}

function staticmenu()
{
	if(document.layers)
		document.barinfo.backgroundPosition = "0px 0px"
	else
	{
		if(document.getElementById("barinfo") != null)
		{
			document.getElementById("barinfo").style.backgroundPosition = "0px 0px";
		}
	}
			
	if(document.getElementById("bartext") != null)
	{
			document.getElementById("bartext").style.visibility="visible";
	}
	
}

function addLoadEvent(func) 
{   
   var oldonload = window.onload;   
   if (typeof window.onload != 'function') 
   {   
     window.onload = func;   
   } 
   else 
   {   
     window.onload = function() 
     {   
     oldonload();   
     func();   
	 }   
   }   
}   
  

