function growImage(oImg){
	oImg.className = "over";
}
function shrinkImage(oImg){
	oImg.className = "";
}

function moveThumbLeft(){
	nLeftPos = $('motiongallery').offsetLeft; //Position.positionedOffset($('motiongallery'));
	if(nLeftPos == 0){
		//clearTimeout(oTimeMove);
		stopMove();
	}
	else{
		if((nLeftPos + moveScale) > 0){
			nScale = 0 - nLeftPos; 
		}
		else{
			nScale = moveScale; 
		}
		moveThumb(nScale);
		oTimeMove = setTimeout('moveThumbLeft()', 100);
	}
}

function activateScroll(sAction){
	if(sAction == "moveLeft"){
		moveThumbLeft();
	}	
	else{
		moveThumbRight();
	}
}

function moveThumbRight(){
	nLeftPos = $('motiongallery').offsetLeft;
	nRightPos = nLeftPos + $('ulThumbnail').getWidth();
	nRightLimit = $('motioncontainer').getWidth();
	if((nRightPos <= nRightLimit) || ($('ulThumbnail').getWidth() < $('motioncontainer').getWidth())){
		//clearTimeout(oTimeMove);
		stopMove();
	}
	else{
		if((nRightPos - moveScale) < nRightLimit){
			nScale = 0 - (nRightPos - nRightLimit); 
		}
		else{
			nScale = 0 - moveScale; 
		}
		moveThumb(nScale);
		oTimeMove = setTimeout('moveThumbRight()', 100);
	}
}

function moveThumb(nScale){
	
	$('motiongallery').style.left = ($('motiongallery').offsetLeft + nScale) + 'px';
}

function moveThumbTo(nPos){
	
	$('motiongallery').style.left = nPos + 'px';
}

function stopMove(){
	clearTimeout(oTimeMove);
	//Actualiza la variable de session
	new Ajax.Request("gal_pos.php", {parameters: {pos: $('motiongallery').offsetLeft, cat: $('cat_value').innerHTML}});
}