

function Validar_bus_fuentes(theForm)
<!-- Validacion de Formulario BUSQUEDA DE NOTICIAS	-->
{
var checkStr1 = theForm.nombrefuente_info.value;
var checkStr2 = theForm.descripcionfuente_info.value;
 
 
 
 
  if (checkStr1.length==0 && checkStr2.length==0 )
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.nombrefuente_info.focus();
    return (false);
	
	}	
	if (checkStr1.length!=0) {
	if (checkStr1.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.nombrefuente_info.focus();
		theForm.nombrefuente_info.select();
		return (false);
		}
	}
		if (checkStr2.length!=0) {
	if (checkStr2.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.descripcionfuente_info.focus();
		theForm.descripcionfuente_info.select();
		return (false);
		}
	}
 return (true);
}

 

function Validar_fuentes(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{var checkStr = theForm.nombrefuente_info.value;
  if (checkStr.length==0)
	{
    alert("Ingrese Nombre, por favor.");
    theForm.nombrefuente_info.focus();
    return (false);
	}	
			if (Trim(theForm.nombrefuente_info.value)=='')
	{
    alert("No dejar en blanco, por favor.");
	theForm.nombrefuente_info.focus();
	theForm.nombrefuente_info.select();
    return (false);
	}
 
 
//*****************  validacion de textarea
theForm.descripcionfuente_info.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.descripcionfuente_info.value)=='<P>&nbsp;</P>')
	{
    alert("No dejar en blanco la descripcion, por favor.");
 
    return (false);
	}
//************************************ 
//************************************ 
 
			
			
		var checkStr = theForm.urlfuente_info.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese una URL, por favor.");
    theForm.urlfuente_info.focus();
    return (false);
	}
		if (Trim(theForm.urlfuente_info.value)=='')
	{
    alert("No dejar en blanco, por favor.");
	theForm.urlfuente_info.focus();
	theForm.urlfuente_info.select();
    return (false);
	}
 
 
 		var checkStr = theForm.costofuente_info.value.length;
	if (checkStr==0) 
	{
    alert("Ingrese Costo, por favor.");
    theForm.costofuente_info.focus();
    return (false);
	}
		if (Trim(theForm.costofuente_info.value)=='')
	{
    alert("No dejar en blanco, por favor.");
		theForm.costofuente_info.focus();
	theForm.costofuente_info.select();
    return (false);
	}
	if (doDecimal(theForm.costofuente_info.value)==false)
	{
	    return (false);
		}
	
 return (true);
}

/*************************/
 
 
/*************************/

function EDITAR_FUENTES(VER,VER2,CODIGO,ENVIAR)
{

window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.submit();

} 
 /*************************/
function pregunta_elimina_fuentes(CODIGO,ENVIAR,VER,VER2){ 
   if (confirm('¿Estas seguro de ELIMINAR esta FUENTE DE INFORMACION?')){ 
 
document.formulario.enviar.value=ENVIAR;   
document.formulario.id_pre.value=CODIGO;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
document.formulario.submit();
    } 
} 


/*************************/
function GUARDAR_MODI_FUENTES(VER,VER2,CODIGO,ENVIAR)
{
if (Validar_fuentes(window.document.formulario))
{
window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.submit();

}

}

 /*************************/
function IR_REGION(VER,VER2)
{

 
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
 
window.document.formulario.submit();

}
 /*************************/
function IR_SECTOR(VER,VER2)
{

 
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
 
window.document.formulario.submit();

}

 /*************************/
function DETALLE_FUENTES(VER,VER2,CODIGO,ENVIAR)
{

 
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.submit();

}

/*************************/
/*************************/
function GUARDAR_FUENTES(VER,VER2,ENVIAR)
{
if (Validar_fuentes(window.document.formulario))
{

window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.submit();

}
}

function BUSCAR_FUENTES(VER,VER2,ENVIAR)
{
 if (Validar_bus_fuentes(window.document.formulario))
 {
window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.submit();

 }
}
/************************   **************/ 
/*************************/
 
 
function focus(){
	window.document.formulario.login.focus();
}
 
  
function NUEVO_FUEN(VER,VER2,DERECHO)
{
     
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.nom_seccion.value=VER;
window.document.formulario.derecho.value=DERECHO;
window.document.formulario.submit();

} 
 
function BUSCAR_FUEN(VER,VER2,DERECHO)
{
     
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.nom_seccion.value=VER;
window.document.formulario.derecho.value=DERECHO;
window.document.formulario.submit();

} 

function LISTAR_FUEN(VER,VER2)
{
     
window.document.formulario.ver_opt.value=VER;
window.document.formulario.ver_opt2.value=VER2;
window.document.formulario.nom_seccion.value=VER;
window.document.formulario.submit();

} 

