//////////////////////////////////////
//          JLMenu 1.07             //
//////////////////////////////////////
//(c) Jorge Lopez Monterrubio, 2002 //
//  jlopezmonterrubio@hotmail.com   //
//////////////////////////////////////

var JLMenu_versionAPI=107;var JLMenu_disableEvents=0;
function JLMenu_setEventFlag(flag) {JLMenu_disableEvents=flag&7;}
var JLMenu_statusMsg="";var JLMenu_statusMsgFlag=false;var JLMenusRUN_=new Array();
function JLMenu_OpPropiedades_(alto,ancho) 
	{this.JLMenu_opProp_=true;
	this.alto=alto?alto:null;
	this.ancho=ancho?ancho:null;
	this.align="left";
	this.fontFamily="verdana,arial";
	this.fontWeight="bold";
	this.fontStyle="normal";
	this.fontSize="11px";
	this.fontSizeNS4="12px";
	this.fontSizeNS6="11px";
	this.padding='2px 2px 2px 2px';
	this.bgColor="white";
	this.bgColorOver="black";
	this.bgColorSelec="blue";
	this.fgColor="black";
	this.fgColorOver="white";
	this.fgColorSelec="white";
	this.cabecera=false;
	this.mostrarStatusMsg=true;
	this.mostrarStatusURL=true;
	this.mostrarStatusTitulo=true;
	this.acquire=JLMenu_acquire;
	this.setColores=JLMenuOpP_setColores;
	this.setFont=JLMenuOpP_setFont;
	this.setFontSize=JLMenuOpP_setFontSize;
	this.setMostrarStatus=JLMenuOpP_setMostrarStatus;
};
function JLMenu_mTris_(srcH,srcV) 
	{this.JLMenu_mTris_=true;
	this.align="right";
	this.width=8;
	this.height=8;
	this.paddingX=4;
	this.paddingY=4;
	this.triHsrc=(srcH)?scrH:"triH.gif";
	this.triVsrc=(srcV)?srcV:"triV.gif";
	this.acquire=JLMenu_acquire;
};
function JLMenu_Rect_(x,y,width,height) {this.JLMenu_Rect_=true;this.x=x?x:0;this.y=y?y:0;this.w=width<0?0:width;this.h=height<0?0:height;this.acquire=JLMenu_acquire;
};
function JLMenu_Propiedades_(alto,ancho) 
	{this.JLMenu_mProp_=true;this.autoAjstDir=true;this.autoAjstDesp=true;
	this.dirDesplg=3;this.despH=0;this.despV=0;this.resaltarRama=true;
	this.boundRect=null;this.alto=alto?alto:18;this.ancho=ancho?ancho:80;
	this.bgColor="black";this.cursor="default";this.separar=true;
	this.separador=2;this.separacion=2;
	this.mTris=new JLMenu_mTris_();
	this.borde=2;this.horizontal=false;this.zIndexBase=10;this.replegarDelay=300;
	this.persistencia=false;this.persistDelay=550;this.persistScrollDelay=100;this.pageScroller=false;
	this.acquire=JLMenu_acquire;
	this.getBoundRect=JLMenuP_getBoundRect;
	this.setDesplegarMode=JLMenuP_setDesplegarMode;
	this.setBorders=JLMenuP_setBorders;
	this.setRunParams=JLMenuP_setRunParams;
};

