//magLayer.js - magbytes 2002	vers.: 4.0
//Basado en el "creator.js" de oscar caraballo , gracias maestro!!
	var ie,ns4,ns6;
	if(document.all)ie = true;
	else if(document.layers)ns4 = true;
	else if(document.getElementById)ns6 = true;
magLayer =  function magLayer(pater,obj,x,y,ancho,alto,colorFondo,cont,visibi,indice){
		this.obj=obj;
		this.nombre=nombre="idv"+obj;
		this.aux=[];
		this.cadLayer=null;
		this.pater=pater;
		this.x=x;	
		this.y=y;
		this.ancho=ancho;
		this.alto=alto;
		this.visibi=(visibi)? "visible":"hidden";
		this.tmpVibra=null;
		if(indice==null)this.indice=0;
		else this.indice=indice;
		if(cont==null)this.cont="";
		else this.cont=cont;
		if(colorFondo!=null){
			this.colorFondo=colorFondo;
			if(ie)this.cFondo="background-color:"+colorFondo+";"
		}else if(ie)this.cFondo="";
	this.arbol=this.creaArbol();
	if(ie){
		var	cadDiv="<div id='"+this.nombre+"' style='position:absolute; top:"+this.y+"px; left:"+this.x+"px; "+this.cFondo+"width:"+this.ancho+";visibility:"+this.visibi+";z-index:"+this.indice+"; height:"+this.alto+"'><font> </font></div>";
		this.arbol.insertAdjacentHTML("BeforeEnd",cadDiv);
		this.cadLayer=eval("document.all."+this.nombre);
		this.cadLayer.innerHTML=this.cont;
		this.clipeaCapa(0,this.ancho,this.alto,0);
	}else if(ns4){
		if(this.pater=="document")this.cadLayer=document.layers[this.nombre] =  new Layer(this.ancho);
		else this.cadLayer=eval(this.arbol+" = new Layer("+this.ancho+","+this.pater.arbol+")");
		this.cadLayer.style=this.cadLayer;	
		this.cadLayer.style.document.open();
		this.cadLayer.style.document.write(this.cont);
		this.cadLayer.style.document.close();
		this.estilo();
	}else if(ns6){
		if(this.pater=="document")this.cadLayer=document.getElementsByTagName("BODY").item(0);
		else this.cadLayer=document.getElementById(this.pater.nombre);
		var div=document.createElement("DIV");
		div.style.position="absolute";
		div.id=this.nombre;
		this.cadLayer=this.cadLayer.appendChild(div);
		this.cadLayer.innerHTML=this.cont;
		this.estilo();
	}
}
magLayer.prototype.creaArbol=function creaArbol(){
			if(ie){
				if(this.pater=="document") this.aux[0]=document.body;
				else this.aux[0]=document.all[this.pater.nombre];
			} else if(ns4) {
				if(this.pater=="document")this.aux[0]="document.layers['" + this.nombre +"']"; 
				else this.aux[0]="document.layers['"+this.pater.nombre+"'].document.layers['"+this.nombre+"']";
			}	
			return this.aux[0];
		}			
magLayer.prototype.estilo=function estilo(){
 		this.cadLayer.style.left=this.x;
		this.cadLayer.style.top=this.y;
		this.cadLayer.style.visibility=this.visibi;
		this.cadLayer.style.zIndex=this.indice;
		if(ns6) {
			this.cadLayer.style.height=this.alto;
			this.cadLayer.style.width=this.ancho;
			this.cadLayer.style.backgroundColor=this.colorFondo;
			this.clipeaCapa(0,this.ancho,this.alto,0);
		}else{
			if(this.colorFondo!=null)this.cadLayer.bgColor=this.colorFondo;
			this.cadLayer.clip.height=this.alto;
			this.cadLayer.clip.width=this.ancho;
		}
}
magLayer.prototype.indChange=function indChange(d,nextEv){
	this.cadLayer.style.zIndex=d;
	if(nextEv!=null)eval(nextEv);	
}		
magLayer.prototype.seeFalse=function seeFalse(nextEv){
	this.cadLayer.style.visibility="hidden";
	if(nextEv!=null)eval(nextEv);	
}	
		 
