/**********************************************************************************   
SlideMenu 
*   Copyright (C) 2001 Thomas Brattli
*   This script was released at DHTMLCentral.com
*********************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()
//Opera didn't seem to like the padding in the layers, it messes up the background-images, so here's a version without it.
if(bw.opera5) document.write("<style>DIV.clSlide{padding:0px; background-image:url(' ')}\nDIV.clSlideSub{padding:0px; background-image:url(' ')}\nDIV.clSlideSub2{padding:0px; background-image:url(' ')}</style>")

/************************************************************************************
Making cross-browser objects
************************************************************************************/
function makeMenuObj(obj,nest){
	nest=(!nest) ? "":'document.'+nest+'.'										
   	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;	
	this.ref=bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;		
	this.x=(bw.ns4 || bw.ns5)? this.css.left:this.css.offsetLeft;
	this.y=(bw.ns4 || bw.ns5)? this.css.top:this.css.offsetTop;		
	this.hideIt=b_hideIt; this.showIt=b_showIt; this.movey=b_movey
	this.moveIt=b_moveIt; this.moveBy=b_moveBy; this.status=0; 
	this.bgImg=b_bgImg;	this.obj = obj + "Object"; eval(this.obj + "=this"); 
	this.clipTo=b_clipTo;
	return this
}
function b_showIt(){this.css.visibility="visible"; this.status=1}
function b_hideIt(){this.css.visibility="hidden"; this.status=0}
function b_movey(y){this.y=y; this.css.top=this.y}	
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x;this.css.top=this.y}
function b_moveBy(x,y){this.x=this.x+x; this.y=this.y+y; this.css.left=this.x;this.css.top=this.y}
function b_bgImg(img){if(bw.ie||bw.dom)this.css.backgroundImage="url("+img+")"
else this.css.background.src=img
}
function b_clipTo(t,r,b,l,w){if(bw.ns4){this.css.clip.top=t;this.css.clip.right=r
this.css.clip.bottom=b;this.css.clip.left=l
}else{this.css.clip="rect("+t+","+r+","+b+","+l+")"; if(w){this.css.width=r; this.css.height=b}}}
/********************************************************************************
Initiating page, making objects..
********************************************************************************/
function SlideMenuInit(){
	oSlideMenu=new makeMenuObj('divSlideCont')
	oSlideMenu.moveIt(menux,menuy)
	oSlide=new Array()
	for(i=0;i<menus.length;i++){
		oSlide[i]=new makeMenuObj('divSlide'+i,'divSlideCont')
		oSlide[i].subs=menus[i].subs
		oSlide[i].sub=new Array()
		oSlide[i].moveIt(0,mainheight*i)
		oSlide[i].starty=oSlide[i].y
    if(bw.opera) oSlide[i].css.paddingLeft="10px"
		if(!menus[i].seperator) oSlide[i].bgImg(level0_regular)
		for(j=0;j<oSlide[i].subs;j++){
			oSlide[i].sub[j]=new makeMenuObj('divSlideSub'+i+"_"+j,'divSlideCont')
			oSlide[i].sub[j].moveIt(10,oSlide[i].y+subheight*j+between)
			oSlide[i].sub[j].starty=oSlide[i].sub[j].y
			oSlide[i][j]=new Array()
			oSlide[i][j].subs=menus[i][j].subs
			oSlide[i][j].sub=new Array()
			img=level1_round
			if(oSlide[i][j].subs!=0){
				if(j!=oSlide[i].subs-1) img=level1_sub
				else img=level1_sub_round
				oSlide[i].sub[j].css.color="white"
			}else{
				if(j!=oSlide[i].subs-1)img=level1_regular
			}
			oSlide[i].sub[j].origimg=img
			oSlide[i].sub[j].bgImg(img)
			for(a=0;a<oSlide[i][j].subs;a++){
				oSlide[i][j].sub[a]=new makeMenuObj('divSlideSub'+i+"_"+j+"_"+a,'divSlideCont')
				oSlide[i][j].sub[a].moveIt(20,oSlide[i].sub[j].y+subheight*a+between-2)
				oSlide[i][j].sub[a].starty=oSlide[i][j].sub[a].y			
				oSlide[i][j][a]=new Array()
				oSlide[i][j][a].subs=menus[i][j][a].subs
				oSlide[i][j][a].sub=new Array()
				if(a!=oSlide[i][j].subs-1) img=level2_regular
				else img=level2_round
				oSlide[i][j].sub[a].origimg=img
				oSlide[i][j].sub[a].bgImg(img)
			}
		}
	}
	oSlideMenu.showIt()
}
/********************************************************************************
Variables
********************************************************************************/
var active=-1;var going;var isthere; var sactive=-1; var sisthere=-1; var s2active=-1; var s2isthere=-1
/********************************************************************************
Switch menu function.
********************************************************************************/
function swmenu(num,snum,s2num){
	if(snum!=-1){
		if(oSlide[num][snum].subs==0) return
	}
	if(s2num!=-1){
		if(oSlide[num][snum][s2num].subs==0) return
	}
	if((num!=active || snum!=sactive || s2num!=s2active) && !going){going=true;isthere=0;sisthere=0;moveUp(num,snum,s2num)}
}
/********************************************************************************
Moving the menus upward to their original position.
********************************************************************************/
function moveUp(num,snum){
	if(snum==-1){
		for(i=0;i<oSlide.length;i++){
			if(oSlide[i].y>oSlide[i].starty+pxspeed && active!=i) oSlide[i].moveBy(0,-pxspeed)
			else{if(active!=i) oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty); isthere=i}
		}
		
		if(isthere<oSlide.length-1) setTimeout("moveUp("+num+","+snum+")",timspeed)
		else swmenu2(num,snum)
	}else{
		if(num==oSlide.length-1) isthere=num
	
		if(sactive!=-1){ //Is out!
			//Slide subs
			j=0
			for(i=sactive+1;i<oSlide[num].sub.length;i++){
				j++
				if(oSlide[num].sub[i].y>oSlide[num].sub[i].starty+pxspeed) oSlide[num].sub[i].moveBy(0,-pxspeed)
				else{oSlide[num].sub[i].moveIt(oSlide[num].sub[i].x,oSlide[num].sub[i].starty); sisthere=i}
			}
			//Slide main
			for(i=num+1;i<oSlide.length;i++){
				if(oSlide[i].y>oSlide[i].starty + oSlide[num].sub[sactive].y +subheight*j )  oSlide[i].moveBy(0,-pxspeed)
				else{oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty + oSlide[num].sub[sactive].y +subheight*j ); isthere=i}
			}
		}else{ //Slide to the one clicked
			for(i=num+1;i<oSlide.length;i++){
				if(oSlide[i].y>oSlide[i].starty + snum*between+between)  oSlide[i].moveBy(0,-pxspeed)
				else{oSlide[i].moveIt(oSlide[i].x,oSlide[i].starty + snum*between+between); isthere=i}
			}
		}
		if(isthere<oSlide.length-1 || (sactive!=-1 && sisthere<oSlide[num].sub.length-1 && sactive!=oSlide[num].sub.length-1)) setTimeout("moveUp("+num+","+snum+")",timspeed)
		else swmenu2(num,snum)
	}
}
/********************************************************************************
Switch menu 2, stuff that happens before the menus are moved down again.
********************************************************************************/
function swmenu2(num,snum){
	isthere=0;
	sisthere=0;
	if(active>-1 && snum==-1){
		//Hiding submenus
		for(j=0;j<oSlide[active].subs;j++){oSlide[active].sub[j].hideIt()}
		oSlide[active].bgImg(level0_regular)
		oSlide[active].moveIt(0,oSlide[active].starty)
	}
	if(sactive>-1){
		//Hiding submenus
		for(j=0;j<oSlide[active][sactive].sub.length;j++){oSlide[active][sactive].sub[j].hideIt()}
		oSlide[active].sub[sactive].bgImg(oSlide[active].sub[sactive].origimg)
		oSlide[active].sub[sactive].moveIt(10,oSlide[active].sub[sactive].starty)
		//Move back to place
		for(i=sactive+1;i<oSlide[active].sub.length;i++){
			oSlide[active].sub[i].moveIt(oSlide[active].sub[i].x,oSlide[active].sub[i].starty)
		}
	}
	active=num
	//Showing submenus
	if(snum>-1){
		sactive=snum
		for(j=0;j<oSlide[num][snum].sub.length;j++){oSlide[num][snum].sub[j].showIt()}
		oSlide[num].sub[snum].moveBy(10,3)
		oSlide[num].sub[snum].bgImg(level1_round2)
	}else{
		sactive=-1
		for(j=0;j<oSlide[active].subs;j++){oSlide[active].sub[j].showIt()}
		oSlide[num].moveBy(10,3)
		oSlide[num].bgImg(level0_round)
	}
	if(num!=oSlide.length-1) moveDown(num,snum)
	else{
		isthere=num
		moveDown(num,snum)
	}
}
/********************************************************************************
Moving the menus down
********************************************************************************/
function moveDown(num,snum){
	//if(num==oSlide.length-1) isthere=num
	for(i=num+1;i<oSlide.length;i++){
		if(snum==-1){
			if(oSlide[i].y<(oSlide[num].subs-1)*subheight+oSlide[i].starty+between-pxspeed) oSlide[i].moveBy(0,pxspeed)
			else{oSlide[i].moveIt(oSlide[i].x,(oSlide[num].subs-1)*subheight+oSlide[i].starty+between); isthere=i}
		}else{
			if(oSlide[i].y<(oSlide[num].subs-1)*subheight+oSlide[i].starty+between-pxspeed + (oSlide[num][snum].subs-1)*subheight+between)  oSlide[i].moveBy(0,pxspeed)
			else{oSlide[i].moveIt(oSlide[i].x,(oSlide[num].subs-1)*subheight+oSlide[i].starty+between  + (oSlide[num][snum].subs-1)*subheight+between); isthere=i}
		}
	}
	if(snum!=-1){
		for(i=snum+1;i<oSlide[num].sub.length;i++){		
			if(oSlide[num].sub[i].y<(oSlide[num][snum].subs-1)*subheight+oSlide[num].sub[i].starty+between-pxspeed) oSlide[num].sub[i].moveBy(0,pxspeed)
			else{oSlide[num].sub[i].moveIt(oSlide[num].sub[i].x,(oSlide[num][snum].subs-1)*subheight+oSlide[num].sub[i].starty+between); sisthere=i}
		}
	}
	if(snum==-1){
		if(isthere<oSlide.length-1) setTimeout("moveDown("+num+","+snum+")",timspeed)
		else going=false
	}else{
		if(isthere<oSlide.length-1 || (sisthere<oSlide[num].sub.length-1 && snum!=oSlide[num].sub.length-1)) setTimeout("moveDown("+num+","+snum+")",timspeed)
		else going=false
	}
}
var test=0
/********************************************************************************
Functions to write out the layers...
********************************************************************************/
menus=new Array(); var a=0; var b=0; var c=0; var d=0
function makeMenu(type,text,lnk,target,end){
	str=""; tg="";
  if(target) tg='target="'+target+'"'
  if(!lnk) lnk="#"
  self.status=lnk
	if(a==0) str='<div id="divSlideCont">\n'
	if(type=="top"){
		menus[a]=new Array();
		if(text=="seperator"){
			str+='\t<div id="divSlide'+a+'" class="clSlide"></div>\n'
			menus[a].seperator=1
		}else{
      str+='\t<div id="divSlide'+a+'" class="clSlide"><a href="'+lnk+'" '+tg+' onclick="swmenu('+a+',-1,-1); if(bw.ie || bw.ns6) this.blur(); '
      if(lnk=="#") str+='return false'
      str+='" class="clSlideLinks"> '+text+'</a><br></div>\n'
		}
    menus[a].subs=0; a++; b=0
	}else if(type=="sub"){
		str+='\t\t<div id="divSlideSub'+(a-1)+'_'+(b)+'" class="clSlideSub"><a '+tg+' onclick="swmenu('+(a-1)+','+b+',-1); if(bw.ie || bw.ns6) this.blur(); '
    if(lnk=="#") str+='return false'
    str+='" href="'+lnk+'" class="clSlideSubLinks">  '+text+'</a><br></div>\n'
		b++; menus[a-1].subs=b; menus[a-1][b-1]=new Array(); c=0; menus[a-1][b-1].subs=0
	}else if(type=="sub2"){
		str+='\t\t<div id="divSlideSub'+(a-1)+'_'+(b-1)+'_'+c+'" class="clSlideSub2"><a '+tg+' href="'+lnk+'" class="clSlideSub2Links">  '+text+'</a><br></div>\n'
		c++; menus[a-1][b-1].subs=c; menus[a-1][b-1][c-1]=new Array(); d=0; menus[a-1][b-1][c-1].subs=0
	}
	if(end) str+="</div>"
	document.write(str)
}
function preLoadBackgrounds(){
  for(i=0;i<arguments.length;i++){
    this[i]=new Image()
    this[i].src=arguments[i]
  }
  return this
}

