
function Validar_bus_oportunidades(theForm)
<!-- Validacion de Formulario BUSQUEDA DE NOTICIAS	-->
{
var checkStr1 = theForm.titulooportunidad_ext.value;
var checkStr2 = theForm.descripcionoportunidad_ext.value;
var checkStr3 = theForm.nombrearchivo.value;
 
 
  if (checkStr1.length==0 && checkStr2.length==0 && checkStr3.length==0)
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.titulooportunidad_ext.focus();
    return (false);
	}	
	
 	if (checkStr1.length!=0) {
	if (checkStr1.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.titulooportunidad_ext.focus();
		theForm.titulooportunidad_ext.select();
		return (false);
		}
	}
	
	 	if (checkStr2.length!=0) {
	if (checkStr2.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.descripcionoportunidad_ext.focus();
		theForm.descripcionoportunidad_ext.select();
		return (false);
		}
	}
	
	 	if (checkStr3.length!=0) {
	if (checkStr3.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.nombrearchivo.focus();
		theForm.nombrearchivo.select();
		return (false);
		}
	}
	
 return (true);
}

 
function Validar_oportunidades(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{var checkStr = theForm.titulooportunidad.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Titulo, por favor.");
    theForm.titulooportunidad.focus();
    return (false);
	}	
	
 
//*****************  validacion de textarea
theForm.descripcionoportunidad.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;
	}
}
 /*
 var expresion = /S/; //No acepta espacios, saltos de línea, tabulaciones y retornos carro... 
   if(expresion.test(theForm.descripcionoportunidad.value)){ 
    
   }else{ 
      alert('Por favor, no deje el campo de descripcion en blanco');
	  	theForm.descripcionoportunidad.focus();
		theForm.descripcionoportunidad.select();
	  return (false);
   } 
 */
 
	
if (Trim(theForm.descripcionoportunidad.value)=='<P>&nbsp;</P>')
	{
    alert("No dejar en blanco la descripcion, por favor.");
 
    return (false);
	}
	//alert(theForm.descripcionoportunidad.value.length);
	//alert(theForm.descripcionoportunidad.value);
//************************************ 
 var checkStr2 = theForm.codpais;
 
 
  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un pais, por favor.");
    theForm.codpais.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;
	}
	}
  
 return (true);
}

/*************************/

//******************

function Validar_oportunidades_modi(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{var checkStr = theForm.titulooportunidad.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Titulo, por favor.");
    theForm.titulooportunidad.focus();
    return (false);
	}	
	
//*****************  validacion de textarea
theForm.descripcionoportunidad.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.descripcionoportunidad.value)=='<P>&nbsp;</P>')
	{
    alert("No dejar en blanco la descripcion, por favor.");
 
    return (false);
	}
//************************************ 
	 var checkStr2 = theForm.codpais;
 
 
  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un pais, por favor.");
    theForm.codpais.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 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_OPORTUNIDADES(VER,VER2,CODIGO,ENVIAR)
{
//if (Validar_noticia(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 pregunta_elimina_oportunidades(CODIGO,ENVIAR,VER,VER2){ 
   if (confirm('¿Estas seguro de ELIMINAR esta OPORTUNIDAD COMERCIAL?')){ 
 
	 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_OPORTUNIDADES(VER,VER2,CODIGO,ENVIAR)
{
if (Validar_oportunidades_modi(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 DETALLE_OPORTUNIDADES(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 ING_ARCHIVO_OPORTUNIDADES(VER,CODIGO,NOMBRE)
{
	
	//********* validacion de tipo de documento
var imagen =  window.document.formulario.file.value;
if(imagen !=""){
	if (imagen.lastIndexOf(".doc")== -1 && imagen.lastIndexOf(".xls")== -1 && imagen.lastIndexOf(".pdf")== -1 && imagen.lastIndexOf(".rtf")== -1 && imagen.lastIndexOf(".ppt")== -1 && imagen.lastIndexOf(".zip")== -1)
  {	alert("Ingrese un documento permitido, por favor");
		 window.document.formulario.file.focus();
		return false;
	}
}
window.document.formulario.nombre_merca.value=NOMBRE;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.submit();

}

 /*************************/
function ELI_ARCHIVO_OPORTUNIDADES(VER,CODIGO,NOMBRE)
{

window.document.formulario.nombre_merca.value=NOMBRE;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.submit();

}
function ENVIAR_ARCHIVO(VER,CODIGO,ENVIAR)
{
 
window.document.formulario.enviar.value=ENVIAR;
window.document.formulario.ver_opt.value=VER;
window.document.formulario.id_pre.value=CODIGO;
window.document.formulario.submit();
 

}
/*************************/
/*************************/
function GUARDAR_OPORTUNIDADES(VER,VER2,ENVIAR)
{
if (Validar_oportunidades(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_OPORTUNIDADES(VER,VER2,ENVIAR)
{
 if (Validar_bus_oportunidades(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 NUEVO_OPOR(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_OPOR(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_OPOR(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();

} 
