function NuevoAjax(){
var xmlhttp=false;
try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
	try{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}catch(E){
		xmlhttp = false;
	}
}

if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
	xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}


function cargar(url,ti){
var contenido, banner,destacado,publicidad,izquierda,menu;
contenido = document.getElementById('principal');
banner = document.getElementById('imagenbanner');
destacado = document.getElementById('destacadoimg');
publicidad = document.getElementById('publicidad');
izquierda = document.getElementById('izquierda');
menu = document.getElementById('menu');
banner.style.height="0";
		banner.style.margin="0";
		banner.style.visibility="hidden";
		destacado.style.height="0";
		destacado.style.margin="0";
		destacado.style.visibility="hidden";
		publicidad.style.height="0";
		publicidad.style.visibility="hidden";
ajax=NuevoAjax();
ajax.open("GET", url,true);
ajax.onreadystatechange=function(){
	if(ajax.readyState==1){		
		menu.innerHTML =" <a href='04029' title='Pagina de inicio'>Inicio</a> <strong>&raquo;</strong> "+ti;	
		izquierda.innerHTML = "<br /><br /><br />Cargando...";	
		contenido.innerHTML = "<br /><br /><br />Cargando...";		
		contenido.style.background = "url('loader.gif') no-repeat";	
			
	}else if(ajax.readyState==4){
		if(ajax.status==200){
			contenido.innerHTML = ajax.responseText;
			//preloader.innerHTML = "Cargado.";
			contenido.style.background = "url('loaded.gif') no-repeat";
			cargar_menu("/Servicios/Municipios/pueblos.nsf/menulista.html?ReadForm&amp;id=04029");
		}else if(ajax.status==404){
			//preloader.innerHTML = "La página no existe";
		}else{
			//preloader.innerHTML = "Error:".ajax.status;
		}
	}
}
ajax.send(null);
}


function cargar_menu(url){
var contenido, preloader;
contenido = document.getElementById('izquierda');
//preloader = document.getElementById('preloader');
ajax=NuevoAjax();
ajax.open("GET", url,true);
ajax.onreadystatechange=function(){
	if(ajax.readyState==1){
		contenido.innerHTML = "<br /><br /><br />Cargando...";		
		contenido.style.background = "url('loader.gif') no-repeat";
		
	}else if(ajax.readyState==4){
		if(ajax.status==200){
			contenido.innerHTML = ajax.responseText;
			//preloader.innerHTML = "Cargado.";
			contenido.style.background = "url('loaded.gif') no-repeat";
		}else if(ajax.status==404){
			//preloader.innerHTML = "La página no existe";
		}else{
			//preloader.innerHTML = "Error:".ajax.status;
		}
	}
}
ajax.send(null);
}

function cargar_contenido(url,ti){
var contenido, preloader,menu;
contenido = document.getElementById('principal');
menu = document.getElementById('menu');
//preloader = document.getElementById('preloader');
ajax=NuevoAjax();
ajax.open("GET", url,true);
ajax.onreadystatechange=function(){
	if(ajax.readyState==1){
		menu.innerHTML =" <a href='04029' title='Pagina de inicio'>Inicio</a> <strong>&raquo;</strong> "+ti;	
		contenido.innerHTML = "<br /><br /><br />Cargando...";		
		contenido.style.background = "url('loader.gif') no-repeat";
		
	}else if(ajax.readyState==4){
		if(ajax.status==200){
			contenido.innerHTML = ajax.responseText;
			//preloader.innerHTML = "Cargado.";
			contenido.style.background = "url('loaded.gif') no-repeat";
		}else if(ajax.status==404){
			//preloader.innerHTML = "La página no existe";
		}else{
			//preloader.innerHTML = "Error:".ajax.status;
		}
	}
}
ajax.send(null);
}
var once_per_browser=0
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
var rootdomain="http://"+window.location.hostname

function ajaxinclude(url) {
var page_request = false;
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
ajax3("/Servicios/Municipios/pueblos.nsf/menulista.html?ReadForm&amp;id="+pueblo);
page_request.open('GET', url, false) //get page synchronously 
document.getElementById ('principal').innerHTML = "Cargando....";
document.getElementById ('menu').innerHTML ="<strong>&raquo;</strong> Informacion ";

page_request.send(null)
writecontent(page_request)
crossobj=ns6? document.getElementById("destacadoimg") : document.all.destacadoimg;
crossobj1=ns6? document.getElementById("imagenbanner") : document.all.imagenbanner;
crossobj2=ns6? document.getElementById("publicidad") : document.all.publicidad;
if (ie4||ns6){
crossobj1.style.height="0"
crossobj1.style.margin="0"
//crossobj1.style.border-bottom="0"
crossobj1.style.visibility="hidden"
crossobj.style.height="0"
crossobj.style.padding="0"
crossobj.style.margin="0"
//crossobj.style.border-bottom="0"
crossobj.style.visibility="hidden"
crossobj2.style.height="0"
//crossobj2.style.padding="0"
//crossobj2.style.margin="0"
//crossobj2.style.visibility="hidden"

}

else if (ns4){
crossobj.height="0"
crossobj.style.padding="0"
crossobj.visibility="hide"
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.getElementById ('principal').innerHTML = page_request.responseText;
}

}


// Carga en principal

function ajax2(url) {
var page_request = false;
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false

page_request.open('GET', url, false) //get page synchronously 
document.getElementById ('principal').innerHTML = "Cargando....";
page_request.send(null)
writecontent2(page_request)



function writecontent2(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.getElementById ('principal').innerHTML = page_request.responseText;
}

}



function ajax3(url) {
var page_request = false;
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false

page_request.open('GET', url, false) //get page synchronously 
document.getElementById ('izquierda').innerHTML = "Cargando....";
page_request.send(null)
writecontent3(page_request)



function writecontent3(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.getElementById ('izquierda').innerHTML = page_request.responseText;
}

}


// FUNCIONES COMUNES


function enviar(ids)
{
if (form1001.keywords.value!="")
parent.location.href=""+form1001.keywords.value 
}

function enviargoogle(ids)
{
if (form1001.keywords.value!="")
parent.location.href='http://google.com/search?q='+form1001.keywords.value+'&hl=es'; 
}

function limpiar(ids)
{
if (form1001.keywords.value!="")
form1001.keywords.value="" 
}

function atras()
{
window.history.back();
}

function pru(){
alert("Finana");
}


function cambiar(ids){
var url="";
var url1= ids.idmenu.value;
var mens =ids.idmenu.options[ids.idmenu.selectedIndex].text; 
if (ids.idmenu.value!="Seleccione...") 
  if (ids.idmenu.value.substr (0, 4)!="http"){
	  cargar_contenido(ids.idmenu.value,mens);}
else{ 
	 document.location.href=ids.idmenu.value;
}
}

function iFrameHeight(iframeName)
{
    if(document.getElementById && !(document.all))
    {
        h = document.getElementById(iframeName).contentDocument.body.scrollHeight;
        document.getElementById(iframeName).height = h;
    }
    else if(document.all)
    {
        h = document.frames(iframeName).document.body.scrollHeight;
        document.all[iframeName].height = h;
    }
}

function CargaPagina(url) {
    	window.document.open(url, "", "location=1,menubar=1,resizable=1,scrollbars=1,toolbar=1");

}

