function xMarco(id,tamanyo,estilos,sepa,paramMovi,pageDefault,datPagina,datDesplega){
	var xMObj=new xMarco.create(id,tamanyo,estilos,sepa,paramMovi,pageDefault,datPagina,datDesplega);
	eval('xM'+id+'=xMObj');
	return xMObj;
}

xMarco.create=function(id,tamanyo,estilos,sepa,paramMovi,pageDefault,datPagina,datDesplega){
	this.arg=arguments;
	this.ant=1;
	this.ok=1;
	this.idConte=this.arg[0]+'-Conte';
	this.idDeco=this.arg[0]+'-Deco';
	this.idFoto=this.arg[0]+'-Foto';
	this.tiempo=0;
	this.xCom=(this.arg[1][0]+(Math.round(this.arg[1][2]/2)));
	this.yCom=(this.arg[1][1]+(Math.round(this.arg[1][3]/2)));
	this.contPasos=0;
	this.contClip=[1,1];
	this.creaDivPag=0;
	this.pasos=[parseInt((this.xCom-this.arg[1][0])/this.arg[4][0]),parseInt((this.yCom-this.arg[1][1])/this.arg[4][0]),parseInt((this.arg[1][2]-1)/this.arg[4][0]),parseInt((this.arg[1][3]-1)/this.arg[4][0])];
	this.drawDiv(this.idDeco,this.xCom,this.yCom,1,1,this.arg[1][4],this.arg[1][5]);

	this.drawDiv(this.idConte,(this.arg[1][0]+this.arg[3][3]),(this.arg[1][1]+this.arg[3][0]),(this.arg[1][2]-this.arg[3][1]),(this.arg[1][3]-this.arg[3][2]),this.arg[1][4],'v');
	this.drawDiv(this.idFoto,(this.arg[1][0]+this.arg[1][6]+this.arg[7][0]),this.arg[1][1],this.arg[7][1],this.arg[7][2],1,'h');
	this.pushConte(this.idDeco,'<table border=0 cellspacing=0 cellpadding=0 class="'+this.arg[2][0]+'" width=100% height=100%><tr><td></td></tr></table>');
	this.pushConte(this.idFoto,'<table border=0 cellspacing='+this.arg[3][0]+' cellpadding=0 class="'+this.arg[7][3]+'" width=100% height=100%><tr><td class="'+this.arg[7][4]+'" id="'+this.arg[0]+'-Foto-Conte">&nbsp;</td></tr></table>');
	this.moveDeco(1);
}

xMarco.create.prototype.drawDiv=function(id,x,y,w,h,z,v){
	if(navigator.appName=='Netscape' && document.getElementById){
		var aux=document.createElement("DIV");
		aux.style.position="absolute";
		aux.id=id;
		aux.style.left=x;
		aux.style.top=y;
		if(w!=null) aux.style.width=w;
		if(h!=null) aux.style.height=h;
		aux.style.visibility=(v=='v')? 'visible' : 'hidden';
		aux.style.zIndex=(z!=null)? z : 1;
		document.body.appendChild(aux);
	}else if(document.all){
		var aux='<div id="'+id+'" style="position:absolute;left:'+x+'px;top:'+y+'px';
		if(w!=null) aux+=';width:'+w+'px';
		if(h!=null&&w) aux+=';height:'+h+'px';
		aux+=(z!=null)? ';z-Index:'+z : ';z-Index:1';
		aux+=(v=='v'||v==null)? ';visibility:visible' : ';visibility:hidden';
		aux+='"></div>';
		document.body.insertAdjacentHTML('BeforeEnd',aux);
	}
}

xMarco.create.prototype.pushConte=function(id,txt){ document.getElementById(id).innerHTML=txt; }