//cambio de imágenes al realizar mouseOver y mouseOut
function img_sobre(imgname){	backgroundImage = "url(img/modulos/btn_menuheaderUTIL.gif)"	}
function img_fuera(imgname){	imgname.src = "pics_cicg/dot1.gif"		}

function chgBgImg(principal)
{
	var bgImg = new String;
	document.getElementById("btn_menuheaderUTIL_" + principal).style.backgroundImage = "url(img/modulos/btn_menuheaderUTIL.gif)";
}



//Para evitar que se use botón derecho.
//function right(e) {
//if (navigator.appName == 'Netscape' &&
//(e.which == 3 || e.which == 2))
//return false;
//else if (navigator.appName == 'Microsoft Internet Explorer' &&
//(event.button == 2 || event.button == 3)) {
//alert("Lo Siento, usted no tiene permiso para hacer click derecho.");
//return false;
//}
//return true;
//} 

//document.onmousedown=right;
//document.onmouseup=right;
//if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//if (document.layers) window.captureEvents(Event.MOUSEUP);
//window.onmousedown=right;
//window.onmouseup=right; 


function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        }
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }
    return true;
}

//cambio de imágenes al realizar mouseOver y mouseOut
function img_sobre(imgname){	imgname.src = "img/vineta.gif"	}
function img_fuera(imgname){	imgname.src = "img/bolita.gif"		}



