function makeFObj(frame,obj,parent,topnum,subnum){
	if(frame){
 		this.evnt=bw.dom?top[frame].document.getElementById(obj):bw.ie4?top[frame].document.all[obj]:bw.ns4?eval('top.'+frame+'.document.'+obj):0;
	}else{
  		this.evnt=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval('document.'+obj):0;
	}
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;			
	this.ref=bw.dom || bw.ie4?document:bw.ns4?this.css.document:0;
	this.writeIt=cf_writeIt;
	this.height=bw.ns4?this.ref.height:this.evnt.offsetHeight;
	this.width=bw.ns4?this.ref.width:this.evnt.offsetWidth;
	this.x=(bw.ns4 || bw.ns5)? parseInt(this.css.left):this.evnt.offsetLeft;
	this.y=(bw.ns4 || bw.ns5)? parseInt(this.css.top):this.evnt.offsetTop;					
	this.hideIt=cf_hideIt;	this.showIt=cf_showIt; this.clipTo=cf_clipTo;		
	this.moveIt=cf_moveIt; this.bgChange=cf_bgChange;		
	this.parent=parent		
	if(frame){
		this.evnt.onmouseover=new Function(oCFMenu.name+".mmover("+topnum+","+subnum+")");
		this.evnt.onmouseout=new Function(oCFMenu.name+".mmout("+topnum+","+subnum+")");
	}else{
		this.evnt.onmouseover=new Function(parent.name+".mover("+topnum+")");
		this.evnt.onmouseout=new Function(parent.name+".mmout2()");
	}
	this.fcChange=cf_fcChange;
	return this
}
function cf_showIt(){if (this.css) this.css.visibility="visible";}
function cf_hideIt(){if (this.css) this.css.visibility="hidden";}
function cf_bgChange(color){
if(color){if(bw.dom || bw.ie4) this.css.backgroundColor=color
		else if(bw.ns4) this.css.bgColor=color}}

function cf_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}}}

function cf_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x;this.css.top=this.y}

function cf_writeIt(text){if(bw.ns4){this.ref.write(text);this.ref.close()}
else this.evnt.innerHTML=text}

function cf_fcChange(color){this.evnt.style.color=color}

/*****************************************************************************
Event functions
******************************************************************************/
//Mouseover on sub menus
function cf_mmover(num){
	clearTimeout(this.time)
	this.over=1
	this.sub.showIt()
}

//Mouseout on sub menus
function cf_mmout(num){
	this.time=setTimeout(this.name+".mout()",500)
	this.over=0
	this.sub.hideIt()
}

function cf_mmout2(name){
	this.time=setTimeout(this.name+".mout()",500)
	this.over2=0
}
//Mouseover on the top menus
function cf_mover(num){
//	if(!this.loaded) return
	clearTimeout(this.time)
	if(this.activeTop>-1 && this.activeTop!=this.resaltado){
		this.top[this.activeTop].bgChange(this.mtop[this.activeTop].bgColorOff)
		if(!bw.ns4) this.top[this.activeTop].css.color=this.maintextcolor
	}
	this.activeTop=num
	if(this.activeTop!=this.resaltado){
		this.top[this.activeTop].bgChange(this.mtop[this.activeTop].bgColorOn)
		if(!bw.ns4) this.top[num].css.color=this.mainhovercolor
	}
	this.over2=1
	nombre=eval('menuSub'+num)
	if(bw.ie4||bw.dom){
		if(top['frmPrinc'].divSub)nombre.accion()
	}
	else{
		if(top['frmPrinc'].document.divSub)nombre.accion()
	}
}
//Mouseout on all menus
function cf_mout(){
//	if(!this.loaded || this.over) return
	if(this.over) return
	if(this.sub)this.sub.hideIt()	
	clearTimeout(this.time)
	if(this.activeTop!=this.resaltado){
		this.top[this.activeTop].bgChange(this.mtop[this.activeTop].bgColorOff); 		
	if(!bw.ns4) this.top[this.activeTop].css.color=this.maintextcolor
	}
	this.activeTop=-1	
}
/*****************************************************************************
Function that "resets" the object pointers when a new page loads. 
Without this Explorere crashes.
******************************************************************************/
function cf_refresh(){
	this.sub=new makeFObj(this.menuFrameName,'divSub',this,1,i)
	this.loaded=true
}
/*****************************************************************************
Sets the top menus
******************************************************************************/
function cf_construct(){
	this.top=new Array()
	this.x=this.fromleft; this.y=this.fromtop;
	for(i=0;i<this.mtop.length;i++){
		this.top[i]=new makeFObj(0,'divTop'+i,this,i,-1)
		this.top[i].bgChange(this.mainbgcoloroff)
		this.y=this.menuplacement[i]
		this.w=this.mtop[i].width||this.mainwidth
		this.top[i].moveIt(this.x,this.y)
		this.top[i].bgChange(this.mtop[i].bgColorOff)
		if (bw.ns4) delta=4
			else delta=8
		if (this.mtop[i].text.length>24)
			this.top[i].clipTo(0,this.w,(this.mainheight1-delta),0,1)
			else this.top[i].clipTo(0,this.w,(this.mainheight2-4),0,1)
		this.top[i].width=this.w
		if(bw.ns4){this.top[i].ref.captureEvents(Event.MOUSEDOWN);this.top[i].ref.onmousedown=new Function(this.name+".go("+i+")")}
		else this.top[i].evnt.onclick=new Function(this.name+".go("+i+")")
		this.top[i].showIt()
	}
}
/*****************************************************************************
Make functions
******************************************************************************/
function cf_makeTop(text,link,target,width,link2,bgColorOn,bgColorOff){
	this.mtop[this.a]=new Array()
	this.mtop[this.a].text=text
	this.mtop[this.a].link=link
	this.mtop[this.a].topFrame=link2
	this.mtop[this.a].target=target
	if (bgColorOn) this.mtop[this.a].bgColorOn=bgColorOn
		else this.mtop[this.a].bgColorOn=this.mainbgcoloron
	if (bgColorOff) this.mtop[this.a].bgColorOff=bgColorOff
		else this.mtop[this.a].bgColorOff=this.mainbgcoloroff
	this.mtop[this.a].width=width
	this.a++
	document.write('\n<div id="divTop'+(this.a-1)+'" class="clMain">'+text+'</div>\n')
}

