function redim(){
	document.getElementById('cuerpo').style.height=document.body.clientHeight-70;
	document.getElementById('cuerpo').style.width=document.body.clientWidth - 215;
	document.getElementById('cuerpo').style.height=document.body.clientHeight-70;
	document.getElementById('cuerpo').style.width=document.body.clientWidth - 215;
}

function redimobjetoswf(){
	document.getElementById('objetoswf').style.height=document.body.clientHeight-70;
	document.getElementById('objetoswf').style.width=document.body.clientWidth - 215;
	document.getElementById('objetoswf').style.height=document.body.clientHeight-70;
	document.getElementById('objetoswf').style.width=document.body.clientWidth - 215;
}


function correctPNG()
{
  for(var i=0; i<document.images.length; i++)
  {
  
    var img = document.images[i]
    var imgName = img.src.toUpperCase()
    if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
    {
      var imgID = (img.id) ? "id='" + img.id + "' " : ""
      var imgClass = (img.className) ? "class='" + img.className + "' " : ""
      var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
      var imgStyle = "display:inline-block;" + img.style.cssText
      if (img.align == "left") imgStyle = "float:left;" + imgStyle
      if (img.align == "right") imgStyle = "float:right;" + imgStyle
      if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
      var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
      img.outerHTML = strNewHTML
      i = i-1
    }
  }
}

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);
		}
	}
}


function paginas (url, id_contenedor)
{
	
var pagina_requerida = false;
if (window.XMLHttpRequest)
{
	// Mozilla, Safari etc
	pagina_requerida = new XMLHttpRequest ();
	} else if (window.ActiveXObject)
	{
	// IE
	try
	{
		pagina_requerida = new ActiveXObject ("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		// en caso que sea una versión antigua
		try
		{
			pagina_requerida = new ActiveXObject ("Microsoft.XMLHTTP");
		}
		catch (e)
		{
		}
	}
}
else
return false;
pagina_requerida.onreadystatechange = function ()

{
// función de respuesta
cargarpagina (pagina_requerida, id_contenedor);
}
pagina_requerida.open ('GET', url, true); // asignamos los métodos open y send
// la siguiente linea es para que no guarde el GET en la cache del explorer

if (url != 'htm/cargando.html'){
pagina_requerida.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
}
pagina_requerida.send (null);
}

function cargarpagina (pagina_requerida, id_contenedor)
{
if (pagina_requerida.readyState == 4 && (pagina_requerida.status == 200 || window.location.href.indexOf ("http") == - 1))

//document.getElementById (id_contenedor).innerHTML = pagina_requerida.responseText;
SetContainerHTML(id_contenedor, pagina_requerida.responseText, true);
}


function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) 
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}

function FAjax (url,capa,valores,metodo){
    var ajax=crearXMLHttpRequest();
    var capaContenedora = document.getElementById(capa);
    
    

    /*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
    if(metodo.toUpperCase()=='POST'){
        ajax.open ('POST', url, true);
        ajax.onreadystatechange = function() {
            if (ajax.readyState==1) {
                paginas('htm/cargando.html','cuerpo');
            }else if (ajax.readyState==4){
                if(ajax.status==200){
//                    document.getElementById(capa).innerHTML=ajax.responseText;
	                SetContainerHTML(capa, ajax.responseText, true);                    
                }
            }
        }
        ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );                
        ajax.send(valores);
        return;
    }
    /*Creamos y ejecutamos la instancia si el metodo elegido es GET*/
    if (metodo.toUpperCase()=='GET'){
        ajax.open ('GET', url, true);
         ajax.onreadystatechange = function() {
            if (ajax.readyState==1) {
                paginas('htm/cargando.html','cuerpo');
            }else if (ajax.readyState==4){
                if(ajax.status==200){
	                SetContainerHTML(capa, ajax.responseText, true);
//                    document.getElementById(capa).innerHTML=ajax.responseText;
                }
            }
        }
        ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );                        
        ajax.send(null);
        return
    }
}  



