var s9_NS = (document.layers) ? 1 : 0;
var s9_IE = (document.all && document.getElementById) ? 1 : 0;
var s9_N6 = (!document.all && document.getElementById) ? 1 : 0;
var s9_hideMenu = null;
var is_NS = s9_NS;
var is_IE = s9_IE;
var is_N6 = s9_N6;


function doHideAll(){
	if(is_IE) {
		document.all.show_nav.style.visibility="hidden";
		//document.all.show_nav_hoy.style.visibility="hidden";
		//document.all.community_nav.style.visibility="hidden";
	}

	if(is_NS) {
		document.show_nav.visibility="hidden";
		//document.show_nav_hoy.visibility="hidden";
		//document.community_nav.visibility="hidden";
	}

	if(is_N6) {	
		document.getElementById('show_nav').style.visibility = "hidden";
		//document.getElementById('show_nav_hoy').style.visibility = "hidden";
		//document.getElementById('community_nav').style.visibility = "hidden";
	}
}

function doStyleChange(obj) {

	if(obj == "show_nav_hoy")
	{
		reDoStyleChange('show_nav_prog');
		reDoStyleChange('show_nav_nvo');
	}
	if(obj == "show_nav_prog")
	{
		reDoStyleChange('show_nav_hoy');
		reDoStyleChange('show_nav_nvo');
		recibeid('/navegacion/top/desplegado4.shtml','variablegetenviada=enviaste solo get','','show_nav_prog');
		//alert("Mostramos menu");
	}
	
	if(obj == "show_nav_nvo")
	{
		reDoStyleChange('show_nav_hoy');
		reDoStyleChange('show_nav_prog');
	}
	
	if(is_IE) {
		eval('document.all.'+obj+'.style.visibility="visible"');
		eval('document.all.'+obj+'.style.display="block"');
	}
	if(is_NS) {
		eval('document.'+obj+'.visibility="visible"');
		eval('document.'+obj+'.display="block"');
	}
	if(is_N6) {	
		the_obj = document.getElementById(obj);
		the_obj.style.visibility = "visible";
		the_obj.style.display = "block";		
	}
}

function reDoStyleChange(obj) {
	if(is_IE) {
		eval('document.all.'+obj+'.style.visibility="hidden"');
		eval('document.all.'+obj+'.style.display="none"');
	}
	if(is_NS) {
		eval('document.'+obj+'.visibility="hidden"');
		eval('document.'+obj+'.display="none"');
	}
	if(is_N6) {	
		the_obj = document.getElementById(obj);
		the_obj.style.visibility = "hidden";
		the_obj.style.display = "none";		
	}
}
/*******************************/

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);

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 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_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_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 objetus(file) {
xmlhttp=false;
this.AjaxFailedAlert = "Su navegador no soporta las funcionalidades de este sitio y podria experimentarlo de forma diferente a la que fue pensada. Por favor habilite javascript en su navegador para verlo normalmente.\n";
 this.requestFile = file;
 this.encodeURIString = true;
 this.execute = false;
 if (window.XMLHttpRequest) { 
            this.xmlhttp = new XMLHttpRequest();
            if (this.xmlhttp.overrideMimeType) {
                this.xmlhttp.overrideMimeType('text/xml');
            }
        } 
        else if (window.ActiveXObject) { // IE
try {
  this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
 try {
  this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e) {
   this.xmlhttp = null;
   }
       }
 if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
                this.xmlhttp = new XMLHttpRequest();
    if (!this.xmlhttp){
   this.failed = true; 
  } } }
 return this.xmlhttp ;
 }

function recibeid(_pagina,valorget,valorpost,capa){ 
ajax=objetus(_pagina);
if(valorpost!=""){
ajax.open("POST", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
} else {
ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
}
ajax.onreadystatechange=function() {
 if (ajax.readyState==1){
  document.getElementById(capa).innerHTML = "Cargando Información ...";
  }
  if (ajax.readyState==4) {
   if(ajax.status==200)
   	{
   		//document.getElementById(capa).innerHTML = ajax.responseText;
		//document.getElementById(id_contenedor).innerHTML = pagina_requerida.responseText;
		SetContainerHTML(capa, ajax.responseText, true);
	}
   else if(ajax.status==404)
                                             {
 capa.innerHTML = "La direccion no existe";
                                             }
                           else
                                             {
                            capa.innerHTML = "Error: ".ajax.status;
                                             }
}
}
if(valorpost!=""){
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send(valorpost);
} else {
ajax.send(null);
}
} 

/**************************************************** Funcion para ejecutar JS ****************************************************/
function SetContainerHTML(id,html,processScripts)
{
	mydiv = document.getElementById(id);
	mydiv.innerHTML = html;
	if(processScripts!=false)
	{
		var elementos = mydiv.getElementsByTagName('script');
		for(i=0;i<elementos.length;i++)
		{
			var elemento = elementos[i];
			nuevoScript = document.createElement('script');
			nuevoScript.text = elemento.innerHTML;
			nuevoScript.type = 'text/javascript';
			if(elemento.src!=null && elemento.src.length>0)
				nuevoScript.src = elemento.src;
			elemento.parentNode.replaceChild(nuevoScript,elemento);
		}
	}
}