/*****************************************************************************
This function makes the string that will be written out in the main frame
whenever a page loads there.
******************************************************************************/
function cf_makeFrameString()
{
	sw=bw.ns4?6:3;
	str='\n<style>\n'
		//Abajo está el estilo de la barra de herramientas
		str+='DIV.herramientas{'+this.herramStyle+'border:0; width:300; margin:0;  top:-2; height:10;'
		if (bw.ns4)
		str+='left:'+(parent.frmPrinc.innerWidth-238)+';}\n'
			else if (bw.dom)
			str += 'right: 0;}\n';
				else
				str+='left: '+(top['frmPrinc'].document.body.clientWidth-300)+';}\n';
				str+='A.herram{text-decoration:none; color:#FFFFFF; font-family:Arial; font-weight:Bold; font-size:12px; text-indent:5px; }'
				str+='SPAN.relative{position:relative; top:0; z-index:16;'
				bw.ns4?str+='clip: rect(0px, 300px, 15px, 0px)}':str+='width:100%}'
				str+='\nDIV.popups{position:absolute;visibility:hidden; z-index:15; height:100;}\n'
				str+='</style>'
				this.frameString=str
				str="\n"
				str+='<div id="divSub" class="popups"></div>\n'
				//Abajo está el contenedor del menu de herramientas
				str+='<div id="menuHerramientas" class="herramientas">'
				str+='<table align=right border=0 CELLSPACING=0 CELLPADDING=0><tr><td NOWRAP>\n'
				+"<a href='javascript:links(\"http://www.opsis.org.ve/centro_mapa_site.html\",\"http://www.opsis.org.ve/top_frame_mapa.html\")' name='EmailMapaH' onMouseOver=\"displayImg(\'MapaOn\',\'Mapa\');\"   onMouseOut=\"displayImg(\'MapaOff\',\'Mapa\')\"><image name=\"Mapa\" src=\"http://www.opsis.org.ve/imagenes/boton_mapa_off.gif\" border=0 alt=\"Mapa del Site\"></a>"
				+"<a href='mailto:opsis@opsis.org.ve' name='EmailContactoH' onMouseOver=\"displayImg(\'ContactoOn\',\'Contacto\');\"   onMouseOut=\"displayImg(\'ContactoOff\',\'Contacto\')\"><image name=\"Contacto\" src=\"http://www.opsis.org.ve/imagenes/boton_contacto_off.gif\" border=0 alt=\"Contáctenos\"></a>"
				+"<a href='http://www.opsis.org.ve' target='_parent' name='EmailHomeH' onMouseOver=\"displayImg(\'HomeOn\',\'Home\');\"   onMouseOut=\"displayImg(\'HomeOff\',\'Home\')\"><image name=\"Home\" src=\"http://www.opsis.org.ve/imagenes/boton_home_off.gif\" border=0 alt=\"Home\"></a>"
				+'\n</td></tr></table>\n</div>'
				+'<div id="ayuda" class="popups"></div>'
				str+='\n'
				this.frameString2=str
				str=null

}

/*****************************************************************************
Styles for the top items
******************************************************************************/
function cf_makeStyle(){
	str='\n<style>\n'
	str+='\tDIV.clMain{position:absolute; cursor:glass; visibility:hidden; color:'+this.maintextcolor+'; '+this.topstyle+'; overflow:visible; }\n'
	str+='\tSPAN.clMain1{position:absolute; cursor:glass; color:'+this.maintextcolor+'; '+this.topstyle+' }\n'
	str+='\tA:link, A:active, A:visited {text-decoration:none; color:'+this.maintextcolor+'; '+this.topstyle+' }\n'	
	str+='</style>'	
	document.write(str)
	str=null	
}
/*****************************************************************************
Going to another page
******************************************************************************/
function cf_go(num,subnum){
	url=this.mtop[num].link
	url2=this.mtop[num].topFrame
	target=this.mtop[num].target
	if(url){
		top[target].location.href=url
		string=top['frmMenu'].location.href
		check=string.indexOf(url2)
		if (url2 && (check<0)){
			top['frmMenu'].location.href=url2
		}
	}
}

