function hytScrollingDiv($uId) {
	var $this									= null;
	var $ID										= null;
	var $eContainer								= null;
	var $eContent								= null;
	var $aDirections							= ['u','r','d','l'];
	var $sActiveDirection						= '';
	var	$nWidth									= 0;
	var $nScrollWidth							= 0;

	/** FUNCTION
	init: Inicia el objeto hytScrollingDiv.
	Input:
		$uId = Id del objeto DIV al que se le aplicará scroll, o referencia del
			mismo;
	**/
	this.Init = function($uId) {
		$ID = this.hash();
		$this = "$"+$ID;
		eval($this+"= this");

		$eContainer = (typeof($uId)=="object") ? $uId : document.getElementById($uId);
		
		$eContainer.style.position = 'relative';
		
		var $sContent = $eContainer.innerHTML;
		$eContainer.innerHTML = "";
		var $sTextBox = this.hash()+"_";		
		$eContent = document.createElement('div');
		$eContent.setAttribute('id', $sTextBox);

		$eContainer.appendChild($eContent);
		$eContent.style.top = '0px';
		$eContent.style.left = '0px';
		$eContent.style.position = 'relative';

		$eContent.innerHTML = $sContent;
		
		$nWidth = parseInt($eContainer.offsetWidth);
		$nScrollWidth = parseInt($eContainer.scrollWidth);
	}
	/** FUNCTION END **/


	/** FUNCTION
	down: Inicia el desplazamiento de los contenidos hacia arriba.
	**/
	this.down = function() {
		var $nBottomLimit = parseInt($eContent.style.top) + parseInt($eContent.offsetHeight);
		if($nBottomLimit>parseInt($eContent.parentNode.offsetHeight)) {
			var $nPos = parseInt($eContent.style.top) - 8;
			$eContent.style.top = $nPos +'px';
			$sActiveDirection = 'd';
			$aDirections['d'] = setTimeout($this+".down()", 100);
		}
	}

	/** FUNCTION END **/


	/** FUNCTION
	up: Inicia el desplazamiento de los contenidos hacia abajo.
	**/
	this.up = function() {
		if(parseInt($eContent.style.top)<0) {
			var $nPos = parseInt($eContent.style.top) + 8;
			$eContent.style.top = $nPos +'px';
			$sActiveDirection = 'u';
			$aDirections['u'] = setTimeout($this+".up()", 100);
		}
	}
	/** FUNCTION END **/


	/** FUNCTION
	left: Inicia el desplazamiento de los contenidos hacia la derecha.
	**/
	this.left = function() {
		if(parseInt($eContent.style.left)<0) {
			var $nPos = parseInt($eContent.style.left) + 8;
			$eContent.style.left = $nPos +'px';
			$sActiveDirection = 'l';
			$aDirections['l'] = setTimeout($this+".left()", 100);
		}
	}
	/** FUNCTION END **/


	/** FUNCTION
	right: Inicia el desplazamiento de los contenidos hacia la izquierda.
	**/	this.right = function() {
		var $nLeftLimit = $nScrollWidth + parseInt($eContent.style.left);
		if($nLeftLimit>$nWidth) {
			var $nPos = parseInt($eContent.style.left) - 8;
			$eContent.style.left = $nPos +'px';
			$sActiveDirection = 'r';
			$aDirections['r'] = setTimeout($this+".right()", 100);
		}
	}
	/** FUNCTION END **/


	/** FUNCTION
	stop: Detiene el desplazamiento de los contenidos.
	**/
	this.stop = function() {
		clearTimeout($aDirections[$sActiveDirection]);
	}
	/** FUNCTION END **/


	/** FUNCTION
	hash: Genera un HASH unico.
	**/
	this.hash = function () {
		var $eNow = new Date();
		return '_'+$eNow.getTime();
	}
	/** FUNCTION END **/
	

	// constructor
	this.Init($uId);
}
sd = new hytScrollingDiv('slider');
if(document.getElementById('slider2')){

sd2 = new hytScrollingDiv('slider2');
}

