//-----------Funcion que utilizamos para cargar las paginas
function getDataServer(url, vars){
     var xml = null;
     try{
         xml = new ActiveXObject("Microsoft.XMLHTTP");
     }catch(expeption){
         xml = new XMLHttpRequest();
     }
     xml.open("POST",url, false);
	 xml.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
     xml.send(vars);
     if(xml.status == 404) alert("Url no valida");
     return xml.responseText;
}

function $(id){
	return document.getElementById(id);
}

function cargar(id, URL) {
	$(id).innerHTML = getDataServer(URL,"");
}

function descargar(nombreCapa){
	document.getElementById(nombreCapa).style.visibility="hidden";
	cargar(nombreCapa, 'recursos/classes/buid.php');
}

function mostrar(nombreCapa){
	document.getElementById(nombreCapa).style.visibility="visible";
}
function ocultar(nombreCapa){
	document.getElementById(nombreCapa).style.visibility="hidden";
} 
//------------

var ancho = 0;
var alto = 0;

/*
window.onload = function(){
	redim();
	//redimImg();
}
*/

window.onresize = function(){redim();}

function redim(){

   if (window.innerWidth){
      ancho = window.innerWidth;
   }else{
      ancho = document.body.clientWidth;
   }
   
   
   if (ancho>$('wrapper').clientWidth){
      $('wrapper').style.left = ((ancho/2) - ($('wrapper').clientWidth/2)) - 50  + "px";
   }
   
   if (window.innerHeight){
      alto = window.innerHeight
   }else{
      alto = document.body.clientHeight
   }
	//$('wrapper').style.top = ($('wrapper').clientHeight) + "px";
	//if (alto>$('wrapper').clientHeight){
    //	$('wrapper').style.top = ((alto/2) - ($('wrapper').clientHeight/2)) + "px";
	//}
   
}

function redimImg(){

	var ancho2 = $('columnaDer').clientWidth;
   
   	//alert("margen imagen: " + ((ancho2/2) - ($('imagen').clientWidth/2)));
   
   	if (ancho2>$('tablaImagen').clientWidth){
    	$('tablaImagen').style.marginLeft = ((ancho2/2) - ($('tablaImagen').clientWidth/2)) + "px";
   	}
   
   	//var alto2 = $('columnaDer').clientHeight;
   	
   	//alert("margen top" + ((alto2/2) - ($('imagen').clientHeight/2)));
   
	//$('wrapper').style.top = ($('wrapper').clientHeight) + "px";
	//if (alto2>$('imagen').clientHeight){
    //	$('imagen').style.marginTop = ((alto2/2) - ($('imagen').clientHeight/2)) + "px";
	//}
   
}

function cambiarColor(id){
	document.getElementById(id).style.color='#a62323';
}

function menuDesp(id1,id2){
	document.getElementById(id1).style.position='absolute';
	document.getElementById(id2).style.position='relative';
	document.getElementById(id1).style.zIndex=-1000;
	document.getElementById(id2).style.zIndex=100;
}
