// SKIN PARA EL CONSTRUCTOR DE MENÚ "smMenCon.js" | versión 0.0.3
//// (C) Copyright 2001 por Concept!Madrid, Oscar Rey Tajes
// para solucionar el bug de netscape 4.0.x, común a todos los skins////
var auxB = "redireccionar.asp";
//Rosa para 210907 que la pestaña de profesores no haga validacion y te lleve a ="http://www.recursosenred.profes.net" en vez de a redireccionar.asp
//var auxB = "http://www.recursosenred.profes.net";
if(nav=='ns4')var dw=window.innerWidth; 
window.onresize=function(){(nav=='ns4')?(window.innerWidth!=dw)?location.reload():'':location.reload()}
/////////////////////////////////////////////////////////////////////////
var pestAct=null,pIni=null,pesta0=null,pesta1=null,pesta2=null;
var alts=null;

function info(){
		//alert(location.href);
		if(location.href!="info_prof.asp")location.href="info_prof.asp";
				
}

onload=function(){
//RAB: Función que funciona sólo de manera distinta para inf_prof.asp
if (location.href.indexOf('profesor')!=-1){
			//alert("entro en onload");		
			//defStatus='2,0';
			miar=((location.href.indexOf("?est=")!=-1)?location.href.split("?est=")[1]:(location.href.indexOf("&est=")!=-1)?location.href.split("&est=")[1]:defStatus);
			
	//	miar=((location.href.indexOf("?est=")!=-1)?location.href.split("?est=")[1]:defStatus);
		if(miar.indexOf("#")!=-1)miar=miar.replace(/#/g,'');
		k='['+miar+']';pIni=eval(k)[0];eval('pesta'+eval(k)[0]+'=1'),pestAct=eval(k)[0];
		if(nav=='ns4' && navigator.userAgent.indexOf("4.0")!=-1){setTimeout('stmenu(k,"arrImg")',600);setTimeout('hypertext(alts)',1000);}
		else{stmenu(k,"arrImg");hypertext(alts);}
	}else{
	/*if (location.href.indexOf('info_prof')!=-1){		
		miar=((location.href.indexOf("?est=")!=-1)?location.href.split("?est=")[1]:(location.href.indexOf("&est=")!=-1)?location.href.split("&est=")[1]:defStatus);
		if(miar.indexOf("#")!=-1)miar=miar.replace(/#/g,'');
		k='['+miar+']';pIni=eval(k)[0];eval('pesta'+eval(k)[0]+'=1'),pestAct=eval(k)[0];
		if(nav=='ns4' && navigator.userAgent.indexOf("4.0")!=-1){setTimeout('stmenu(k,"arrImg")',600);setTimeout('hypertext(alts)',1000);}
		else{stmenu(k,"arrImg");hypertext(alts);}
		pestana2(1);
	}else{*/
		defStatus='2,0';
		miar=((location.href.indexOf("?est=")!=-1)?location.href.split("?est=")[1]:(location.href.indexOf("&est=")!=-1)?location.href.split("&est=")[1]:defStatus);
if (location.href.indexOf("&idIdioma")!=-1)
{
		miar=(miar.substring(0,miar.indexOf("&idIdioma")));
		}
	
	//	miar=((location.href.indexOf("?est=")!=-1)?location.href.split("?est=")[1]:defStatus);
		if(miar.indexOf("#")!=-1)miar=miar.replace(/#/g,'');
		pIni= "";
		
		k='['+miar+']';

		pIni=eval(k)[0];eval('pesta'+eval(k)[0]+'=1'),pestAct=eval(k)[0];
		
		if(nav=='ns4' && navigator.userAgent.indexOf("4.0")!=-1){setTimeout('stmenu(k,"arrImg")',600);if(alts)setTimeout('hypertext(alts)',1000);}
		else{stmenu(k,"arrImg");if(alts)hypertext(alts);}
		//Inicio KIBS
		//if (typeof(KIBSShowLogin) != 'undefined'){
		//    if (KIBSShowLogin){
		//	auxB="redireccionar.asp";
		//	pestana(1);
		//    }
		//}
		//Fin KIBS

	}
	//}
// recupera la url de la pagina actual y se la pasa a redireccionar.asp
		var auxA = location.href.split('?');
		auxB="redireccionar.asp";//?urlOld="+auxA[0];
}

function chEstado(pag,nod){
//   alert("chEstado(" + pag + "," + nod + ")");
   if (this.Link && this.Link.indexOf("redireccionar.asp") != -1) {
      document.location.href = this.Link;
      return;
   }
	if(this.id){
		// modificado para que sepa en que pestana se encuentra
		// newEst = eval('['+this.id.replace(/P/g,'').replace(/A/g,'').replace(/C/g,'').replace(/elm/g,',').split(this.args[0]+',')[1]+']');
		estadin = "[";
		if (this.anid!=null) estadin += this.anid + ",";
		estadin += this.id.replace(/P/g,'').replace(/A/g,'').replace(/C/g,'').replace(/elm/g,',').split(this.args[0]+',')[1]+"]";
		newEst = eval(estadin);
		if(eval(this.args[0]).HTMLst){(this.anid!=null)?newEst[1]=newEst[1]-1:newEst[0]=newEst[0]-1;}
		if(this.Link){
			if (this.Link.indexOf('javascript:')!=-1) eval(this.Link);
			else {
				if (location.href.indexOf('?profesor=1')!=-1){
					if (this.Link.indexOf('?profesor=1')==-1 && this.Link.indexOf('&profesor=1')==-1) this.Link = (this.Link.indexOf('?')!=-1)? this.Link+"&profesor=1" : this.Link+"?profesor=1";
				} 
            else {
					if (location.href.indexOf('&profesor=1')!=-1 && this.Link.indexOf('?profesor=1')==-1 && this.Link.indexOf('&profesor=1')==-1) {
                  this.Link = (this.Link.indexOf('?')!=-1)? this.Link+"&profesor=1" : this.Link+"?profesor=1";
               }
				}
				(this.Link.indexOf('javascript:')!=-1)?eval(this.Link):(this.Link.indexOf('?')!=-1)?location.assign(this.Link+'&est='+newEst):location.assign(this.Link+'?est='+newEst);
			}
			return;
		}	
      var h =(location.href.indexOf('?est=')!=-1)?location.href.substring(0,location.href.indexOf('?est='))+'?est='+newEst:location.href.substring(0,location.href.indexOf('&est=')!=-1)?location.href.substring(0,location.href.indexOf('&est='))+'&est='+newEst:(location.href.indexOf('?')!=-1)?location+'&est='+newEst : location+'?est='+newEst;
      //alert(h);
		location=h;
	}
	else {
      var h = pag;
      //alert(h);
      location=pag;
   }
hypertext(alts);
}
//RAB:función exclusiva para la página inf_prof.asp
function pestana2(cual,url){
	//alert("entra en pestana2");
	if (location.href.indexOf('info_prof')!=-1){
		if (cual!=2){
         //alert(auxB);
			formul=(!eval('men'+cual))?'<form method="post" action='+auxB+'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td rowspan=4><img src="img/sp.gif" width="10" height="1"></td><td colspan=2 class="txtmsec"><br><br></td><tr><td class="txtmN0" align=left>Usuario:</td><td><input type="default" size=12 class="forItx" name="usr" value=""></td><tr><td class="txtmN0" align=left>Contraseña:</td><td></td><tr><td colspan=2 align=center class="txtmsecp">(Si no dispone de claves <a href="javascript:info()">inf&oacute;rmese</a>)<br></td><tr><td colspan=3 align="center"><br><input type="image" src="img/ic_ok.gif" width="51" height="15" border=0></td></form></table>':null;
			//formul=(!eval('men'+cual))?'<form method="post" action='+auxB+'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td rowspan=4><img src="img/sp.gif" width="10" height="1"></td><td colspan=2 class="txtmsec"><br><br></td><tr><td class="txtmN0" align=left>Usuario:</td><td><input type="default" size=12 class="forItx" name="usr" value=""></td><tr><td class="txtmN0" align=left>Contraseña:</td><td></td><tr><td colspan=2 align=center class="txtmsecp">(Si no dispone de claves <a href="javascript:info()">inf&oacute;rmese</a>)<br></td><tr><td colspan=3 align="center"><br><input type="image" src="img/ic_ok.gif" width="51" height="15" border=0></td></form></table>':null;
			
			
			//formul=(!eval('men'+cual))?'<form method="post" name="form_login"><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td rowspan=4><img src="img/sp.gif" width="10" height="1"></td><td colspan=2 class="txtmsec">Por favor, introduzca sus datos para entrar en el &aacute;rea reservada:<br><br></td><tr><td class="txtmN0" align=left>Usuario:</td><td><input type="default" size=12 class="forItx" name="usr" value=""></td><tr><td class="txtmN0" align=left>Contraseña:</td><td><input type="password" size=12 class="forItx" name="pwd" value=""></td><tr><td colspan=2 align=center class="txtmsecp">(Si no dispone de claves <a href="info_prof.asp">inf&oacute;rmese</a>)<br></td><tr><td colspan=3 align="center"><br><a href="javascript:Login('redireccionar.asp')"><image src="img/ic_ok.gif" width="51" height="15" border=0></a></td></form></table>':null;
			eval("pest"+cual+" = new menu('pest"+cual+"',(formul)?'':'men"+cual+"',219,null,0,245,['txtmN0','txtmsec'],[['ic0_list',9,9],['ic_list',7,9]],'#E86F05',(formul)?formul:null,'mover','referer',702,'finMenu','menAfter',"+cual+")");
		} else eval("pest"+cual+" = new menu('pest"+cual+"','men"+cual+"',219,null,0,245,['txtmN0','txtmsec'],[['ic0_list',9,9],['ic_list',7,9]],'#E86F05',menAnt,'mover','referer',702,'finMenu','menAfter',"+cual+")");
			pestAct=cual;eval('pesta'+cual+'=1');
		//else eval('pest'+cual+'.disp(1)');
	pestAct=cual;
	document.images[arrImg[pestAct]].src='img/'+arrImg[pestAct]+'on.gif';	
	}
}

/*function open(){
	wOpen('http://www.recursosenred.profes.net');
}*/

function pestana(cual,url){
	
	//alert ("cual: " + cual)
	//alert ("auxB: " + auxB)
	if(cual==pestAct)return;
		if(pestAct==null){
			return;			
		}
			eval('pest'+pestAct+'.disp(0)');	
		

	document.images[arrImg[pestAct]].src='img/'+arrImg[pestAct]+'off.gif';
	// quitado la distincion del caso 2 pues ya no existe.
	//if(cual==2){if(pIni==2)pest2.disp(1);else {chEstado(url,2);return}}
	//else{
		if(!eval('pesta'+cual)){
			if (cual!=2){
//I KIBS
// Se ha modificado el nombre de los campos de entrada login y password para que se llamen igual que en otros aplicativos
// Se ha cambiado el método de envio de Post a get
			//alert(auxB);
			
   			//formul=(!eval('men'+cual))?'<form method="get" name="frmLogin" action='javascript:wOpen('www.e-sm.net/vademecum')'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td width="10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50"><a href="http://www.recursosenred.profes.net" target="new"><input aling="right" type="image" src="img/ic_ok.gif" width="51" height="15" border=0></a></td></tr></table></form>':null;
   			//formul=(!eval('men'+cual))?'<form method="get" name="frmLogin" action='+auxB+'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td width="10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50"><a href="http://www.recursosenred.profes.net" target="new"><input aling="right" type="image" src="img/ic_ok.gif" width="51" height="15" border=0></a></td></tr></table></form>':null;
   			//auxB='portada.asp'
   			//formul=(!eval('men'+cual))?'<form method="get" name="frmLogin" action='+auxB+'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td width="10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50"><a href="http://www.recursosenred.profes.net" target="new"><input aling="right" type="image" src="img/ic_ok.gif" width="51" height="15" border=0></a></td></tr></table></form>':null;
   			
   			
   			//formul=(!eval('men'+cual))?'<form method="get" name="frmLogin" action='+auxB+'><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td width="10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="50"><input aling="right" type="image" onclick="open();" src="img/ic_ok.gif" width="51" height="15" border=0></td></tr></table></form>':null;
   			formul=(!eval('men'+cual))?'<table border=0 cellpadding=0 cellspacing=3 width="100%"><tr><td align="center" colspan=3 class="txtmsec">Acceso a recursos en red</br>(Un servicio exclusivo de profes.net)</br></td></tr><tr align="center"><td width="100%"></br><a href="http://www.secundaria.profes.net/" target="new"><img src="img/ic_ok.gif" width="51" height="15" border=0></a></td></tr></table>':null;
   			
   			//alert(formul);
   			//wOpen('http://www.recursosenred.profes.net');
//F KIBS
				//formul=(!eval('men'+cual))?'<form method="post" name="form_login"><table border=0 cellpadding=0 cellspacing=3 width="10"><tr><td rowspan=4><img src="img/sp.gif" width="10" height="1"></td><td colspan=2 class="txtmsec">Por favor, introduzca sus datos para entrar en el &aacute;rea reservada:<br><br></td><tr><td class="txtmN0" align=left>Usuario:</td><td><input type="default" size=12 class="forItx" name="usr" value=""></td><tr><td class="txtmN0" align=left>Contraseña:</td><td><input type="password" size=12 class="forItx" name="pwd" value=""></td><tr><td colspan=2 align=center class="txtmsecp">(Si no dispone de claves <a href="info_prof.asp">inf&oacute;rmese</a>)<br></td><tr><td colspan=3 align="center"><br><a href="javascript:Login('redireccionar.asp')"><image src="img/ic_ok.gif" width="51" height="15" border=0></a></td></form></table>':null;
				eval("pest"+cual+" = new menu('pest"+cual+"',(formul)?'':'men"+cual+"',219,null,0,245,['txtmN0','txtmsec'],[['ic0_list',9,9],['ic_list',7,9]],'#E86F05',(formul)?formul:null,'mover','referer',702,'finMenu','menAfter',"+cual+")");
				//eval("pest"+cual+" = new menu('pest"+cual+"','men"+cual+"',219,null,0,220,['txtmN0','txtmsec'],[['ic0_list',9,9],['ic_list',7,9]],'#E86F05',menAnt,'mover','referer',702,'finMenu','menAfter',"+cual+")");
			} else eval("pest"+cual+" = new menu('pest"+cual+"','men"+cual+"',219,null,0,245,['txtmN0','txtmsec'],[['ic0_list',9,9],['ic_list',7,9]],'#E86F05',menAnt,'mover','referer',702,'finMenu','menAfter',"+cual+")");
			pestAct=cual;eval('pesta'+cual+'=1');
		} 
		else eval('pest'+cual+'.disp(1)');
	//}
	pestAct=cual;
	document.images[arrImg[pestAct]].src='img/'+arrImg[pestAct]+'on.gif';

}


function creaFE(){
	if(this.nHijo=='fin'){
		html_finm=(eval(this.args[13]))?eval(this.args[13]):'';
		html_aft=(this.padre.HTMLEnd)?this.padre.HTMLEnd:'';
		cont=html_finm+html_aft;
		tmp =arena(this.id,null,0,0,this.args[2],null,'hide',null,null,cont);
		this.H=tmp.h;
		return tmp;
	}
	if(this.padre.HTMLst && this.nHijo==0){
		tmp =arena(this.id,null,0,0,this.args[2],null,'hide',null,this.args[8],this.cont);
		this.H=tmp.h;
		if(nav=='ns4')tmp.ref.clip.right=this.args[2];
		return tmp;
	}
	img = (this.icono)?this.icono:'';
	add=(this.level>0)?'<td><img src="img/sp.gif" width=9 height=1></td>':'';
   golink = (this.Link && this.Link.indexOf("redireccionar.asp") != -1) ? this.Link : 'javascript:'+this.ref+'.chEstado();';
	tmp =arena(this.id,null,0,0,this.args[2],null,'hide',0,this.args[8],'<table border=0 cellpadding=0 cellspacing=0><tr><td><img src="img/sp.gif" width="5" height="1"></td>'+add+'<td valign=top>'+img+'</td><td><a href="'+ golink +'" class="'+this.padre.clases[this.level]+'">'+this.cont+'</a></td></table>');
	this.H=tmp.h;
	tmp.ref.cursor=(document.all)?"hand":"pointer";
	tmp.mOver(this.args[10]+'("'+this.ref+'",1,null,"'+this.args[8]+'")');
	tmp.mOut(this.args[10]+'("'+this.ref+'",0,null,"'+this.args[8]+'")');
//	tmp.mClick(this.ref+'.chEstado()');
	if(nav=='ns4')tmp.ref.clip.right=this.args[2];
	return tmp;
}

function set(px,py,est){
	if(this.elm){
		altura=0;
		for(var z=0;z<this.elm.length;z++){
//(z==0)?this.elm[z].obj.move(px,py):(this.elm[z-1].estado && this.elm[z-1].elm)?this.elm[z].obj.move(px,(this.elm[z-1].elm[this.elm[z-1].elm.length-1].obj.y+this.elm[z-1].elm[this.elm[z-1].elm.length-1].H)):this.elm[z].obj.move(px,this.elm[z-1].obj.y+this.elm[z-1].H);
		if(z==0){
			this.elm[z].obj.move(px,py);
		}else{
			if(this.elm[z-1].estado && this.elm[z-1].elm){
				this.elm[z].obj.move(px,(this.elm[z-1].elm[this.elm[z-1].elm.length-1].obj.y+this.elm[z-1].elm[this.elm[z-1].elm.length-1].H));	
			}else{
				this.elm[z].obj.move(px,this.elm[z-1].obj.y+this.elm[z-1].H);
		}
}
		this.elm[z].obj.show();
		if(this.elm[z].estado && this.elm[z].elm){
			this.elm[z].set(px,this.elm[z].obj.y+this.elm[z].H);
		}
		altura = altura + this.elm[z].H;
		}
		/*if(!this.padre){
			if(nav=='ns6' && this.args[11]){
			imag=eval('document.images.'+this.args[11]);
				if(imag.offsetLeft!=px){this.px=imag.offsetLeft;this.set(this.px,py);}
			}
		}*/
		if(!this.padre){
			if(nav=='ns6' && this.args[11]){
			imag=eval('document.images.'+this.args[11]);
				if(imag.x!=px){this.px=imag.x;this.set(this.px,py);}
			}
		}
		if(nav=='ns4')if((document.height-(py+altura))<0)document.height=(py+altura)+40;
		return altura;
	}

}

function mover(ref,acc,cont,col){
	colorOn="#000000",colorOff=col,nod=eval(ref).obj;
	(acc)?nod.color(colorOn):(ref.estado)?nod.color(colorOn):nod.color(colorOff);
	window.defaultStatus=(acc)?cont:"";
}
function wOpen(url,w,h,name,type){
	var px=(screen.width/2)-(w/2)-16;
	var py=(type)?0:(screen.height/2)-(h/2)-32;
	var vaux=(type)?1:0;
	nw=window.open(url,((name)?name:'smlv'), 'fullscreen=0,toolbar='+vaux+',location='+vaux+',directories='+vaux+',status='+vaux+',menubar='+vaux+',scrollbars='+vaux+',resizable='+vaux+',width='+w+',height='+h+',top='+py+',left='+px);
}