 

function Validar_bus_estadisticas(theForm)
<!-- Validacion de Formulario BUSQUEDA DE NOTICIAS	-->
{
var checkStr1 = theForm.tituloestadistica.value;
var checkStr2 = theForm.descripcionestadistica.value;
 
 
 
  if (checkStr1.length==0 && checkStr2.length==0 )
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.tituloestadistica.focus();
    return (false);
	}	
	  		if (checkStr1.length!=0) {
	if (checkStr1.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.tituloestadistica.focus();
		theForm.tituloestadistica.select();
		return (false);
		}
	}
	
		if (checkStr2.length!=0) {
	if (checkStr2.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.descripcionestadistica.focus();
		theForm.descripcionestadistica.select();
		return (false);
		}
	}
 
	
 return (true);
}

 
function Validar_estadisticas(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{var checkStr = theForm.tituloestadistica.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Titulo, por favor.");
    theForm.tituloestadistica.focus();
    return (false);
	}	
	
 
	//*****************  validacion de textarea
theForm.descripcionestadistica.required = "true"; 
for (i = 0; i <theForm.elements.length; i++){
if ((theForm.elements[i].type == "textarea") &&  theForm.elements[i].required=="true" && theForm.elements[i].value=='')
{
  alert('Por favor, complete el campo de descripcion'); 
		 return (false);
		break;
	}
}


if (Trim(theForm.descripcionestadistica.value)=='<P>&nbsp;</P>')
	{
    alert("No dejar en blanco la descripcion, por favor.");
 
    return (false);
	}
//************************************ 	
	/*
	var checkStr = theForm.nombre_archivo.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una nombre al archivo, por favor.");
    theForm.nombre_archivo.focus();
    return (false);
	}
	*/
	 var checkStr = theForm.file.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una archivo, por favor.");
    theForm.file.focus();
    return (false);
	}
	 
	
	var imagen = theForm.file.value;
	if(imagen !=""){
	if (imagen.lastIndexOf(".doc")== -1 && imagen.lastIndexOf(".xls")== -1 && imagen.lastIndexOf(".pdf")== -1 && imagen.lastIndexOf(".txt")== -1  && imagen.lastIndexOf(".rtf")== -1 && imagen.lastIndexOf(".ppt")== -1 && imagen.lastIndexOf(".zip")== -1 && imagen.lastIndexOf(".rar")== -1)
	{	alert("Ingrese un documento Válido, por favor");
		theForm.file.focus();
		return false;
	}
	}
 /*
var oas = new ActiveXObject("Scripting.FileSystemObject");
var d = window.document.formulario.file.value;
var e = oas.getFile(d);
var f = e.size;
alert(f + " bytes");
 */
  
 return (true);
}

/*************************/

//******************

function Validar_estadisticas_modi(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{var checkStr = theForm.tituloestadistica.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Titulo, por favor.");
    theForm.tituloestadistica.focus();
    return (false);
	}	
	
	var checkStr = theForm.descripcionestadistica.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una descripcion, por favor.");
    theForm.descripcionestadistica.focus();
    return (false);
	}	
	
	var checkStr = theForm.nombre_archivo.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una nombre al archivo, por favor.");
    theForm.nombre_archivo.focus();
    return (false);
	}
	
	/*var checkStr = theForm.file.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una archivo, por favor.");
    theForm.file.focus();
    return (false);
	}
	*/
	
	var imagen = theForm.file.value;
	if(imagen !=""){
	if (imagen.lastIndexOf(".doc")== -1 && imagen.lastIndexOf(".xls")== -1 && imagen.lastIndexOf(".pdf")== -1 && imagen.lastIndexOf(".txt")== -1  && imagen.lastIndexOf(".rtf")== -1 && imagen.lastIndexOf(".ppt")== -1 && imagen.lastIndexOf(".zip")== -1)
	{	alert("Ingrese un documento Válido, por favor");
		theForm.file.focus();
		return false;
	}
	}

  
 return (true);
}
 
/*************************/
/************************  OPCIONES DE USUARIO **************/ 
/*************************/

function EDITAR_ESTADISTICAS(VER,CODIGO,ENVIAR)
{
//if (Validar_noticia(window.document.formulario))
//{

 window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	/// alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();
//}
} 
 /*************************/
function pregunta_elimina_estadisticas(CODIGO,ENVIAR,VER){ 
   if (confirm('¿Estas seguro de ELIMINAR esta ESTADISTICA?')){ 
 
	 document.formulario.enviar.value=ENVIAR;   
 document.formulario.id_pre.value=CODIGO;
  window.document.formulario.ver_opt.value=VER;
// alert(ENVIAR);
 //alert(CODIGO);
 document.formulario.submit();
    } 
} 
/*************************/
function GUARDAR_MODI_ESTADISTICAS(VER,CODIGO,ENVIAR)
{
if (Validar_estadisticas_modi(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();

}

}

 /*************************/
function DETALLE_ESTADISTICAS(VER,CODIGO,ENVIAR)
{

 window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();

}

 /*************************/
function DETALLE_ESTADISTICAS_HOME(VER,CODIGO,ENVIAR)
{

 window.document.frm_home_noticia.enviar.value=ENVIAR;
	window.document.frm_home_noticia.ver_opt.value=VER;
 	window.document.frm_home_noticia.id_pre.value=CODIGO;
 
 //  alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.frm_home_noticia.submit();

}
 
 
/*************************/
/*************************/
function GUARDAR_ESTADISTICAS(VER,ENVIAR)
{
if (Validar_estadisticas(window.document.formulario))
{

	//window.document.formulario.enviar.value=AREGLO;
	window.document.formulario.enviar.value=ENVIAR;
//	window.document.formulario.nom_seccion.value=SECCION;
	window.document.formulario.ver_opt.value=VER;
// 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();

}
}

function BUSCAR_ESTADISTICAS(VER,ENVIAR)
{
 if (Validar_bus_estadisticas(window.document.formulario))
 {
  window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	//alert(ENVIAR);
// alert(VER);
	window.document.formulario.submit();

 }
}
/************************   **************/ 
/*************************/
 
 
function focus(){
	window.document.formulario.login.focus();
}