function openNewPage(form) 
{
        
        var newpage=form.clima.selectedIndex;
        window.location=form.clima.options[newpage].value;
        
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function check_form(form_name)
{
  if (submitted == true)
  {
  	alert("Ya ha enviado el formulario. Pulse Aceptar y espere a que termine el proceso.");
    return false;
  }
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

//******************************************************************************************************//
//******************************************************************************************************//

//EDITOR DE TEXTO TIPO WORD
_editor_url = "librerias/htmlarea/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }


//******************************************************************************************************//
//******************************************************************************************************//

var ImagenMenos= new Image();
ImagenMenos.src='img/pics/menos.gif';

	function browserdetect(){
		//returns 1 for IE, 2 for Opera,3 for N6,4 for N4 and others
		UserAgent=navigator.userAgent;
		agente=UserAgent.substring(51,56);		
		if (agente=="Opera") {return 2;}
		if(navigator.appName=="Microsoft Internet Explorer"){return 1;}
		else if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)==5){return 3;}
		else{return 4;}
	}
	
	var Navegador=browserdetect();
	
	function showHideOpciones(ObjTabla,objIma){		
		MuestraTabla(ObjTabla);
		if (objIma!='') CambiaMasMenos(Cambio,objIma);
	}
	
	function MuestraTabla(ObjTabla){
		obj=document.getElementById(ObjTabla);		
		for (i=0; i<obj.rows.length;i++){			
			if (obj.rows[i].style.display=='none') {							
				if (Navegador==1) obj.rows[i].style.display='block';
				else obj.rows[i].style.display='table-row';
				Cambio=0;				
			}else{
				obj.rows[i].style.display='none';
				Cambio=1;
			}
		}
	}
		
	function CambiaMasMenos(Visualiza,obj){				
		if (Visualiza==0){			
			document.images[obj].src=ImagenMenos.src;
		}else{
			document.images[obj].src='img/pics/mas.gif';
		}
	}


