
//Función para obtener el objeto XMLHttp
//dependiendo del navegador.
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		document.getElementById('msgLoad').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
	}
}

//Función para mostrar el div de loading en la esquina superior derecha
function showLoading(){
	var lyrMessage = document.getElementById('msgLoad');	
	lyrMessage.style.bottom=document.body.scrollTop;
	lyrMessage.style.left=0;
	lyrMessage.style.visibility='visible';
}
//Función para cerrar el div de loading
function hideLoading(){
	document.getElementById('msgLoad').style.visibility='hidden';
}

//Funcion que nos devuelve el top visible de la página
function getY(){
	if (window.pageYOffset){
		return window.pageYOffset;
	}
	if(document.documentElement && document.documentElement.scrollTop){
		return document.documentElement.scrollTop;
	}
	if(document.body){
		return document.body.scrollTop;
	}
	return 0;
}

function centerH(){
	if( document.body &&  document.body.clientWidth  ) 
    	w = document.body.clientWidth/2;
  	else
		w = window.innerWidth/2;

	return w;
}

function centerV(){
	if( document.body &&  document.body.clientHeight  ) 
        h = document.body.clientHeight/2;
	else
		h = window.innerHeight/2;
		
	return h;
}

//show OR hide funtion depends on if element is shown or hidden
function show(id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6
		//hideAllMessages();			
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById(id).style.display = 'none';	
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
			} else {
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				document.all.id.style.display = 'none'; 
			}
		}
	}
}

//show OR hide funtion depends on if element is shown or hidden
function hide(id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6
		//hideAllMessages();			
		if (document.getElementById(id).style.display == "block"){
			document.getElementById(id).style.display = 'none';
		} 	
	} 
}

//show OR hide funtion depends on if element is shown or hidden
function showIt(id) { 
	if (document.getElementById) { // DOM3 = IE5, NS6
		//hideAllMessages();			
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
		} 	else {
			document.getElementById(id).style.display = 'block';	
		}
	} 
}