xMarco.create.prototype.moveDeco=function(opc){
	if(this.contPasos<this.arg[4][0]){
		if(opc==1){
			document.getElementById(this.arg[0]+'-Deco').style.left=this.calculos('left')-this.pasos[0];
			document.getElementById(this.arg[0]+'-Deco').style.width=this.calculos('width')+this.pasos[2];
			var soy=1;
		}else if(opc==2){
			document.getElementById(this.arg[0]+'-Deco').style.top=this.calculos('top')-this.pasos[1];
			document.getElementById(this.arg[0]+'-Deco').style.height=this.calculos('height')+this.pasos[3];
			var soy=2;
		}
		this.contPasos++;
		this.tiempo=setTimeout('xM'+this.arg[0]+'.moveDeco('+soy+')',this.arg[4][1]);
	}else{
		if(opc==1){
			clearTimeout(this.tiempo);
			document.getElementById(this.arg[0]+'-Deco').style.left=this.arg[1][0];
			document.getElementById(this.arg[0]+'-Deco').style.width=this.arg[1][2];
			var soy=2;
			this.contPasos=0;
			this.tiempo=setTimeout('xM'+this.arg[0]+'.moveDeco('+soy+')',this.arg[4][1]);		
		}else if(opc==2){
			clearTimeout(this.tiempo);
			document.getElementById(this.arg[0]+'-Deco').style.top=this.arg[1][1];
			document.getElementById(this.arg[0]+'-Deco').style.height=this.arg[1][3];
			this.space=[(this.arg[1][2]-this.arg[3][1]),(this.arg[1][3]-this.arg[3][2]),(this.arg[1][6]-this.arg[3][1]),(this.arg[1][7]-this.arg[3][2])];
			this.pushConte(this.idConte,'<iframe id="contenedorConte" name="contene" frameborder=0 src="'+this.arg[5]+'?'+this.space[0]+'?'+this.space[1]+'" style="width:'+(this.arg[1][2]-this.arg[3][1])+'px;height:'+(this.arg[1][3]-this.arg[3][2])+'px;z-Index:100;overflow:hidden;visibility:visible" scrolling="no"></iframe>');
		}
	}
}

xMarco.create.prototype.calculos=function(carac,id){
	var ids=(id)? id : this.arg[0]+'-Deco';
	eval("var cal=parseInt(document.getElementById('"+ids+"').style."+carac+")");
	return cal;
}
xMarco.create.prototype.vision=function(id,vi){ document.getElementById(id).style.visibility=vi; }

xMarco.create.prototype.creaPagina=function(nElemen,nxp){
	this.numPags=parseInt(nElemen/nxp);
	if(nElemen%nxp!=0) this.numPags++;
	if(this.numPags>1){
		var aux='<table border=0 cellspacing=0 cellpadding=0><tr>';
		if(this.arg[6][2]!=null && this.arg[6][2].length==3) aux+='<td width='+(this.arg[6][3][1]+5)+' align=left><span id="retroceso" style="visibility:hidden"><a class="txtPie" href="javascript:xM'+this.arg[0]+'.avdRet(\'r\')">anterior&nbsp;&nbsp;</a></span></td>';
		for(var i=0;i<this.numPags;i++) aux+='<td><a href="javascript:void(0)" class="'+((i==0)? this.arg[6][1] : this.arg[6][0])+'" onclick="xM'+this.arg[0]+'.lanzo('+i+')" id="pag-'+(i+1)+'">'+(i+1)+'&nbsp;</a></td>';
			if(this.arg[6][3]!=null && this.arg[6][3].length==3) aux+='<td width='+(this.arg[6][3][1]+5)+' align=right><span id="avance" style="visibility:visible"><a class="txtPie" href="javascript:xM'+this.arg[0]+'.avdRet(\'a\')">&nbsp;siguiente</a></span></td>';
		aux+='</tr></table>';
		if(this.creaDivPag==0){
			this.drawDiv('paginacion',parseInt(document.getElementById(this.arg[0]+'-Deco').style.left),(parseInt(document.getElementById(this.arg[0]+'-Deco').style.top)+parseInt(document.getElementById(this.arg[0]+'-Deco').style.height)),this.arg[1][2],null,10000,'v');
			this.creaDivPag++;
		}
		this.pushConte('paginacion',aux);
	}
}