//función de ampliar imagen
function ampImagen(titulo,imagen,ancho,alto)
{
//alert(titulo+" "+imagen);
var x = ancho + 20;

var hoy=new Date();
anio_actual=parseInt(hoy.getFullYear());

var pagina ='<html><head><title>INOCAR - Recursos gráficos: '+titulo+' -</title>\n'+
//'<link rel="stylesheet" href="http://localhost/INOCAR/estilos/estilosINOCAR1.css" type="text/css">\n'+
'<link rel="stylesheet" href="estilos/estilosINOCAR1.css" type="text/css">\n'+
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>\n'+
'<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onblur="self.close();return true">\n'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">\n'+
'<tr><td bgcolor="#FFFFFF" class="masResalte" align="center">INSTITUTO OCEANOGRÁFICO DE LA ARMADA</td></tr>\n'+
'<tr><td bgcolor="#336699" class="spacer">&nbsp;</td></tr>\n'+

'<tr><td><table border="0" cellspacing="0" cellpadding="4">\n'+
'<tr><td align="center"><img src='+imagen+' border="1"></td></tr>\n'+
'</table></td></tr>\n'+

'<tr><td align="center" height="20"><a href="javascript:self.close();" class="menues">Cerrar Ventana</a></td></tr>\n'+
'<tr><td bgcolor="#DEDED4" class="preNews">CopyRight©Derechos reservados INOCAR '+anio_actual+'</td></tr>\n'+
'</table>\n'+
'</body>\n'+
'</html>\n'

var scrolls;
var resize;

if(alto>=670)
{
	scrolls='yes';
	resize='yes';
}
else
{
	scrolls='no';
	resize='no';	
}

var newwin = window.open('','foto','width='+ancho+',height='+alto+',scrollbars='+scrolls+',status=no,resizable='+resize+',left=150,top=150');
newwin.document.write(pagina);
newwin.focus();
}


