var the_timeout;
var move;
var interval_ID;
var maxWidth;



function stopMenu()
{
clearInterval(interval_ID);
}

function startMenu(step)
{
interval_ID = setInterval('moveDiv("menuTabs",'+step+');',15);
}

function position()
{
	try{
		if(CurrentPosition)
		{
			if(CurrentPosition > 0.7)
			{
				moveDiv("menuTabs",(-maxWidth + 810));
			}
			if(CurrentPosition < 0.7 && CurrentPosition > 0.5)
			{
				moveDiv("menuTabs",(-maxWidth + 1000));
			}	
		}
	
	}catch(error){}
	
}

function moveDiv(divID,step)
{
  // get the stylesheet
  //
  var the_style = getStyleObject(divID);
		
  if (the_style)
  {
    // get the current coordinate and add 5
    //
    var current_left = parseInt(the_style.left);
    var new_left = current_left + parseInt(step);
	
//	if (current_left <= 0){
//		the_style.left = new_left+"px";
//	}

	var out = document.getElementById("selectOut");
	var ins = document.getElementById("menuTabsTable");/*
	alert(out.clientWidth);*/
	
    // set the left property of the DIV, add px at the
    // end unless this is NN4
    //
		
		if(step > 0 && current_left < 0 ){
		
			if (document.layers){
				the_style.left = new_left;
			}
			else {  
				the_style.left = new_left + "px";
			}
		}
		var maxim = (((current_left+(-1)*out.clientWidth))-((-1)*ins.clientWidth))*(-1);
		if (((current_left+(-1)*out.clientWidth))>((-1)*ins.clientWidth)){
			if (maxim >=step){
				if (document.layers) {
						the_style.left = (new_left+maxim);
					}
					else{  
						the_style.left = (new_left+maxim) + "px";
					}
			}else if(step < 0 && ((current_left+(-1)*out.clientWidth))>((-1)*ins.clientWidth)){
				if (document.layers) {
					the_style.left = new_left;
				}
				else {  
					the_style.left = new_left + "px";
				}
			}
		}
//		alert(step);
//		alert(current_left);
//		alert(the_style.left);
		
  }
}


function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject