function CrearObjetot()
{
    var xmlhttp;

    /*@cc_on
    @if (@_jscript_version >= 5)
    try{
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e){
    try{
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e){
    xmlhttp = false;
    }
    }
    @else
    xmlhttp = false;
    @end @*/

    if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
        try{
            xmlhttp = new XMLHttpRequest();
        }
        catch (e){
            xmlhttp = false;
        }
    }
    return xmlhttp;
}

/***********************************************************************/
function valida_pais()
{
	var pais = document.getElementById('pais').value;
	if (pais.length==0)	{
		alert("Ingrese un país o las primeras letras del nombre.");
		document.getElementById('pais').focus();
		return (false);
	}
	else if (pais.length!=0) {
		if (pais.replace(/ /g, '') == '') {
			alert("No se aceptan espacios en blanco.");
			document.getElementById('pais').focus();
			document.getElementById('pais').select();
			return (false);
		}
	} 
	return (true);
}

function valida_partida()
{
	var partida = document.getElementById('partida').value;
	if (partida.length==0)	{
		alert("Ingrese el código de la partida o parte de la descripción.");
		document.getElementById('partida').focus();
		return (false);
	}
	else if (partida.length!=0) {
		if (partida.replace(/ /g, '') == '') {
			alert("No se aceptan espacios en blanco.");
			document.getElementById('partida').focus();
			document.getElementById('partida').select();
			return (false);
		}
	} 
	return (true);
}

function Validar_archivo_est(theForm)
{	
	var checkStr = theForm.csvFile.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese un archivo, por favor.");
    theForm.csvFile.focus();
    return (false);
	}	
	
	var imagen1 = theForm.csvFile.value;
	if(imagen1 !=""){
		if (imagen1.lastIndexOf(".csv")== -1 )
		{	alert("Ingrese un documento Válido, por favor");
			theForm.csvFile.focus();
			return false;
		}
	}
	
 return (true);
}
/*************************************/


function reporte() 
{
   var sector = window.document.formulario.select_sector.value;
   var anio = window.document.formulario.select_anio.value;
   var mes = window.document.formulario.select_mes.value;
   var pais = window.document.formulario.select_pais.value;
   //sector = sector.replace(/(í)/gi, "i");

   //alert (sector);
   window.open("modules/aplicacionestadistica/rep_estadisticas.php?sector=" + sector + "&anio=" + anio + "&mes=" + mes + "&pais=" + pais , "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,top=50,left=200,resizable=no,width=800,height=500")
}

function LIMPIAR_AGENDA()
{
   window.document.formulario.tituloeventop.value="";
   window.document.formulario.descripcioneventop.value="";
   window.document.formulario.urleventop.value="";
}
/*************************/

function Leer_archivo(ver,enviar)
{
   if (Validar_archivo_est(window.document.formulario)) 
   {
	   window.document.formulario.enviar.value=enviar;
	   window.document.formulario.ver_opt.value=ver;
	   window.document.formulario.submit();
   }
}
/*************************/

function listar_archivo(ver,enviar)
{
	   window.document.formulario.enviar.value=enviar;
	   window.document.formulario.ver_opt.value=ver;
	   window.document.formulario.submit();
}

/************************   **************/ 
function Paginar_reporte(codigo) 
{
   window.document.reporte.int_pag.value=codigo;
   //window.document.reporte.action = "modules/aplicacionestadistica/rep_estadisticas.php";
   window.document.reporte.submit();
}

