creador.prototype.addHScroll=function(id,doc,x,y,w,h,z,v,imgArray,wImg,hImg,margen,res,fl1,fl2,sp,bg,mover,mout,mclick,enlace,full,mperform,claseTexto){
	var objeto=new creador.hScroller(this,doc,id,x,y,w,h,z,v,imgArray,wImg,hImg,margen,res,fl1,fl2,sp,bg,mover,mout,mclick,enlace,full,mperform,claseTexto);
	eval("self."+id+"=objeto");
	return objeto;
}
creador.hScroller=function(gestor,doc,id,x,y,w,h,z,v,imgArray,wImg,hImg,margen,res,fl1,fl2,sp,bg,mover,mout,mclick,enlace,full,mperform,claseTexto){
	this.gestor=gestor;
	this.doc=doc;
	this.idObj=id;
	this.x=x;
	this.y=y;
	this.w=w;
	this.h=h;
	this.z=z;
	this.v=v;
	this.imgArray=imgArray;
	this.wImg=wImg;
	this.hImg=hImg;
	this.margen=margen;
	this.res=res;
	this.fl1=fl1;
	this.fl2=fl2;
	this.sp=sp;
	this.bgcolor=bg;
	this.mover=mover;
	this.mout=mout;
	this.mclick=mclick;
	this.enlace=enlace;
	this.full=full||false;;
	this.mperform=mperform;
	this.claseTexto=claseTexto;
	this.actualItem=this.lastItem=this.maxDisplayedItems=0;
	this.needed=this.visible=this.performing=false;
	this.set();
	return this;
}
creador.hScroller.prototype.set=function(){
	var o=this.idObj;
	var idaux=(creador.DOM2)?"id":"name";
	var zaux=(this.fl1.length>5&&this.fl1[5]!=null)?this.fl1[5]:this.z;
	var s=["<a href=javascript:"+o+".perform(",")><img "+idaux+"=imag"+o," border=0></a>"];
	var f1=s[0]+0+s[1]+" src="+this.fl1[0]+" width="+this.fl1[1]+" height="+this.fl1[2]+s[2];
	var f2=s[0]+1+s[1]+" src="+this.fl2[0]+" width="+this.fl2[1]+" height="+this.fl2[2]+s[2];
	this.madre=this.gestor.crea(o+"madre",this.doc,this.x,this.y,this.w,this.h,this.z,null,this.bgcolor);
	this.hija=this.gestor.crea(o+"hija",this.madre,0,0,this.w,this.h);
	this.flIZQ=this.gestor.crea(o+"fl0",this.doc,this.fl1[3],this.fl1[4],this.fl1[1],this.fl1[2],zaux,null,null,f1);
	this.flDER=this.gestor.crea(o+"fl1",this.doc,this.fl2[3],this.fl2[4],this.fl2[1],this.fl2[2],zaux,null,null,f2);
	if(this.v=="show")this.show();
	if(this.imgArray!=null)this.refresh();
}
creador.hScroller.prototype.refresh=function(ai,nextEv,claseTexto){
	this.claseTexto=claseTexto;
	if(ai!=null)this.imgArray=ai;
	var v=this.visible;
	this.nextEv=nextEv;
	this.hide();
	this.hija.fill(this.build());
	this.hija.move(0,0);
	this.actualiza(v);
}
creador.hScroller.prototype.build=function(){
	var t="",mov,mou,mcl,l=this.imgArray.length,o=this.idObj,m="onmouse",aux1,aux2,aux3;
	if(l>0){
		var s=l*(this.wImg+this.margen);
		var sp1=Math.round(this.margen/2);
		var sp2=this.margen-sp1;
		var esImg=(this.claseTexto==null)?1:0;
		var	tcl=(esImg)?"":" class="+this.claseTexto;
		var ct1=(esImg)?"":"<center>";
		var ct2=(esImg)?"":"</center>";
		t="<table width="+s+" cellpadding=0 cellspacing=0 border=0><tr>";
		for(var i=0;i<l;i++){
			enl=(this.enlace!=null)?this.enlace+"("+i+") ":"void(null) ";
			mov=(this.mover!=null)?m+"over="+this.mover+"("+i+") ":"";
			mou=(this.mout!=null)?m+"out="+this.mout+"("+i+") ":"";
			mcl=(this.mclick!=null)?"onclick="+this.mclick+"("+i+")":"";
			if(this.enlace!=null||this.mover!=null||this.mout!=null||this.mclick!=null){
				aux1="<a href=javascript:"+enl+mov+mou+mcl+tcl+">";
				aux2="</a>";
			}else if(esImg)aux1=aux2="";
			else{
				aux1="<font"+tcl+">";
				aux2="</font>";
			}
			spaux=(i==0)?sp1:this.margen;
			t+="<td width="+spaux+"><img src="+this.sp+" width="+spaux+" height="+this.hImg+" border=0></td>";
			aux3=(esImg)?"<img src="+this.imgArray[i]+" width="+this.wImg+" height="+this.hImg+" border=0>":this.imgArray[i];
			t+="<td width="+this.wImg+">"+ct1+aux1+aux3+aux2+ct2+"</td>";
		}
		t+="<td width="+sp2+"><img src="+this.sp+" width="+sp2+" height=1 border=0></td>";
		t+="</tr></table>";
		this.hija.resize(s,this.h);
	}
	return t;
}
creador.hScroller.prototype.actualiza=function(v){
	var o=this.id;
	var l=this.imgArray.length;
	var anchura=l*(this.wImg+this.margen);
	this.needed=((!this.full&&l>1)||anchura>this.w)?1:0;
	this.maxDisplayedItems=Math.round(this.w/(this.wImg+this.margen));
	if(this.needed){
		this.actualItem=0;
		this.lastItem=(this.full)?l-this.maxDisplayedItems:l-1;
	}
	if(v)this.show();
	if(this.nextEv!=null)eval(this.nextEv);
}
creador.hScroller.prototype.perform=function(dir){
	window.focus();
	if(!this.performing){
		this.performing=true;
		if(dir==0){
			if(this.actualItem>0){
				this.hija.slide(this.hija.x+(this.margen+this.wImg)*1,this.hija.y,this.res,1,0,this.idObj+".performing=false");
				this.actualItem--;
			}
		}else{
			if(this.actualItem<this.lastItem){
				this.hija.slide(this.hija.x+(this.margen+this.wImg)*-1,this.hija.y,this.res,1,0,this.idObj+".performing=false");
				this.actualItem++;
			}
		}
	}
	(this.actualItem>0)?this.flIZQ.show():this.flIZQ.hide();
	(this.actualItem<this.lastItem)?this.flDER.show():this.flDER.hide();
	if(this.mperform!=null)eval(this.mperform+"("+this.actualItem+")");
}
creador.hScroller.prototype.show=function(){
	if(!this.visible){
		this.madre.show();
		this.hija.show();
		if(this.needed){
			if(this.actualItem<this.lastItem)this.flDER.show();
			if(this.actualItem>0)this.flIZQ.show();
		}
		this.visible=true;
	}
}
creador.hScroller.prototype.hide=function(){
	this.madre.hide();
	this.hija.hide();
	this.flIZQ.hide();
	this.flDER.hide();
	this.visible=false;
}