function OpenSurvey()
{
	open('portafolio.html','Portafolio','scrollbars=no,width=350,height=250');
}

function OpenSurvey1()
{
	open('invitacion.html','invitacion','scrollbars=no,width=520,height=480');
}



<!-- Esto es para la nueva versión del menú -->

function mOvr(src)
{
	if (!src.contains(event.fromElement))
	{
		src.style.cursor = 'hand';
		src.bgColor = '#E4E4E4';
		src.style.border = 'solid #CCCCCC 1px';
	}
}

function mOut(src) 
{
	if (!src.contains(event.toElement)) 	
	{
		src.style.cursor = 'default';
		src.bgColor = '#F0F0F0';
		src.style.border = 'solid #F0F0F0 1px';
	}
}

//FUNCIONES PARA ABRIR VENTANAS
//***************************************************************************************************
//***************************************************************************************************

function AbrirVentana(sHRef,nWidth,nHeight,sScrolls, sName) {
var nLeft
var nTop
	nLeft = (screen.width - nWidth) / 2;
	nTop = (screen.height - nHeight) / 2 - 20;
	return window.open(sHRef,sName,'width='+nWidth+',height='+nHeight+',left='+nLeft+',top='+nTop+',scrollbars='+sScrolls);
}

function OpenWin(nivel,fuente)
{
	if(nivel==0)	
	{	dir="";		}	
	else if(nivel==1)
	{	dir="../";		}
	else if(nivel==2)
	{	dir="../../";	}			
	
	switch (fuente)
	{
		case 'contacto':
			window.open(''+dir+'contacto.php','contacto','width=330,height=392,top=185,left=300')
		break
		case 'registro':
			window.open(''+dir+'registro/registro.php','registro','width=350,height=394,top=185,left=300')
  		break 
		case 'firmar':
			window.open(''+dir+'firmar.php','firmar','width=330,height=395,top=185,left=300')
		break
		case 'avisomensual':
			//window.open(''+dir+'ver_avisos.php','avisosmensuales','width=330,height=280,top=185,left=300')
		var propiedades = 'height=280,width=460,top='+(screen.height-280)/2+',left='+(screen.width-460)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'ver_avisos.php','Avisos mensuales',propiedades)
		break		
		case 'presentaciones':
		  	var propiedades = 'height=330,width=458,top='+(screen.height-330)/2+',left='+(screen.width-458)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'especiales/taller_geologia/presentaciones.html','exposiciones',propiedades)
		break		
		case 'oficiales':
		  	var propiedades = 'height=405,width=650,top='+(screen.height-405)/2+',left='+(screen.width-650)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'oficiales.php','oficiales',propiedades)
		break	
		
		case 'ICGPTWS':
		  	var propiedades = 'height=570,width=725,top='+(screen.height-570)/2+',left='+(screen.width-725)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'especiales/ICG_PTWS_XXII.html','ICGPTWS',propiedades)
		break		
		
		case 'calendario':
		  	var propiedades = 'height=422,width=480,top='+(screen.height-422)/2+',left='+(screen.width-480)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'mareas/calendario.php','calendario',propiedades)
		break		
		
		case 'cartas':
		  	var propiedades = 'height=360,width=480,top='+(screen.height-360)/2+',left='+(screen.width-480)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'mareas/cartas.php','cartas',propiedades)
		break		
		
		case 'TSM':
		  	var propiedades = 'height=181,width=480,top='+(screen.height-181)/2+',left='+(screen.width-480)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'especiales/TSM.html','TSM',propiedades)
		break		
		case 'videos':
		  	var propiedades = 'height=140,width=500,top='+(screen.height-140)/2+',left='+(screen.width-500)/2+',scrollbars=no,resizable=no,dependent=yes,alwaysraised=yes,toolbar=no'
			window.open(''+dir+'videos/videos.php','videoteca',propiedades)
		break		
	}
}