function JLMenu_Opcion_(propOp,titulo,url,menu,statusMsg,target) {if(propOp && !propOp.JLMenu_opProp_) JLMenuERROR(4,'_Opcion_',propOp);if(menu && !menu.JLMenu_) JLMenuERROR(0,'_Opcion_',menu);this.JLMenu_Opcion_=true;this.propiedades=propOp;this.titulo=titulo;this.url=url;this.menu=menu;this.statusMsg=statusMsg;this.target=target;this.acquire=JLMenu_acquire;this.gotoURL=JLMenuOp_gotoURL;
};function JLMenu_(propMenu,arrayOpciones,defaultX,defaultY) {if(propMenu && !propMenu.JLMenu_mProp_) JLMenuERROR(5,'_',propMenu);this.JLMenu_=true;this.propiedades=propMenu;this.opciones=arrayOpciones?arrayOpciones:new Array();this.defaultX=(defaultX)?defaultX:0;this.defaultY=(defaultY)?defaultY:0;this.persistente=false;this.index=null;this.acquire=JLMenu_acquire;this.getMenuRun=JLMenu_getMenuRun;this.addOpcion=JLMenu_addOpcion;this.insertOpcion=JLMenu_insertOpcion;this.deleteOpcion=JLMenu_deleteOpcion;this.crear=JLMenu_crear;this.destruir=JLMenu_destruir;this.destruirNodos=JLMenu_destruirNodos;this.destruirTodo=JLMenu_destruirTodo;this.reconstruir=JLMenu_reconstruir;this.mostrar=JLMenu_mostrar;this.ocultar=JLMenu_ocultar;this.ocultarNodos=JLMenu_ocultarNodos;this.ocultarTodo=JLMenu_ocultarTodo;this.replegar=JLMenu_replegar;this.setPersistencia=JLMenu_setPersistencia;this.setOpcion=JLMenu_setOpcion;this.setOpciones=JLMenu_setOpciones;
};function JLMenuERROR(err,name,msg) {var eS=new Array( "Objeto Menu incorrecto","Opcion no valida","Menu sin opciones","Llamada a metodo sin parametros o incorrectos","Objeto Propiedades de Opcion incorrecto","Objeto Propiedades de Menu incorrecto","Objeto Rect incorrecto","No exite capa asociada a este objeto JLMenu. "+"No se han creado datos JLMenuRun_ de este menu","Objeto mTri incorrecto","target: Frame incorrecto o no existe","El menu no ha sido destruido","No existe objeto __PlugIN","No existe objeto __Cross","construir(): No se pueden crear capas.\nIntente ejecutar"+"accion una vez definido <BODY>.\n"+"Puede que su navegador no soporte DHTML o DOM\n","sin definir");alert("JLMenu"+name+"(): ["+(eS[err]?eS[err]:eS[eS.length-1])+(arguments.length>2?(': '+msg):'')+"].");
};function JLMenu_acquire(obj) {if(obj!=null)for(var i in obj) this[i]=obj[i];
};
function JLMenuOpP_setColores(fg,bg,fgOver,bgOver,fgSelec,bgSelec)
	{if(fg) this.fgColor=fg;
	if(bg) this.bgColor=bg;
	if(fgOver) this.fgColorOver=fgOver;
	if(bgOver) this.bgColorOver=bgOver;
	if(fgSelec) this.fgColorSelec=fgSelec;
	if(bgSelec) this.bgColorSelec=bgSelec;
};function JLMenuOpP_setFont(family,align,weight,style,padding)
	{if(family) this.fontFamily=family;
	if(align) this.align=align;
	if(weight) this.fontWeight=weight;
	if(style) this.fontStyle=style;
	if(padding!=null) this.padding=padding;
};function JLMenuOpP_setFontSize(sizeCss,sizeNS4Css,sizeNS6Css)
	{if(sizeCss!=null) this.fontSize=sizeCss;
	if(sizeNS4Css!=null) this.fontSizeNS4=sizeNS4Css;
	if(sizeNS6Css!=null) this.fontSizeNS6=sizeNS6Css;
};function JLMenuOpP_setMostrarStatus(Msg,URL,Titulo) {if(Msg!=null) this.mostrarStatusMsg=Msg;if(URL!=null) this.mostrarStatusURL=URL;if(Titulo!=null) this.mostrarStatusTitulo=Titulo;
};
function JLMenuP_getBoundRect(mP) {if(!mP) mP=this;if(mP && mP.boundRect) return(mP.boundRect);return(new JLMenu_Rect_(__Cross.getPageX(),__Cross.getPageY(),__Cross.getPageWidth(),__Cross.getPageHeight()));
};function JLMenuP_setDesplegarMode(aDir,aDesp,dir,despH,despV) {if(aDir!=null) this.autoAjstDir=aDir;if(aDesp!=null) this.autoAjstDesp=aDesp;if(dir!=null) this.dirDesplg=dir;if(despH!=null) this.despH=despH;if(despV!=null) this.despH=despV;
};
function JLMenuP_setBorders(bgColor,borde,separacion,separador,separar) 
	{if(bgColor) this.bgColor=bgColor;
	if(borde!=null) this.borde=borde;
	if(separacion!=null) this.separacion=separacion;
	if(separador!=null) this.separador=separador;
	if(separar!=null) this.separar=separar;
};function JLMenuP_setRunParams(zIndex,delay,persist,persDly,persScrollDly) {if(zIndex!=null) this.zIndexBase=zIndex;if(delay!=null) this.replegarDelay=delay;if(persist!=null) this.persistencia=persist;if(persDly!=null) this.persistDelay=persDly;if(persScrollDly!=null) this.persistScrollDelay=persScrollDly;
};function JLMenuOp_gotoURL(url_,frame_) {var url=url_?url_:this.url;if(url && url!="") {if(url.indexOf("javascript:")==0)eval(url);else if(url.indexOf("js:")==0)eval(url.substring(3));else if(url.indexOf("plugin:")==0) {if(window.__PlugIN && __PlugIN.run) __PlugIN.run(url);else JLMenuERROR(11,'Op.gotoURL');}else {var d,f;var target=frame_?frame_:this.target;if(target)if((f=parent.frames[target]))d=f.document;else JLMenuERROR(9,'Op.gotoURL',target);if(!d) d=document;d.location.href=url;}}};function JLMenu_getMenuRun(err) {var mR=null;if(this.index!=null) {mR=JLMenusRUN_[this.index];if(!mR.menu || mR.menu.index!=this.index) {mR=null;this.index=null;}}if(mR==null && err) JLMenuERROR(7,'.getMenuRun');return mR;
};function JLMenu_addOpcion(opcion,reconstruir) {if(opcion && opcion.JLMenu_Opcion_) {if(this.opciones.length==null) this.opciones=new Array(opcion);else this.opciones[this.opciones.length]=opcion;if(reconstruir) {var mR=this.getMenuRun(false);if(mR) mR.reconstruir();}}else JLMenuERROR(1,'.addOpcion',opcion);
};function JLMenu_insertOpcion(opcion,index,reconstruir) {var e=null;if(opcion && opcion.JLMenu_Opcion_) {if(this.opciones.length!=null) {if(index<this.opciones.length) {var oldOp=new Array();for(var i=0;i<this.opciones.length;i++)oldOp[i]=this.opciones[i];this.opciones.length=index;this.opciones[this.opciones.length]=opcion;for(var i=index;i<oldOp.length;i++) {this.opciones[i+1]=oldOp[i];}if(reconstruir) {var mR=this.getMenuRun(false);if(mR) mR.reconstruir();}return true;}else e=3;}else e=2;}else e=1;JLMenuERROR(e,'.insertOpcion');return false;
};function JLMenu_deleteOpcion(index,reconstruir) {if(index<this.opciones.length) {for(var i=index;i<this.opciones.length-1;i++) {this.opciones[i]=this.opciones[i+1];}this.opciones.length--;if(reconstruir) {var mR=this.getMenuRun(false);if(mR) mR.reconstruir();}}else JLMenuERROR(3,'.deleteOpcion',index);
};function JLMenu_crear(m){var i,e=null;if(!window.__Cross) e=12;else if(!__Cross.checkCreateLayer()) e=13;else if(!m) {m=this;if(this.getMenuRun(false)) e=10;}if(e==null) {if((!m.JLMenu_ || !m.opciones)) e=0;else if(!m.opciones.length) {if(m!=null) return;e=2;}else if(!m.propiedades) e=5;else if(!m.propiedades.JLMenu_mProp_) e=5;}if(e!=null) {JLMenuERROR(e,'.crear');return;}if(!m.getMenuRun(false)) {m.index=JLMenuRun_New();JLMenusRUN_[m.index].construir(m);for(i=0;i<m.opciones.length;i++) {if(m.opciones[i] && m.opciones[i].menu)JLMenu_crear(m.opciones[i].menu);}}};function JLMenu_destruir() {var mR=this.getMenuRun(true);if(mR) mR.destruir();
};function JLMenu_destruirNodos(m) {if(!m) m=this;if(m.JLMenu_) {if(m.opciones && m.opciones.length!=null) {for(i=0;i<m.opciones.length;i++) {if(m.opciones[i].menu)JLMenu_destruirNodos(m.opciones[i].menu);}}if(m!=this) m.destruir();}};function JLMenu_destruirTodo() {JLMenu_destruirNodos(this);
};function JLMenu_reconstruir() {var mR=this.getMenuRun(true);if(mR) mR.reconstruir();
};function JLMenu_mostrar(x,y,z,persistente) {var mR=this.getMenuRun(true);if(mR) {mR.setPosicion(x,y,z);if(persistente || (persistente==null &&(this.persistente || this.propiedades.persistencia)))mR.setPersistencia(null,null,false);mR.mostrar();}};function JLMenu_ocultar() {var mR=this.getMenuRun(true);if(mR) mR.ocultar();
};function JLMenu_ocultarNodos(m) {if(!m) m=this;if(m.JLMenu_) {if(m.opciones && m.opciones.length!=null) {for(i=0;i<m.opciones.length;i++) {if(m.opciones[i].menu) {JLMenu_ocultarNodos(m.opciones[i].menu);}}}if(m!=this) m.ocultar();}};function JLMenu_ocultarTodo() {var mR=this.getMenuRun(true);if(mR) {mR.replegarNodos();JLMenu_ocultarNodos(this);}};function JLMenu_replegar() {var mR=this.getMenuRun(true);if(mR) mR.replegarNodos();
};function JLMenu_setPersistencia(x,y,once,activar) {var mR=this.getMenuRun(true);if(mR) mR.setPersistencia(x,y,once,activar);
};function JLMenu_setOpcion(oI,colorMode) {var mR=this.getMenuRun(true);if(mR) mR.setOpcion(oI,colorMode);
};function JLMenu_setOpciones(colorMode) {var mR=this.getMenuRun(true);if(mR) mR.setOpciones(colorMode);
};function JLMenuRun_() {this.activo=false;this.visible=false;this.menu=null;this.menuTag=null;this.menuRect=null;this.opEvent=false;this.opIndex=null;this.opMode=null;this.opRun=null;this.mRaiz=null;this.mRunNodo=null;this.timerID=null;this.persistente=false;this.persistOnce=false;this.persistX=null;this.persistY=null;this.persistTimerID=null;this.acquire=JLMenu_acquire;this.construir=JLMenuRun_construir;this.destruir=JLMenuRun_destruir;this.reconstruir=JLMenuRun_reconstruir;this.setPosicion=JLMenuRun_setPosicion;this.mostrar=JLMenuRun_mostrar;this.ocultar=JLMenuRun_ocultar;this.redraw=JLMenuRun_redraw;this.setOpcion=JLMenuRun_setOpcion;this.setOpciones=JLMenuRun_setOpciones;this.clearOpIndex=JLMenuRun_clearOpIndex;this.desplegarNodo=JLMenuRun_desplegarNodo;this.setPosicionNodo=JLMenuRun_setPosicionNodo;this.cerrarNodos=JLMenuRun_cerrarNodos;this.replegarNodos=JLMenuRun_replegarNodos;this.setReplegarTimer=JLMenuRun_setReplegarTimer;this.clearReplegarTimer=JLMenuRun_clearReplegarTimer;this.setPersistencia=JLMenuRun_setPersistencia;this.clearPersistencia=JLMenuRun_clearPersistencia;this.setPersistTimer=JLMenuRun_setPersistTimer;this.clearPersistTimer=JLMenuRun_clearPersistTimer;this.persistHandler=JLMenuRun_persistHandler;this.pageScroller=JLMenuRun_pageScroller;
};function JLMenuRunOp_() {this.colorMode=0;this.selected=false;this.opTag=null;this.opRect=null;this.setTag=JLMenuRunOp_setTag;
};function JLMenuRun_New() {var r=null;var i=0;while((i<JLMenusRUN_.length) && (r==null)) {var mR=JLMenusRUN_[i];if(!mR.menu && !mR.opEvent) {r=i;var menuTag=mR.menuTag;mR.acquire(new JLMenuRun_());mR.menuTag=menuTag;}i++;}if(r==null) {r=i;mR=JLMenusRUN_[i]=new JLMenuRun_();}return(r);
};function JLMenuRun_destruir() {if(this.menu) {var mR=(this.mRaiz)?this.mRaiz:this;mR.replegarNodos();this.ocultar();this.menu.index=null;this.menu=null;this.opRun=null;}};function JLMenuRun_reconstruir() {if(this.menu) {var mRtemp=new JLMenuRun_();mRtemp.acquire(this);this.destruir();mRtemp.menu.index=JLMenuRun_New();var mR=JLMenusRUN_[mRtemp.menu.index];if(mR.construir(mRtemp.menu)) {var mr=mRtemp.menuRect;mR.menuRect.z=mr.z;mR.setPosicion(mr.x,mr.y,mr.realZ);mR.persistente=mRtemp.persistente;mR.persistOnce=mRtemp.persistOnce;mR.persistX=mRtemp.persistX;mR.persistY=mRtemp.persistY;if(mRtemp.visible) mR.mostrar();}}};function JLMenuRun_setPosicion(x,y,z) {var mr=this.menuRect;if(mr) {if(x!=null && !isNaN(x)) mr.x=x;if(y!=null && !isNaN(y)) mr.y=y;if(z!=null && !isNaN(z)) {mr.realZ=z;if(!this.mRaiz) mr.z=z;}__Cross.setPosicion(this.menuTag,mr.x,mr.y,mr.realZ);}};function JLMenuRun_mostrar() {if(this.visible==false) {if(__Cross.setVisibility(this.menuTag,true)) {this.setPersistTimer();this.visible=true;}}};function JLMenuRun_ocultar() {if(this.opEvent) {JLMenuOp_event(this.menu.index,1);if(__Cross.isNS4) this.opEvent=false;}else this.clearOpIndex();this.clearPersistTimer();if(this.visible==true) {if(__Cross.setVisibility(this.menuTag,false)) {this.activo=false;this.visible=false;}}};function JLMenuRun_redraw() {if(this.visible==true) {var persist=this.persistente;this.ocultar();this.setPosicion();this.persistente=persist;this.mostrar();}};function JLMenuRun_setOpcion(oI,colorMode) {var e=null;if(this.menu && this.menuTag) {var o;if(oI!=null && this.opRun && this.opRun[oI]&& this.menu.opciones && (o=this.menu.opciones[oI])) {var oP=o.propiedades;if(oP) {if(oP.cabecera!=true) {if(this.opIndex==oI) {this.opMode=colorMode;return true;}var bg,fg;switch(colorMode) {case 2:bg=oP.bgColorOver;fg=oP.fgColorOver;break;case 1:bg=oP.bgColorSelec;fg=oP.fgColorSelec;break;default:colorMode=0;bg=oP.bgColor;fg=oP.fgColor;}return(this.opRun[oI].setTag(colorMode,bg,fg));}}else e=4;}else e=1;}else e=7;if(e!=null) JLMenuERROR(e,'Run.setOpcion',oI);return false;
};function JLMenuRun_setOpciones(colorMode) {if(this.opRun) {for(var i=0;i<this.opRun.length;i++) {if(this.opRun[i].opTag)this.setOpcion(i,colorMode);}}};function JLMenuRun_clearOpIndex() {if(this.opIndex!=null) {var oI=this.opIndex;this.opIndex=null;this.setOpcion(oI,this.opMode);this.opMode=null;}};function JLMenuRun_desplegarNodo(n,opI) {var nR,e=null;if(!n) e=3;else if(n.index==null || !(nR=n.getMenuRun(false))) e=7;else if(opI==null || !this.opRun[opI]) e=1;if(e!=null) {JLMenuERROR(e,'Run.desplegarNodo');return;}if(nR.mRaiz) nR.mRaiz.cerrarNodos();this.mRunNodo=nR;this.mRunNodo.mRaiz=(this.mRaiz)?this.mRaiz:this;this.setPosicionNodo(nR,this.opRun[opI].opRect,JLMenuP_getBoundRect(this.menu?this.menu.propiedades:null));nR.mostrar();
};function JLMenuRun_setPosicionNodo(nR,oRect,bRect) {if(oRect && bRect && oRect.JLMenu_Rect_ && bRect.JLMenu_Rect_) {var mP=this.menu.propiedades;var nP=nR.menu.propiedades;var x,y;var adjust=false;var dir=(mP.dirDesplg!=null)?(mP.dirDesplg&3):3;var hz=(mP.horizontal==true)?1:0;var mRect=this.menuRect;var nRect=nR.menuRect;var wX2=bRect.x+bRect.w;wY2=bRect.y+bRect.h;do {x=mRect.x;y=mRect.y;if(dir&1)x+=mP.despH+(hz?oRect.x-nP.borde:mRect.w-mP.borde);else x-=mP.despH+(hz?nRect.w-oRect.w-oRect.x-nP.borde:nRect.w-mP.borde);if(dir<2)y-=mP.despV+nRect.h-(hz?mP.borde:oRect.y+oRect.h+nP.borde);else y+=mP.despV+(hz?mRect.h-mP.borde:oRect.y-nP.borde);if(mP.autoAjstDir==true) {var x2=x+nRect.w,y2=y+nRect.h;if(!adjust) {if(x2>wX2) dir&=2;else if(x<bRect.x) dir|=1;if(y2>wY2) dir&=1;else if(y<bRect.y) dir|=2;adjust=true;}else {if(mP.autoAjstDesp==true) {if(x2>wX2) x-=x2-wX2;else if(x<bRect.x) x+=bRect.x-x;if(y<bRect.y) y+=bRect.y-y;else if(y2>wY2) y-=y2-wY2;}adjust=false;}}}while(adjust);nR.setPosicion(x,y,this.menuRect.realZ+1);}else JLMenuERROR(6,'Run.setPosicionNodo');
};function JLMenuRun_cerrarNodos() {var mR=this;while(mR.mRunNodo && !mR.activo) {mR=mR.mRunNodo;}if(!mR.activo) this.replegarNodos();
};function JLMenuRun_replegarNodos() {var mR=this;var temp;if(!this.mRaiz) this.clearReplegarTimer();while((temp=mR.mRunNodo)) {temp.ocultar();mR.clearOpIndex();mR.mRunNodo=null;mR=temp;mR.mRaiz=null;mR.setPosicion(null,null,mR.menuRect.z);}};function JLMenuRun_setReplegarTimer() {var mR=(this.mRaiz)?this.mRaiz:this;if(mR.menu && mR.menu.index!=null) {var mP=this.menu.propiedades;if(mP && mP.JLMenu_mProp_) {if(mR.timerID!=null) clearTimeout(mR.timerID);mR.timerID=setTimeout("JLMenusRUN_["+mR.menu.index+"].cerrarNodos()",mR.menu.propiedades.replegarDelay);}else JLMenuERROR(5,'Run.setReplegarTimer');}};function JLMenuRun_clearReplegarTimer() {var mR=(this.mRaiz)?this.mRaiz:this;if(mR.timerID!=null) {clearTimeout(mR.timerID);mR.timerID=null;}};function JLMenuRun_setPersistencia(x,y,once,activar) {if(this.menuRect!=null) {this.persistX=x!=null?x:this.menuRect.x;this.persistY=y!=null?y:this.menuRect.y;if(once!=null) this.persistOnce=once;this.persistente=true;if(activar && this.visible) this.setPersistTimer();}};function JLMenuRun_clearPersistencia() {this.persistente=false;this.clearPersistTimer();
};function JLMenuRun_setPersistTimer(scroll) {if(this.persistente==true && this.menu && this.menu.index!=null) {var mP=this.menu.propiedades;if(mP && mP.JLMenu_mProp_) {this.clearPersistTimer();if(this.persistTimerID!=null) clearTimeout(this.persistTimerID);this.persistTimerID=setTimeout("JLMenusRUN_["+this.menu.index+"].persistHandler()",(scroll)?mP.persistScrollDelay:mP.persistDelay);}else JLMenuERROR(5,'Run.setPersistTimer');}};function JLMenuRun_clearPersistTimer() {if(this.persistTimerID!=null) {clearTimeout(this.persistTimerID);this.persistTimerID=null;}};function JLMenuRun_persistHandler() {if(this.persistente==true) {var x=this.persistX+__Cross.getPageX();var y=this.persistY+__Cross.getPageY();var dx=this.menuRect.x-x;var dy=this.menuRect.y-y;if(dx!=0 || dy!=0) {dx-=dx>>((Math.abs(dx)>=4)?2:1);dy-=dy>>((Math.abs(dy)>=4)?2:1);this.setPosicion(x+((Math.abs(dx)>=2)?dx:0),y+((Math.abs(dy)>=2)?dy:0));this.setPersistTimer(true);}else {if(this.persistOnce==true)this.clearPersistencia();else this.setPersistTimer();}}else this.clearPersistTimer();
};function JLMenuRun_pageScroller() { if(this.menu) { var mP=this.menu.propiedades; if(mP && mP.JLMenu_mProp_ && mP.pageScroller==true) { var opRect=this.opRun[this.opIndex].opRect; var mRect=this.menuRect; var pRect=new JLMenu_Rect_( __Cross.getPageX(), __Cross.getPageY(), __Cross.getPageWidth(), __Cross.getPageHeight()); if(this.opIndex==0 || this.opIndex==this.opRun.length-1) { var delta=0; } else { var delta=(opRect.h/2)+1; } var up=(mRect.y+opRect.y-delta<pRect.y); var down=(mRect.y+opRect.y+opRect.h+delta>pRect.y+pRect.h); if(up^down) { var newY; if(this.opIndex==0) { newY=mRect.y+opRect.y; } else if(this.opIndex==this.opRun.length-1) { newY=pRect.y+(mRect.y+opRect.y+opRect.h)-(pRect.y+pRect.h); } else { newY=pRect.y+((up?-1:+1)*this.opRun[this.opIndex+1].opRect.h); } __Cross.setPageY(newY);}}}
};function JLMenu_event(mI,accion) {if((JLMenu_disableEvents&(1<<accion))) return;var mR;if(mI!=null&&(mR=JLMenusRUN_[mI])) {if(mR.menu)switch(accion) {case 0:mR.clearReplegarTimer();mR.activo=true;break;case 1:mR.activo=false;mR.setReplegarTimer();break;}}else JLMenuERROR(7,'_event');
};function JLMenuOp_event(mI,accion,oI,tag) {if((JLMenu_disableEvents&(1<<accion))) return;var mR;if(mI!=null&&(mR=JLMenusRUN_[mI])) {var o,oP,mP;if(mR.menu) {var e=null;if(mR.menu.JLMenu_) {if(oI!=null && !isNaN(oI)) {if(mR.menu.opciones && mR.menu.opciones[oI]&& mR.menu.opciones[oI].JLMenu_Opcion_) {o=mR.menu.opciones[oI];if(o.propiedades && o.propiedades.JLMenu_opProp_) {oP=o.propiedades;}else e=4;}else e=1;}if(mR.menu.propiedades && mR.menu.propiedades.JLMenu_mProp_) {mP=mR.menu.propiedades;}else e=5;}else e=0;if(e!=null) JLMenuERROR(e,'Op_event');}switch(accion) {case 0:mR.opEvent=true;mR.clearOpIndex();mR.replegarNodos();if(o) {mR.opMode=mR.opRun[oI].colorMode;mR.setOpcion(oI,2);mR.opIndex=oI;mR.pageScroller();if(o.menu && o.menu.index!=null)mR.desplegarNodo(o.menu,oI);if(oP) {JLMenuOp_event_status=true;var s;if(o.statusMsg && oP.mostrarStatusMsg==true)s=o.statusMsg;else if(o.url && oP.mostrarStatusURL==true)s=o.url;else if(o.titulo && oP.mostrarStatusTitulo==true)s=o.titulo;if(s) {if(!JLMenu_statusMsgFlag) {JLMenu_statusMsg=window.status;JLMenu_statusMsgFlag=true;}window.status=s;}}}break;case 1:if(JLMenu_statusMsgFlag) {window.status=JLMenu_statusMsg?JLMenu_statusMsg:"";JLMenu_statusMsgFlag=false;}if(!mR.mRunNodo || (mP&&mP.resaltarRama==false))mR.clearOpIndex();mR.opEvent=false;break;case 2:mR.opEvent=true;if(o) o.gotoURL();}}else JLMenuERROR(7,'_event');
};function JLMenuRun_construir(m) {var e=null;if(!window.__Cross) e=12;else if(!__Cross.checkCreateLayer()) e=13;else if(!m || !m.JLMenu_) e=0;else if(this.menu) e=10;else if(m.index==null || this!=JLMenusRUN_[m.index]) e=7;if(e!=null) {JLMenuERROR(e,'Run.construir');return false;}var mR=this;var mP=m.propiedades;mR.menu=m;var newLayer=(!mR.menuTag)?true:false;if(__Cross.isDOM || __Cross.isIE) {if(newLayer) {var style="position:absolute;top:0px;left:0px;"+"visibility:hidden;cursor:"+mP.cursor+";overflow:hidden";if(__Cross.isDOM) {mR.menuTag=document.createElement("DIV");__Cross.setStyle(mR.menuTag,style);document.body.appendChild(mR.menuTag);}else if(__Cross.isIE) {var menuTagID="_"+m.index+"_JLMenu";document.body.insertAdjacentHTML("beforeEnd","<DIV id='"+menuTagID+"' style=\""+style+"\"></DIV>");mR.menuTag=__Cross.getTag(menuTagID);}}else {__Cross.setInnerHTML(mR.menuTag,"");}}else if(__Cross.isNS4) {var l;if(newLayer) {l=mR.menuTag=new Layer(mP.ancho);l.visibility='hide';}else {l=mR.menuTag;for(var j=l.document.layers.length;j>0;j--) {var ll=l.document.layers[j-1];for(var k=ll.document.layers.length;k>0;k--) {delete ll.document.layers[k-1];}ll.releaseEvents(Event.MOUSEOVE|Event.MOUSEOUT|Event.CLICK);ll.onmouseover=null;ll.onmouseout=null;ll.onclick=null;ll=null;delete l.document.layers[j-1];}l.document.open();l.document.close();l.resizeTo(0,0);}}mR.opRun=new Array();var width=0,height=0;var separacion=(mP.separar==true)?mP.separacion:0;var nextPosY=mP.borde;var nextPosX=mP.borde;var inS='';var err=false;for(var i=0;(i<m.opciones.length) && !err;i++) {var o=m.opciones[i];if(!o || !o.JLMenu_Opcion_) {JLMenuERROR(1,'Run.construir',o);err=true;}else {var oP=o.propiedades;if(oP && !oP.JLMenu_opProp_) {JLMenuERROR(4,'Run.construir',oP);err=true;}}if(!err) {mR.opRun[i]=new JLMenuRunOp_();height=((mP.horizontal==true) || !oP || !oP.alto)?mP.alto:oP.alto;width=((mP.horizontal!=true) || !oP || !oP.ancho)?mP.ancho:oP.ancho;if(!oP) {if(mP.separar==false) {if(mP.horizontal==true)nextPosX+=mP.separador;else nextPosY+=mP.separador;}}else {mR.opRun[i].opRect=new JLMenu_Rect_(nextPosX,nextPosY,width,height);var spanFont=";font-family:"+oP.fontFamily+";font-weight:"+oP.fontWeight+";font-style:"+oP.fontStyle+";font-size:"+(__Cross.isNS6?oP.fontSizeNS6:__Cross.isNS4?oP.fontSizeNS4:oP.fontSize);var padding;if(__Cross.isNS) {padding=parseInt(oP.padding);if(isNaN(padding)) padding=0;}else {padding=oP.padding;if(!padding || padding.length<1) padding=0;}if(__Cross.isDOM || __Cross.isIE) {var w=width;var h=height;if(__Cross.isNS6) {w-=padding<<1;h-=padding<<1;}var style="position:absolute;visibility:inherit"+";top:"+nextPosY+"px\n"+";left:"+nextPosX+"px"+";width:"+w+"px"+";height:"+h+"px"+";background:"+oP.bgColor+";color:"+oP.fgColor+";overflow:hidden"+";padding:"+padding+";text-align:"+oP.align+spanFont;if(__Cross.isDOM) {var lo=document.createElement("DIV");__Cross.setStyle(lo,style);__Cross.setInnerHTML(lo,o.titulo?o.titulo:'');mR.menuTag.appendChild(lo);}else if(__Cross.isIE) {inS+="<DIV STYLE=\""+style+"\">"+(o.titulo?o.titulo:'')+"</DIV>\n";if(i+1==m.opciones.length) mR.menuTag.innerHTML=inS;}}else if(__Cross.isNS4) {var lo=new Layer(width,mR.menuTag);lo.top=nextPosY;lo.left=nextPosX;lo.clip.width=width;lo.clip.height=height;lo.bgColor=oP.bgColor;lo.visibility='inherit';var inS="<LAYER visibility='inherit'>"+"<TABLE width='"+width+"px'BORDER=0 CELLSPACING=0 "+"CELLPADDING="+padding+"><TR><TD ALIGN='"+oP.align+"'>"+"<FONT style=\"color:"+oP.fgColor+spanFont+"\">"+(o.titulo?o.titulo:'')+"</FONT>"+"</TD></TR></TABLE>"+"</LAYER>\n"+"<LAYER visibility='hide'>"+"<TABLE width='"+width+"px'BORDER=0 CELLSPACING=0 "+"CELLPADDING="+padding+"><TR><TD ALIGN='"+oP.align+"'>"+"<FONT style=\"color:"+oP.fgColorSelec+spanFont+"\">"+(o.titulo?o.titulo:'')+"</FONT>"+"</TD></TR></TABLE>"+"</LAYER>\n"+"<LAYER visibility='hide'>"+"<TABLE width='"+width+"px'BORDER=0 CELLSPACING=0 "+"CELLPADDING="+padding+"><TR><TD ALIGN='"+oP.align+"'>"+"<FONT style=\"color:"+oP.fgColorOver+spanFont+"\">"+(o.titulo?o.titulo:'')+"</FONT>"+"</TD></TR></TABLE>"+"</LAYER>\n"+"<LAYER width='"+width+"px' height='"+height+"px'>"+"</LAYER>\n";lo.document.open();lo.document.write(inS);lo.document.close();}if(mP.horizontal==true) nextPosX+=width+separacion;else nextPosY+=height+separacion;}}}if(mP.horizontal==true) {width=nextPosX+(mP.borde-separacion);height+=mP.borde*2;}else {width+=mP.borde*2;height=nextPosY+(mP.borde-separacion);}mR.menuRect=new JLMenu_Rect_(0,0,width,height);mR.menuRect.z=0;mR.menuRect.realZ=0;__Cross.setSize(mR.menuTag,width,height);mR.setPosicion(m.defaultX,m.defaultY,mP.zIndexBase);if(m.persistente) mR.setPersistencia(null,null,false);__Cross.setBgColor(mR.menuTag,mP.bgColor);if(newLayer) {__Cross.addEventListener(mR.menuTag,'mouseover',new Function("JLMenu_event("+m.index+",0)"),false);__Cross.addEventListener(mR.menuTag,'mouseout',new Function("JLMenu_event("+m.index+",1)"),false);}var capture=__Cross.isNS4;for(var i=0,j=0;i<m.opciones.length;i++) {var tag=null;if(m.opciones[i] && m.opciones[i].propiedades) {if(__Cross.isDOM || __Cross.isIE) {tag=mR.menuTag.childNodes[j];}else if(__Cross.isNS4) {if(mR.menuTag.document.layers.length>j)tag=mR.menuTag.document.layers[j];}__Cross.addEventListener(tag,'mouseover',new Function("JLMenuOp_event("+m.index+",0,"+i+")"),capture);__Cross.addEventListener(tag,'mouseout',new Function("JLMenuOp_event("+m.index+",1)"),capture);__Cross.addEventListener(tag,'click',new Function("JLMenuOp_event("+m.index+",2,"+i+")"),capture);j++;}if(mR.opRun[i]) mR.opRun[i].opTag=tag;}if(__Cross.isNS4) {if(window.onresize==null) {window.captureEvents(Event.RESIZE);window.onresize=JLMenuRun_reConstruirNS4;}}return true;
};function JLMenuRun_reConstruirNS4() 
{var i,mR;
	for(i=0;i<JLMenusRUN_.length;i++) 
		{JLMenusRUN_[i].menuTag=null;JLMenusRUN_[i].opRun=null;}
	for(i=0;i<JLMenusRUN_.length;i++) 
		{if(JLMenusRUN_[i].mRaiz)
			JLMenusRUN_[i].mRaiz.replegarNodos();
		}
	for(i=0;i<JLMenusRUN_.length;i++) 
		{mR=JLMenusRUN_[i];
		var r=mR.menuRect;
		if(mR.menu) 
			{var m=mR.menu;
			mR.menu=null;
			mR.construir(m);
			}
		mR.menuRect=r;
		if(!mR.mRaiz) 
			mR.redraw();
		}
	};
function JLMenuRunOp_setTag(colorMode,bgColor,fgColorDOM) {if(this.opTag) {if(colorMode>2 || colorMode<0) colorMode=0;if(colorMode!=this.colorMode) {__Cross.setBgColor(this.opTag,bgColor);if(__Cross.isDOM || __Cross.isIE) {this.opTag.style.color=fgColorDOM;}else if(__Cross.isNS4) {var oL=this.opTag.document.layers;oL[0].visibility=(colorMode==0)?'inherit':'hide';oL[1].visibility=(colorMode==1)?'inherit':'hide';oL[2].visibility=(colorMode==2)?'inherit':'hide';}this.colorMode=colorMode;}return true;}return false;
}