/*****************************************************************************
Making the main CoolFrame menu object
******************************************************************************/
function coolFrameMenu(name){
	this.name=name
	this.construct=cf_construct;	
	this.over=false; this.time=500
	this.refresh=cf_refresh;
	this.mmout2=cf_mmout2
	this.mover=cf_mover; this.mout=cf_mout;
	this.mmover=cf_mmover; this.mmout=cf_mmout;
	this.a=0;
	this.loaded=false; this.mtop=new Array()
	this.makeTop=cf_makeTop; 
	this.activeTop=-1; 
	this.frameString2=0
	this.makeFrameString=cf_makeFrameString;
	this.makeStyle=cf_makeStyle;
	this.resaltado=-1;
	this.go=cf_go;
}

//crea los objetos necesarios para los menus flotantes
function mFlotante(obj){
	this.name=obj
	this.place=moveItF
	this.escribeLayer=escribeLay
	this.visible=cf_showIt
	this.invisible=cf_hideIt
	this.mString=makeString
	this.accion=preparado
	return this
}

//crea los objetos necesarios para los menus flotantes de la barra de herramientas
function herramientas(obj){
	this.name=obj
	this.place=moveItH
	this.escribeLayer=escribeLay
	this.visible=cf_showIt
	this.invisible=cf_hideIt
	this.mString=makeString
	this.accion=preparado
	return this
}


//genera la cadena de inicializacion de todos los menus flotantes
function makeString() {
	txt = "\n<TABLE WIDTH="+this.width+" BORDER=0 CELLPADDING="+this.borderSize+" CELLSPACING=0 BGCOLOR=\""+this.borderColor+"\">\n<TR><TD >\n<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+this.backColor+"\">\n<tr><td>";
	for(i=0;i<this.eltos.length;i++){
		if (this.hrefs[i]) url1=this.hrefs[i] 
			else url1="0"
		if(this.menuArriba)url2=this.menuArriba
			else url2="0"
		txt+='<SPAN id="id'+i+'" class="relative"'
		if (bw.ns4) txt+='><a href="javascript:links(\''+url1+'\',\''+url2+'\')" class="herram" onMouseOver="onColor(id'+i+',\''+this.borderColor+'\')" onMouseOut="offColor(id'+i+')">'
		else txt+=' onMouseOver="onColor(this,\''+this.borderColor+'\')" onMouseOut="offColor(this)"><a href="javascript:links(\''+url1+'\',\''+url2+'\')" class="herram">'
		txt+='•&nbsp;'+this.eltos[i]+'</a></SPAN><br>\n'
	}
	txt+="</td></tr></TABLE>\n</TD></TR>\n</TABLE>"
	this.string=txt
	txt=null
}

//controla donde van a ser puestos los menus flotantes
function moveItF(x,y) {
	if(this.css) {
		if (bw.ie4||bw.dom)
				this.css.top=y+parent.frmPrinc.document.body.scrollTop
		else 
		if (bw.ns4) {
			for(i=0;i<12;i++){
				auxTit=eval('this.css.document.layers[\'id'+i+'\']')
				if(auxTit)
					auxTit.clip.right=(this.width-(2*this.borderSize+4))
			}
			auxY=parseInt(parent.frmPrinc.pageYOffset)
			this.css.top=(y+auxY)
		}
			this.css.left=x
	}
}

//controla donde van a ser puestos los menus flotantes de la barra de herramientas
function moveItH(x,y) {
	if(this.css) {
		if (bw.ie4||bw.dom){
				this.css.top=y+parent.frmPrinc.document.body.scrollTop
				cWidth=top['frmPrinc'].document.body.clientWidth
		}
		else 
		if (bw.ns4) {
			for(i=0;i<3;i++){
				auxTit=eval('this.css.document.layers[\'id'+i+'\']')
				if(auxTit)
					auxTit.clip.right=(this.width-(2*this.borderSize+4))
			}		
			auxY=parseInt(parent.frmPrinc.pageYOffset)
			this.css.top=(y+auxY)
			cWidth=top['frmPrinc'].window.innerWidth-7
		}
			this.css.left=(cWidth-x)
	}
}


//escribe en una capa la cadena de inicialización
function escribeLay(){
	if (bw.dom||bw.ie4) {
		this.evento.innerHTML=this.string
	}
	else if (bw.ns4) {
		this.css.document.write(this.string)
		this.css.document.close()
	}
}

//controla los ultimos preparativos para que este todo listo
function preparado(){
	if (bw.dom||bw.ie4) {
		this.evento=parent.frmPrinc.document.all[this.name]
		this.css=parent.frmPrinc.document.all[this.name].style
	}
	else if (bw.ns4) {
		this.css=parent.frmPrinc.document.layers[this.name]
		this.evento=this.css
		this.ref=this.css.document
	}
	this.escribeLayer()
	this.place(this.X1,this.Y1)
	this.visible()
	
}