/*
 * Función que genera una instancia del objeto XMLHttpRequest
 */

function Ajax(){
	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;
}

/*
 * Función que actualiza el listado de registros de la BD
 */
function ActualizaListado(div, url){
	contenedor = document.getElementById(div);
	ajax=Ajax();
	ajax.open("GET", url +'?ajax=true' ,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
	 	}else{
	 		contenedor.innerHTML = '<div class="loading"><br><img src="../imagenes/ajax/activityanimation.gif"><br>Cargando...<br><br></div>';
	 	}
	}
	ajax.send(null);
}

/*
 * Función que redirecciona
 */
function Redirecciona(url){
	location.href = url;

}

function MostrarPopup(div){
	document.getElementById(div).style.display='block';
	document.getElementById('fade').style.display='block'
	
}

function OcultarPopup(div){
	document.getElementById(div).style.display='none';
	document.getElementById('fade').style.display='none'
}

function toggle_visibilityfade(id) {
   var e = document.getElementById(id);
   var f = document.getElementById('fade');
   
   if(e.style.display == 'none')
	  e.style.display = 'block';
   else
	  e.style.display = 'none';
	  
   if(f.style.display == 'block')
	  f.style.display = 'none';
   else
	  f.style.display = 'block';
	  
 }
 
 function EnviarNotificacionMail(){
	alert('Por aqui pasamos')	;
 }
 
 function Imprimir(url)
{
	var ventana = window.open(url, "PrintVersion" , "width=900,height=768,scrollbars=YES");
	ventana.focus();
	//ventana.print();
}