xMarco.create.prototype.activo=function(opc){
	if(this.ant!=(opc+1)) document.getElementById('pag-'+this.ant).className=this.arg[6][0];
	document.getElementById('pag-'+(opc+1)).className=this.arg[6][1];
	this.ant=opc+1;
}
xMarco.create.prototype.lanzo=function(opc){
	if(this.ok==1){
		this.ok=0;
		this.activo(opc);
		contene.xCfotos.moveImg(opc);
		if(opc==0){ this.vision('retroceso','hidden'); this.vision('avance','visible');
		}else if(opc==(this.numPags-1)){ this.vision('retroceso','visible'); this.vision('avance','hidden');
		}else{ this.vision('retroceso','visible'); this.vision('avance','visible'); }
	}
}
xMarco.create.prototype.avdRet=function(movi){
	if(movi=='a'){
		if(this.ok==1){
			this.ok=0;
			if(contene.xCfotos.selPag<(this.numPags-1)){
				contene.xCfotos.moveImg((contene.xCfotos.selPag+1));
				this.activo((contene.xCfotos.selPag));
				if((contene.xCfotos.selPag+1)>0) this.vision('retroceso','visible');
				if((contene.xCfotos.selPag+1)==this.numPags) this.vision('avance','hidden');
			}
		}
	}else if(movi=='r'){
		if(this.ok==1){
			this.ok=0;
			if(contene.xCfotos.selPag>0){
				contene.xCfotos.moveImg((contene.xCfotos.selPag-1));
				this.activo((contene.xCfotos.selPag));
				if((contene.xCfotos.selPag+1)==1) this.vision('retroceso','hidden');
				if((contene.xCfotos.selPag+1)<this.numPags) this.vision('avance','visible');
			}
		}
	}
}
xMarco.create.prototype.rescaMarco=function(movType,uri){
	this.uri=uri;
	contene.document.location.replace('nada.htm');
	this.pushConte('paginacion','');
	if(movType!='comp') this.vision(this.idFoto,'hidden');
	(movType=='comp')? this.movMinus() : this.movPlus();
}
xMarco.create.prototype.movMinus=function(){
	if(this.calculos('width')>this.arg[1][6]){
		document.getElementById(this.arg[0]+'-Deco').style.width=this.calculos('width')-10;
		document.getElementById('contenedorConte').style.width=this.calculos('width','contenedorConte')-10;
		this.tiempo=setTimeout('xM'+this.arg[0]+'.movMinus()',0);
	}else{
		document.getElementById('paginacion').style.width=this.calculos('width');
		contene.document.location.replace(this.uri+"?"+(this.arg[1][6]-this.arg[3][1])+"?"+(this.arg[1][7]-this.arg[3][2]));
		this.pushConte(this.arg[0]+'-Foto-Conte','&nbsp;');
		this.vision(this.idFoto,'visible');
		clearTimeout(this.tiempo);
	}
}
xMarco.create.prototype.movPlus=function(){
	if(this.calculos('width')<this.arg[1][2]){
		document.getElementById(this.arg[0]+'-Deco').style.width=this.calculos('width')+10;
		document.getElementById('contenedorConte').style.width=this.calculos('width','contenedorConte')+10;
		this.tiempo=setTimeout('xM'+this.arg[0]+'.movPlus()',0);
	}else{
		document.getElementById('paginacion').style.width=this.calculos('width');
		contene.document.location.replace(this.uri+'?'+(this.arg[1][2]-this.arg[3][1])+'?'+(this.arg[1][3]-this.arg[3][2]));
		clearTimeout(this.tiempo);
	}
}
xMarco.create.prototype.cargaImagen=function(uri,etiq){
	aux='<img src="'+uri+'" '+((this.arg[7][5]!=null)? "width="+this.arg[7][5] : "")+' '+((this.arg[7][6]!=null)? "height="+this.arg[7][6] : "")+' border=0>';
	aux+=(etiq!='null')? '<br><font class="'+this.arg[7][7]+'">'+etiq+'</font>' : '';
	this.pushConte(this.arg[0]+'-Foto-Conte',aux);
}
