var velo_scroll = 50; // velocidade da rolagem
var pixel_scroll = 10; // quantidade de saltos entre os pixels
var window_width = 420; 
var xx = 0;

var Navegador = navigator.appName.toLowerCase();
var isIE = (Navegador.indexOf('microsoft') != -1);

//-----------------------------------------------------------
function getObjWidth() 
{
	var theObj = document.getElementById(obj);
	return theObj.clientWidth;
}
//-----------------------------------------------------------
function getObject(obj) 
{
	if (typeof obj == "string") 
	{
		theObj = document.getElementById(obj).style;
	}
	else
	{
		theObj = obj;
	}
	return theObj;
}
//-----------------------------------------------------------
function getObjectLeft(obj) 
{
	var theObj = getObject(obj);
	if (isIE) 
	{
		if (theObj.pixelLeft =='')
			theObj.pixelLeft = 0;
		return theObj.pixelLeft;
	}
	else
	{
		if (theObj.left =='')
			theObj.left = 0;
		return theObj.left;
	}
}
//-----------------------------------------------------------
function shiftBy(obj, x, y) 
{
	var theObj = getObject(obj);
	if (isIE) 
	{
		if (theObj.pixelLeft=='')
			theObj.pixelLeft = 0;	
		theObj.pixelLeft = theObj.pixelLeft + x;
		theObj.pixelTop = theObj.pixelTop + y;
	} 
	else
	{
		if (theObj.left=='')
			theObj.left = 0;

    //    xx = parseInt(xx) + parseInt(x);
    //    theObj.left = parseInt(xx);
		theObj.left = parseInt(theObj.left) + parseInt(x);
    	theObj.top = theObj.top + y;
	}
}
//-----------------------------------------------------------
var tim = 0;
var noScroll = true;
//-----------------------------------------------------------
function mLeft() 
{
	obj = "menu";
	if(!noScroll && parseInt(getObjectLeft(obj)) < (window_width-423))
	{
		shiftBy(obj, pixel_scroll, 0);
		tim = setTimeout("mLeft()", velo_scroll);
	}
}
//-----------------------------------------------------------
function mRight() {
	obj = "menu";
	if((!noScroll) && (parseInt(getObjectLeft(obj)) > -(getObjWidth(obj)-window_width-200)) ) 
	{
		shiftBy(obj, -pixel_scroll, 0);
		tim = setTimeout("mRight()", velo_scroll);
	}
}
//-----------------------------------------------------------
function noMove() 
{
	clearTimeout(tim);
	noScroll = true;
}