function windowOpener(url,width,height,name,scrolls)
{ 
		browserName = navigator.appName; 
        browserVer = navigator.appVersion.substring(0,1);
        if (scrolls==true) { 
                scrollsOption="yes"; 
        } else { 
                scrollsOption="no"; 
        } 
        var l = ( (window.screen.width - width) / 2 );
		var t = ( (window.screen.height - height) / 2 );
		if (browserName != "Netscape" || browserVer != 2) { 
                controlWindow=window.open( 
                url,name,"toolbar=no,height="+height+",width="+width+",location=no,directories=no,status=no,menubar=no,top="+t+",left="+l+",screenX="+l+",screenY="+t+",scrollbars="+scrollsOption+",resizable=no" 
                ); 
        } 
} 


function windowFull(url,name)
{
        var w = window.open(url,name, "width="+screen.width+", height="+screen.height+", screenX=0,screenY=0, top=0, left=0, status=no , resizable=no, scrollbars=yes" );
		w.moveTo(0,0);
		w.resizeTo(screen.availWidth,screen.availHeight);
		w.focus();
}


var siteWin = null;

function launchSiteWin(URL, windowName, windowWidth, windowHeight, scrollbars)
{
	var xposition = 400; 
	var yposition = 300;
	
    if ((parseInt(navigator.appVersion) >= 4 )) {
        xposition = (screen.width - windowWidth) / 2;
        yposition = (screen.height - windowHeight) / 2;
    }
	
	if (!scrollbars) var scrollbars = 0;
	
    var args = "width=" + windowWidth + ","
	    	+ "height=" + windowHeight + ","
	    	+ "location=0,"
		    + "menubar=0,"
		    + "scrollbars=" + scrollbars + ","
		    + "status=0,"
		    + "titlebar=0,"
		    + "hotkeys=0,"
		    + "screenx=" + xposition + ","  // NN Only
		    + "screeny=" + yposition + ","  // NN Only
		    + "left=" + xposition + ","     // IE Only
		    + "top=" + yposition;           // IE Only
		
	if (siteWin != null && !siteWin.closed) {
		siteWin.close();
	}
	siteWin = window.open(URL, windowName, args);
	// window.open('/sa_popup.html','sweptaway','width=280,height=390,resizable=no,scrollbars=no,toolbar=no,directories=no,status=no');

	siteWin.focus();
}

function doPopUp_(url,ww,wh,rs)
{
	var ww_=ww/2;
	var wh_=wh/2;
	
	var doPopUpX = ((screen.width/2)-ww_);
	var doPopUpY = ((screen.height/2)-wh_);
	var pos = "left="+doPopUpX+",top="+doPopUpY;

	if (rs == 0)
	{
		var rs = "no";		
	}
	else
	{
		var rs = "yes";
	}
	doPopUpWindow = window.open(url,"mywin",'width='+ww+',height='+wh+',resizable='+rs+','+pos);
}


//Poner en el body
//<body>
//<script>resizear(600,500);<script>
function resizear(ancho, alto)
{
	var altopagina = screen.height;
	var anchopagina = screen.width;
	window.resizeTo(ancho,alto);
	var wtop=(altopagina-alto)/2;
	var wleft=(anchopagina-ancho)/2;
	window.moveTo(wleft, wtop);
}

//***************************************************************************************************
//***************************************************************************************************