magLayer.prototype.seeTrue=function seeTrue(nextEv){
	this.cadLayer.style.visibility="visible";
	if(nextEv!=null)eval(nextEv);	
}			
magLayer.prototype.clipeaCapa=function clipeaCapa(a,b,c,d){
			if(ns4){
			   this.cadLayer.clip.top=a;
			   this.cadLayer.clip.right=b;
			   this.cadLayer.clip.bottom=c;
			   this.cadLayer.clip.left=d;
			}else eval("this.cadLayer.style.clip='rect("+a+"px,"+b+"px,"+c+"px,"+d+"px)'");
}		
magLayer.prototype.contenido=function contenido(aux){
		if(ns4){
			this.cadLayer.document.open();
			this.cadLayer.document.write(aux);
			this.cadLayer.document.close();
		}else this.cadLayer.innerHTML=aux;
		return;
}
magLayer.prototype.ccolor=function ccolor(color){
		if(ns4)this.cadLayer.bgColor=color;
		else this.cadLayer.style.backgroundColor=color;
		this.colorFondo=color;
	return;
}
magLayer.prototype.cTam=function cTam(alto,ancho){
		this.alto=this.cadLayer.style.height=alto;
		this.ancho=this.cadLayer.style.width=ancho;
		(ns4)?this.cadLayer.resizeTo(this.ancho,this.alto):this.clipeaCapa(0,this.ancho,this.alto,0);		
	return;	
}	
magLayer.prototype.altura=function altura(){					
		if(ns4)this.alto=this.cadLayer.document.height;
		else this.alto=this.cadLayer.offsetHeight;
		return this.alto;
}					
magLayer.prototype.anchura=function anchura(){					
		if(ns4)this.ancho=this.cadLayer.document.width;
		else this.ancho=this.cadLayer.offsetWidth;
		return this.ancho;
}	
magLayer.prototype.mueve=function mueve(x,y,nextEv){					
		this.y=this.cadLayer.style.top=y;
		this.x=this.cadLayer.style.left=x;
		if(nextEv!=null)eval(nextEv);	
}	
magLayer.prototype.slider=function slider(xF,yF,time,k,nextEv){		
		this.nextEv=nextEv;	
		this.xBezier=Math.round(this.x + (xF - this.x) / 20*(10+k)); 
		this.yBezier=Math.round(this.y + (yF- this.y) / 20 *(10+k));
		this.arraX=[];
		this.arraY=[];
		this.time=time;
		var mT=0;
		var mT2=1/10;
		for(var i=0;i<=11;i++){
				var auxS0=1-mT;
				var auxS1=auxS0*auxS0;
				var auxS2=mT*mT;
				var auxS3=2*mT*auxS0;
				this.arraX[i]=Math.round( (auxS1* this.x) + (auxS3 * this.xBezier) + (auxS2 * xF));
				this.arraY[i]=Math.round( (auxS1* this.y) + (auxS3 * this.yBezier) + (auxS2 * yF));
				mT=i*mT2;  
		}this.sliderM(xF,yF,0);
}
magLayer.prototype.sliderM=function sliderM(xF,yF,qT){		
		this.y=this.cadLayer.style.top=parseInt(this.arraY[qT]);
		this.x=this.cadLayer.style.left=parseInt(this.arraX[qT]);
		if(parseInt(this.arraY.length-1)>qT){
			qT++;clearTimeout(this.tmpVibra);
			this.tmpVibra=setTimeout(this.obj+".sliderM("+xF+","+yF+","+qT+")", this.time);			
		} else {
			 clearTimeout(this.tmpVibra);
			 if(this.nextEv!=null)eval(this.nextEv);		
		}return;
}	
magLayer.prototype.cPage=function cPage(url){
			if(ns4)this.cadLayer.src=url;
			else this.cadLayer.innerHTML="<iframe name="+this.nombre+"?"+" src="+url+" frameborder=0 width="+this.ancho+" height="+this.alto+"></iframe>";
}
var arrNext=[];
function timer(next){
	eval(next);
}	