galeria=function(aElemList,achildrenType,aBtnAnterior,aBtnSiguiente,aPaginador){
this._elementoListable=aElemList;
this._childrenType=achildrenType;
this._BtnAnterior=aBtnAnterior;
this._BtnSiguiente=aBtnSiguiente;
this._Paginador=aPaginador;
this._contentScrolled=null;
this._elemCurrent=0;
this._widthContent=0;
}
galeria.prototype={
initialize:function(){
_self=this;
this._contentScrolled=new Array();
this._widthContent=this._elementoListable.find("img").attr("width");
$.each(_self._elementoListable.children(_self._childrenType),function(i,Row){
_self._contentScrolled.push(Row);
});
$(this._contentScrolled[this._elemCurrent]).css("left","0px")
this._BtnAnterior.click(function(){
_self.atras();
});
this._BtnSiguiente.click(function(){
_self.avanza();
});
}
,
avanza:function(){
_self=this;
oldID=this._elemCurrent
if(this._elemCurrent<this._contentScrolled.length-1){
this._elemCurrent++;
}
else{
this._elemCurrent=0;
}
$(_self._contentScrolled[oldID]).css("left",_self._widthContent*(-1)+"px");
$(_self._contentScrolled[this._elemCurrent]).css("left","0px");
this.selPager(this._elemCurrent+1)
},
atras:function(){
_self=this;
oldID=this._elemCurrent
if(this._elemCurrent>0){
this._elemCurrent--;
}
else{
this._elemCurrent=this._contentScrolled.length-1;
}
$(_self._contentScrolled[oldID]).css("left",_self._widthContent+"px");
$(_self._contentScrolled[this._elemCurrent]).css("left","0px");
this.selPager(this._elemCurrent+1)
},
goto:function(aImg){
oldID=this._elemCurrent
this._elemCurrent=aImg-1;
$(_self._contentScrolled[oldID]).css("left",_self._widthContent*(-1)+"px");
$(_self._contentScrolled[this._elemCurrent]).css("left","0px");
},
selPager:function(aInt){
_self=this;
_self._Paginador.find("a").attr("class","");
_self._Paginador.find("a:eq("+(aInt-1)+")").attr("class","current");
}
,
crearPaginador:function(){
_self=this;
_self._Paginador.empty();
$("<ul></ul>").appendTo(_self._Paginador.selector);
$.each(_self._elementoListable.children(_self._childrenType),function(i2,Rows){
$("<li><a title='"+(i2+1)+"'>"+""+"</a></li>").appendTo($(_self._Paginador.selector).children("ul"));
});
_self.selPager(1);
_self._Paginador.find("a").click(function(){
_self.goto(this.title);
_self.selPager(this.title);
});
}
}
$(document).ready(function(){
var galery;
galery=new galeria($("#gallery").find(".ScrollImgs"),"div",$(".left_arrow"),$(".right_arrow"),$(".nav"));
galery.initialize();
galery.crearPaginador();
});