//FUNCIÓN PARA MOSTRAR/OCULTAR INFORMACIÓN
//***************************************************************************************************
function expand(alfa,beta){
	if (document.getElementById(alfa).style.display == 'none'){
		document.getElementById(alfa).style.display = 'block';
		document.getElementById(beta).src = '../img/modulos/tab_seta_on.gif';
	}else{
		document.getElementById(alfa).style.display = 'none';
		document.getElementById(beta).src = '../img/modulos/tab_seta_off.gif';
	}
}
//***************************************************************************************************


<!-- MENU (1)-->
/* Muestra los links empleando una función que toma como parámetro la categoría del menú
los mismos que se encuentran en una tabla de la función hace_menu de libreria.php*/
<!-- ************************************************************************************* -->
<!-- ************************************************************************************* -->

isOPERA = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
isIE    = (document.all && !isOPERA)? true : false;
isDOM   = (document.getElementById && !isIE && !isOPERA)? true : false;

var tot_pestanas=3;
var cantidad=6;		//cantidad= número de categorías (menúes) que se tendrán
var entrada=true;
content = new Array ();

for (i=0; i<cantidad;i++){
	content ["sub_"+i] = true;
}

function show (id, displayValue){
	//MM_swapImage('img_' + id ,'','file://///rojo/webs/clubmed/desarrollo/js/images/html/Spin.gif',1);
	if (isDOM)
		document.getElementById(id).style.display = (displayValue)? displayValue: "block";
	else if (isIE)
		document.all[id].style.display = "block";
}	

function menu(id){
	//delCookie('itemmenu');
	//escribe_cookie('itemmenu', id,'256000000')	
	hide_all();
	if (content [id] || entrada){
		show (id, 'table-row');
		content [id] = false;
		entrada = false;
		for (x=0; x < cantidad; x++){
			content ["sub_"+x] = true;
		}
		content [id] = false;
	}else{
		entrada=true;
	}	
	//alert(id);
}

function hide (id){
	//MM_swapImgRestore();
	if (isDOM)
		document.getElementById(id).style.display = "none";
	else if (isIE)
		document.all[id].style.display = "none";
		//alert(id);
}

function hide_all() {
	/*for (i=0; i<cantidad;i++){
		hide("sub_"+i)
	}*/
	//Cuando se habilite la categoría 3, se podrá emplear el lazo for
	
	hide("sub_1");
	hide("sub_2");
	hide("sub_4");
	hide("sub_5");
	hide("sub_6");
}

if (isDOM || isIE)
{
	//document.writeln('<style type="text/css">');
	//document.writeln('.SubItemRow \{ display: none; \}');
	//document.writeln('</style>');
}

<!-- MENU (2)-->
/* Muestra los links empleando una función que toma como parámetro la categoría del menú
los mismos que se encuentran en una tabla de la función hace_menu de libreria.php*/
<!-- ************************************************************************** -->
<!-- ************************************************************************** -->

function browserdetect()
{
	//returns 1 for IE, 2 for Opera,3 for N6,4 for N4 and others
	UserAgent=navigator.userAgent;
	agente=UserAgent.substring(51,56);		
	if (agente=="Opera") {return 2;}
	if(navigator.appName=="Microsoft Internet Explorer"){return 1;}
	else if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)==5){return 3;}
	else{return 4;}
}
	
var Navegador=browserdetect();
	
function showHideOpciones(ObjTabla)
{		
	MuestraTabla(ObjTabla);
}
	
function MuestraTabla(ObjTabla)
{
	obj=document.getElementById(ObjTabla);		
	for (i=0; i<obj.rows.length;i++)
	{			
		if (obj.rows[i].style.display=='none')
		{							
			if (Navegador==1) obj.rows[i].style.display='block';
			else obj.rows[i].style.display='table-row';
			Cambio=0;				
		}
		else
		{
			obj.rows[i].style.display='none';
			Cambio=1;
		}
	}
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);




//FUNCIÓN PARA MOSTRAR/OCULTAR INFORMACIÓN
//***************************************************************************************************
function expand_menu(alfa){
	if (document.getElementById(alfa).style.display == 'none'){
		document.getElementById(alfa).style.display = 'block';
	}else{
		document.getElementById(alfa).style.display = 'none';
	}
}

