function abrir_vinculo(enlace_x,target,prop_x){
	url_destino = enlace_x;
	if (target!="_self" && target != "" && target != null) {
  			if(prop_x==""){
				window.open(enlace_x,target,prop_x)
			}else{
				window.open(enlace_x,target)			
			}//end if
	}else{
		document.location.href = enlace_x
	}// end if
}// end function

function abrir_pop_up(URL,destino,prop_x) {
	window.open(URL,destino,prop_x);
}//end function

function get_form(form_x){
	if (typeof(form_x)=="object")
		if (form_x.type=="form"){
			return form_x
		}else{
			return form_x.form
		}// end if
	else
		if (form_x=="" || form_x == null)
			return document.forms[0]
		else
			return document.forms[form_x]
		//end if
	//end if
}// end function

function eval_pagina(control_x,pagina_y){
	switch(parseInt(control_x.value,10)){
	case -4:
		control_x.value = pagina_y - 1
		if(control_x.value==0){
			control_x.value = 1
		}// end if
		break
	case -2:
		control_x.value = pagina_y + 1
		break
	}// end switch
}// end if

function menu(form_x,para_x,pre_x,post_x,volver_x){
	if (para_x=="" || para_x == null)
		return false
	// end if
	f = get_form(form_x)
	if (pre_x == null)
		pre_x = ""
	if (post_x == null)
		post_x = ""
	var_x = para_x.split(";")
	pagina_x = parseInt(f.cfg_pagina_aux.value,10)
	pagina_z = parseInt(f.cfg_pag_form_aux.value,10)
	for (i=0;i<var_x.length;i++){
		var2_x = var_x[i].split(":")
		if (var2_x[0]!= null && var2_x[0]!= "" && var2_x[1]!= "-1"){
			cad_x = "f."+pre_x+var2_x[0]+post_x+".value='"+var2_x[1]+"'"	
			eval(cad_x)
		}// end if
	}// next
	eval_pagina(f.cfg_pagina_aux,pagina_x)
	eval_pagina(f.cfg_pag_form_aux,pagina_z)
	if(f.cfg_sw_aux.value==f.cfg_sw2_aux.value){
		if (f.cfg_sw_aux.value!="1"){
			f.cfg_sw_aux.value = "1"
		}else{
			f.cfg_sw_aux.value = "0"
		}// end if
	}// end if
	return true
}// end function

function menu_aux(para_x,form_x,aux_x,obj_x,text,modo){
	var m;
	var c;
	var obj = obj_x;
	var campo_texto = (text==null)?(obj):(text);		
	x = get_form(form_x)
	if(aux_x=="1"){
		m = validar_form(x)
		//return m;
	}else if(aux_x=="2"){
		processData()
		m = validar_form(x)
	}else if(aux_x=="3"){
		m = validar_form(x)
		if(m == true){
			m = confirmaciones();
		}
	}else if(aux_x=="4"){
		var campo = x.elements[obj].value
		var cad = new String(campo);
		//hora = cad.substr(0,2);
		if(!this.obligatorio(campo) || campo == ' ' || cad.substr(0,2) == '  '){
			alert('El campo '+campo_texto+' es obligatorio');
			m = false;
		}else{
			m = validar_form(x);
		}//end if
	}else if(aux_x=="5"){
		m = validar_form(x)
		if(m)
			m = validacion_especial(obj,text,modo);
	}else if(aux_x=="6"){
		m = validacion_especial(obj,text,modo);
		if(m)
			m = validar_form(x)
	}else{
		m = true;
	}//end if
	if(m == true){
		menu(form_x,para_x,'cfg_','_aux')
		f.submit()
	}//end if
}// end function

function obligatorio(valor_x){	re = /.+/	var matchArray = re.exec(valor_x)	//alert (matchArray)
	if (matchArray){		return true	}// end if
	return false}// end function

if(navigator.userAgent.indexOf("MSIE")>=0) navegador=0;
else navegador=1;

function colocaAyuda(event){
	if(navegador==0)	{
		var corX=window.event.clientX+document.documentElement.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop;
	}else{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	cAyuda.style.top=corY+20+"px";
	cAyuda.style.left=corX+15+"px";
}

function ocultaAyuda(){
	cAyuda.style.display="none";
	if(navegador==0){
		document.detachEvent("onmousemove", colocaAyuda);
		document.detachEvent("onmouseout", ocultaAyuda);
	}else{
		document.removeEventListener("mousemove", colocaAyuda, true);
		document.removeEventListener("mouseout", ocultaAyuda, true);
	}
}

function muestraAyuda(event, campo, mensaje, oblig){
	cAyuda=document.getElementById("mensajesAyuda");
	cNombre=document.getElementById("ayudaTitulo");
	cTex=document.getElementById("ayudaTexto");
	colocaAyuda(event);
	if(navegador==0){
		document.attachEvent("onmousemove", colocaAyuda);
		document.attachEvent("onmouseout", ocultaAyuda);
	}else{
		document.addEventListener("mousemove", colocaAyuda, true);
		document.addEventListener("mouseout", ocultaAyuda, true);
	}
	var o = (oblig==1)?(' (Obligatorio)'):('');
	cNombre.innerHTML = campo+o;
	cTex.width = 'auto';
	cTex.innerHTML = msj = (mensaje==null)?('<br>'):(mensaje);
	cAyuda.style.display="block";
}

function rd_rusnies(valor_x){
	var obj_x = document.getElementById("id_cedula_sni");
	obj_x.focus();
}//end function

function contador_visitas_enlaces(a,b,c,n,v){
	almacenar_visita(n,v);
	if(c != 0){
		abrir_pop_up(a,b,c);
	}else{
		abrir_vinculo(a,b);	
	}//end if
}//end function

var cn_ajax = null;

function almacenar_visita(n,v){
	var cad_x = 'n='+encodeURIComponent(n)+'&v='+encodeURIComponent(v);
	cn_ajax = crearXMLHttpRequest();
	//cn_ajax.onreadystatechange = procesar_visita;
	cn_ajax.open("POST","extranet/portal/ctrl_portal/ctrl_portal_contador_enlaces.php",true);
	cn_ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	cn_ajax.send(cad_x);
}//end function

function procesar_busqueda_resultados_sni(){
	var valor_x = document.getElementById("id_combo_sni");
	var valor_x2 = document.getElementById("id_cedula_sni");
	valor_x.className = '';
	valor_x2.className = '';
	if((valor_x.value == '' || valor_x.value == null)){
		alert('Debe seleccionar un tipo de búsqueda');
		valor_x.className = 'obligatorio';
		valor_x.focus();
		return false;
	}
	if((valor_x2.value == '' || valor_x2.value == null)){
		alert('Debe ingresar un número de cédula');
		valor_x2.className = 'obligatorio';
		valor_x2.focus();
		return false;
	}
	if(isNaN(valor_x2.value)){
		alert('Debe ingresar un número de cédula válido');
		valor_x2.className = 'obligatorio';
		valor_x2.focus();
		valor_x2.select();
		return false;
	}
	switch(valor_x.value){
		case '1':
			menu_aux('objeto:PNEV;objeto9:consulta_registro_2009;parametro:'+valor_x2.value);
		break;
		case '2':
			menu_aux('objeto:PNEV;objeto9:cont_portal_info_PNEV_resultados;parametro:'+valor_x2.value);
		break;
		case '3':
			menu_aux('objeto:rusnies;parametro:'+valor_x2.value);
		break;
		case '4':
			menu_aux('objeto:buscar_hist_resultado_pni;parametro:'+valor_x2.value);
		break;
		case '5':
			menu_aux('objeto:buscar_hist_resultado_pni2009;parametro:'+valor_x2.value);
			//abrir_vinculo('http://rusnies.opsu.gob.ve','_rusnies');
		break;
	}//end switch
}//end function

function crearXMLHttpRequest(){
	try {
		var xmlHttp=null;
		if (window.ActiveXObject) 
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		else 
		if (window.XMLHttpRequest) 
			xmlHttp = new XMLHttpRequest();
		return xmlHttp;
	}catch(exception) {
		if(exception.description == null){
			alert("Excepción a: " + exception.message);  
		}else{
			alert("Excepción a: " + exception.description);
		}//end if
	}//end try
}//end function

var arr_noticias = new Array();

function buscar_noticia(n){
	try {
		//var cad_x = 'n='+encodeURIComponent(n)+'&v='+encodeURIComponent(v);
		cn_ajax = crearXMLHttpRequest();
		var cad_x = encodeURIComponent(null)
		cn_ajax.onreadystatechange = procesar_busqueda;
		cn_ajax.open("POST","rss/xml_noticias_js.xml",true);
		cn_ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		cn_ajax.send(cad_x);
	}catch(exception) {
		if(exception.description == null){
			alert("Excepción a: " + exception.message);  
		}else{
			alert("Excepción a: " + exception.description);
		}//end if
	}//end try
}//end function

function procesar_busqueda(){
   if(cn_ajax.readyState  == 4){
        if(cn_ajax.status  == 200) {
        		var n = 0;
            if(datos = cn_ajax.responseXML){
  					cds = datos.getElementsByTagName("enlaces");
	  				for(i=0; i<cds.length; i++){
						arr_noticias[i] = new Array();
						datos2 = cn_ajax.responseXML.documentElement;
	           		var titulo = datos2.getElementsByTagName('titulo')[i].firstChild.nodeValue;
	           		var contenido = datos2.getElementsByTagName('resumen')[i].firstChild.nodeValue;
	           		var id = datos2.getElementsByTagName('id')[i].firstChild.nodeValue;
	           		var img = datos2.getElementsByTagName('archivo')[i].firstChild.nodeValue;
	           		var fec = datos2.getElementsByTagName('fecha')[i].firstChild.nodeValue;
						var f = fec.split("-");
						var fecha = f[2]+'/'+f[1]+'/'+f[0];
	  					arr_noticias[i][0] = titulo+' - '+fecha;
	  					arr_noticias[i][1] = contenido;
	  					arr_noticias[i][2] = id;
	  					arr_noticias[i][3] = img;
	  				}//end for i
  				}
        }//end if
   }//end if
}//end function

var cn_ajax = null;
var cont_op = 1;
var t;
var t2;
var cont = 1;
var n = 0;
var cx = 0;
var cy = 0;
var modo_x = 0;
var periodo_rotacion = 5000;

function rotar_noticias(){
	//e = document.getElementById("noticias");
	//e.style.opacity = 1;
	t = setTimeout(cambio, periodo_rotacion);
	function cambio(){
		var img_x = '';
		if(arr_noticias[cont] instanceof Array){
			if(arr_noticias[cont][3] != null && arr_noticias[cont][3] != 'undefined'){
				if(arr_noticias[cont][3] != 'null'){
					im = arr_noticias[cont][3].split(".");
					img = im[0]+'_thm.'+im[1];
					var img_x = '<img src="extranet/rrpp/noticias/imagenes/'+arr_noticias[cont][3]+'" onclick="abrir_vinculo(\'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[cont][2]+'\')" style="cursor:pointer" width="340" height="205">';
				}//end if
			}//end if
		}//end if
		var ti = document.getElementById("id_titulo_noticia");
		var co = document.getElementById("id_cont_noticia");
		//alert('Cont '+cont)
		ti.innerHTML = arr_noticias[cont][0];
		if(img_x!=''){
			co.innerHTML = img_x;
		}else{
			co.innerHTML = arr_noticias[cont][1];
		}
		img_x = '';
  		//co.innerHTML = img_x+arr_noticias[cont][1];
  		var control = document.getElementById("id_td_noticia");
  		var control_mas = document.getElementById("id_mas_noticias");
  		control['onclick'] = new Function('abrir_vinculo(\''+'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[cont][2]+'\')');
  		control_mas['onclick'] = new Function('abrir_vinculo(\''+'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[cont][2]+'\')');
		cont++;
		if(cont==8){cont=0}
		navegador_noticia(n)
		rotar_noticias();
	}//end function
}//end function

function mostrar_noticia(n){
	var img_x = '';
	if(arr_noticias[n][3] != 'null'){
		//im = arr_noticias[n][3].split(".");
		//img = im[0]+'_thm.'+im[1];
		img_x = '<img src="extranet/rrpp/noticias/imagenes/'+arr_noticias[n][3]+'" onclick="abrir_vinculo(\'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[n][2]+'\')" style="cursor:pointer" width="340" height="205">';
	}
	var ti = document.getElementById("id_titulo_noticia");
	var co = document.getElementById("id_cont_noticia");
	ti.innerHTML = arr_noticias[n][0];
  	//co.innerHTML = img_x+arr_noticias[n][1];
  	if(img_x!=''){
		co.innerHTML = img_x;
	}else{
		co.innerHTML = arr_noticias[n][1];
	}
  	var control = document.getElementById("id_td_noticia");
  	var control_mas = document.getElementById("id_mas_noticias");
  	control['onclick'] = new Function('abrir_vinculo(\''+'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[n][2]+'\')');
  	control_mas['onclick'] = new Function('abrir_vinculo(\''+'extranet/rrpp/noticias/index.php?id_not='+arr_noticias[n][2]+'\')');
	clearTimeout(t)
	navegador_noticia(n);
	rotar_noticias()
}

function navegador_noticia(n){
	var a = 7;
	var s = 1;	
	if(n==1){
		s = 2;
		a = 0;
	}else if(n==2){
		s = 3;
		a = 1;
	}else if(n==3){
		s = 4;
		a = 2;
	}else if(n==4){
		s = 5;
		a = 3;
	}else if(n==5){
		s = 6;
		a = 4;
	}else if(n==6){
		s = 7;
		a = 5;
	}else if(n==7){
		s = 0;
		a = 6;
	}
	var ant = document.getElementById("id_ant_noticia");
	var sig = document.getElementById("id_sig_noticia");
	ant['onclick'] = new Function('mostrar_noticia('+a+')');
  	sig['onclick'] = new Function('mostrar_noticia('+s+')');
}
buscar_noticia(n)

val = new Array();
function extraer_val(nombre){	arr1 = val[nombre]	cad1 = arr1.split(";")	for (j=0;j<cad1.length;j++){		arr2 = cad1[j].split(":")		aux[arr2[0]]=arr2[1]	}// next
	if (aux["titulo"]=="" || aux["titulo"]==null){		aux["titulo"]=nombre	}// end if
}// end function
function validar_condicion(nombre,valor){	campo = valor	r_condicion = aux["condicion"]	if (aux["msgerror"]!="" && aux["msgerror"]!=null){		mensaje = aux["msgerror"]	}else{		mensaje = "El valor del campo "+aux["titulo"]+" debe cumplir la condicion: "+r_condicion	}// end if
	if (!eval(r_condicion)){		return false	}// end if
	return true}// end functionfunction validar_ext(control_x,control_x){	alert(control_x)	alert(valor_x)}//end function
function validar_rangos(nombre,valor){
	var activar_msj_def = true;	tipo_rango = parseInt(aux["rango"])	if (tipo_rango<1 || tipo_rango>9){		return true	}// endif
	r_minimo = parseInt(aux["min"])	r_maximo = parseInt(aux["max"])
	r_comodin_a = parseInt(aux["cmda"])	r_comodin_b = parseInt(aux["cmdb"])
	r_comodin_c = parseInt(aux["cmdc"])	r_valor = parseInt(valor)

	if(aux["mostrar"]!=null){
		activar_msj_def = false;
		mensaje = aux["mostrar"];
	}else{		mensaje = "El valor del campo "+aux["titulo"]+" "	}
	/*rango 1:>= y <=; 2:>=; 3:<=; 4:> y <; 5:>; 6:<; 7:<= o >=; 8:< o >;*/
	switch (tipo_rango){		case 1:			r_condicion = " r_valor >= r_minimo && r_valor <= r_maximo "			if(activar_msj_def)
				mensaje += "debe estar entre " + r_minimo + " y " + r_maximo			break		case 2:				r_condicion = " r_valor >= r_minimo "
			if(activar_msj_def)				mensaje += "debe ser mayor o igual que " + r_minimo			break		case 3:			r_condicion = " r_valor <= r_maximo "
			if(activar_msj_def)				mensaje += "debe ser menor o igual que " + r_maximo			break		case 4:				r_condicion = " r_valor > r_minimo && r_valor < r_maximo "			if(activar_msj_def)				
				mensaje += "debe ser mayor que " + r_minimo + " y menor que " + r_maximo			break		case 5:				r_condicion = " r_valor > r_minimo "
			if(activar_msj_def)				mensaje += "debe ser mayor que " + r_minimo			break		case 6:			r_condicion = " r_valor < r_maximo "			if(activar_msj_def)
				mensaje += "debe ser menor que " + r_maximo			break		case 7:			r_condicion = " r_valor <= r_minimo || r_valor >= r_maximo "			if(activar_msj_def)
				mensaje += "debe menor o igual que " + r_minimo + " o mayor o igual que " + r_maximo										break		case 8:			r_condicion = " r_valor < r_minimo || r_valor > r_maximo "			if(activar_msj_def)
				mensaje += "debe menor que " + r_minimo + " o mayor que " + r_maximo										break
		case 9:			//r_condicion = " (r_valor >= r_minimo && r_valor <= r_maximo && r_valor != r_comodin_a) "			
			r_condicion = " (r_valor == r_comodin_a || r_valor == r_comodin_b  || r_valor == r_comodin_c) || (r_valor >= r_minimo && r_valor <= r_maximo && r_valor) "			
			//alert(r_condicion)
			if(activar_msj_def)
				mensaje += "debe menor que " + r_minimo + " o mayor que " + r_maximo										break	}// end switch
	if (!eval(r_condicion)){		return false	}// end if
	return true
}// end function
function validar_campos(control){	this.eval_exp = eval_exp	this.no_vacio = no_vacio	//this.fecha = new obj_fecha	function no_vacio(valor_x){		re = /.+/		var matchArray = re.exec(valor_x)		//alert (matchArray)
		if (matchArray){			return true		}// end if
		return false	}// end function	
	function eval_exp(patron_x,valor_x){		if (this.no_vacio(valor_x)){			var re = eval("/"+patron_x+"/i")			var matchArray = re.exec(valor_x)			if (matchArray){				return true			}else{				return false			}// end if					}// end if
		return true			}// end function
			tipo_x = control.type	valor_x = control.value	tipo_x = (tipo_x=="textarea" || tipo_x=="hidden" || tipo_x=="password")?"text":tipo_x	aux = new Array()	switch(tipo_x){
	case "text":		if (val[control.name]!="" && val[control.name]!=null){			//Extraer Valores
			extraer_val(control.name)
			var activar_msj_def = true;
			if(aux["mostrar"]!="" && aux["mostrar"]!=null && aux["mostrar"]!="undefined"){
				activar_msj_def = false;
				mensaje = aux["mostrar"];
			}else{				mensaje = "El valor del campo "+aux["titulo"]+" "			}
						if (aux["obligatorio"]=="si" && (!this.no_vacio(valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" es obligatorio"				return false			}//end if

			if (aux["fecha"]=="si" && (this.no_vacio(valor_x)) && !this.fecha.validar(valor_x)){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser una Fecha válida"				return false			}// end if			if (aux["email"]=="si" && (!this.eval_exp("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser una Dirección de Correo válida"				return false			}// end if
			if (aux["rif"]=="si" /*&& (!this.eval_exp("^[JV]-[0-9]{1,8}(-[0-9]){0,1}$",valor_x))*/){				//var re = /^[J]+(\.[0-9])*{5,10}$/
				//^[JV]-[0-9]{1,8}(-[0-9]){0,1}$				//var re = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$/				var re = /^[EJVejv]+-([\d]+)(-[\w])?$/				var matchArray = re.exec(valor_x)
				if (!matchArray){					if(activar_msj_def)
						mensaje = "El campo "+aux["titulo"]+" debe ser un R.I.F válido"					return false				}// end if			
			}// end if		
			if (aux["alfabetico"]=="si" && (!this.eval_exp("^([ A-ZñÑáéíóúÁÉÍÓÚ ]+)$",valor_x))){					if(activar_msj_def)
						mensaje = "El campo "+aux["titulo"]+" debe ser Alfabético"				return false			}// end if			//if (aux["alfanumerico"]=="si" && (!this.eval_exp("^([ \\w]+)$",valor_x))){
			if(aux["alfanumerico"]=="si" && (!this.eval_exp("^([ A-Z0-9a-zñÑáéíóúÁÉÍÓÚ,._-]+)$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser Alfanumérico"				return false			}// end if			
			
			if(aux["clave"]=="si" && (!this.eval_exp("^([ A-Z0-9a-z+._#,*&%$@/\\-]+)$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" no es una contraseña válida"				return false			}// end if
			
			if(aux["usuario"]=="si" && (!this.eval_exp("^([ A-Z0-9A-Z._-]+)$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" no es una contraseña válida"				return false			}// end if
			
			if(aux["direccion"]=="si" && (!this.eval_exp("^([() A-Z0-9a-zñÑáéíóúÁÉÍÓÚ,#=0;:._-]+)$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser Alfanumérico"				return false			}// end if
						
			if(aux["query"]=="si" && (!this.eval_exp("^([() A-Z0-9a-zñÑáéíóúÁÉÍÓÚ,'#=0;:._-]+)$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser Alfanumérico"												return false			}// end if
			
			if (aux["isbn"]=="si" && (!this.eval_exp("^[0-9]{1,5}-[0-9]{1,7}-[0-9]{1,6}-[0-9xX]$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+"La estructura del ISBN introducido no coincide con el estandar ISBN\n\nEjemplo: 0-8436-1072-7"
				/*\n\n El estÃÂÃÂ¡ndar indica esta estructu0ra:
				\nde 1 a 5 nÃÂÃÂºmeros\ngenterouiÃÂÃÂ³n
				\nde 1 a 7 nÃÂÃÂºmeros\nguiÃÂÃÂ³n
				\nde 1 a 6 nÃÂÃÂºmeros\nguiÃÂÃÂ³n
				\ndÃÂÃÂ­gito de control. de 0 a 9 o \"X\" si el dÃÂÃÂ­gito es 10
				\nLa longitud total debe ser de 10 dÃÂÃÂ­gitos, mÃÂÃÂ¡s los tres guiones.*/				return falseentero			}// end if
			
			if (aux["numerico"]=="si" && (!this.eval_exp("^[-]?\\d*\\.?\\d*$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser numérico"				return false			}// end if
	
			if (aux["decimal"]=="si" && (!this.eval_exp("^[-]?\\d*\,?\\d*$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser Decimal"				return false			}// end if
	
			if (aux["numerico2"]=="si" && (!this.eval_exp("[0-9]",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser numérico"				return false			}// end if			if (aux["entero"]=="si" && (!this.eval_exp("^[-]?\\d*$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser un número entero"				return false			}// end if			if (aux["positivo"]=="si" && (!this.eval_exp("^\\d*\\.?\\d*$",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser un número positivo"				return false				}// end if			if (aux["nocero"]=="si" && !isNaN(valor_x) && valor_x==0 && valor_x.length!=0){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser un número distinto de cero"				return false			}// end if			if (aux["mayorcero"]=="si" && !isNaN(valor_x) && valor_x<=0 && valor_x.length!=0){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser un número mayor de cero"				return false			}// end if
			
			//CORCARIBE
			if (aux["digitos"]=="si" && valor_x.length < aux["cantidad"]) {
				if(activar_msj_def){
				   mensaje = "El campo "+aux["titulo"]+" debe tener mínimo "+aux["cantidad"]+" dígitos";				   return false
				}//end if
			}// end if
         //FIN CORCARIBE
         			if (aux["hora"]=="si" && (!this.eval_exp("^(1|01|2|02|3|03|4|04|5|05|6|06|7|07|8|08|9|09|10|11|12)\:([0-5]0|[0-5][1-9])",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser una Hora válida"				return false			}// end if			if (aux["sin_espacio"]=="si" && (this.eval_exp("[ ]+",valor_x))){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" no debe tener espacios en blanco"				return false			}// end if

			if (aux["telefono"]=="si" && (!this.eval_exp("^([0-9]{3,4}-?)?[0-9]{7}$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" no es un número válido Ej. 0212-555555";				return false			}// end if
			
			if (aux["telefonos"]=="si" && (!this.eval_exp("^([0-9]{3,4}-[0-9]{7};{0,1}){0,3}$",valor_x))){
				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" no es un número válido Ej. 0212-555555";				return false			}// end if
			//alert()
			if (aux["min_caracteres"]=="si" && (valor_x.length)<aux["cant_caracteres"] && valor_x != ''){
				if(activar_msj_def){
					if(aux["entero"]=="si" || aux["decimal"]=="si" || aux["numerico"]=="si" || aux["positivo"]=="si"){
						mensaje = "El campo "+aux["titulo"]+" debe tener mínimo "+aux["cant_caracteres"]+" dígitos";					}else{
						mensaje = "El campo "+aux["titulo"]+" debe tener mínimo "+aux["cant_caracteres"]+" caracteres";
					}
				}
				return false			}// end if
						
			if (aux["consulta"]=="si" && (!this.eval_exp("(select)",valor_x))){				/*var cadena = new String(valor_x);				var lista = cadena.substr(0,6);				alert(lista)*/				//if(lista != "select"){				if(activar_msj_def)
					mensaje = "El campo "+aux["titulo"]+" debe ser una consulta SQL"				return false				//}//end if			}// end if
						/*if (aux["url"]=="si" && (this.eval_exp("http://([\w-]\.)+[\w-](/[\w- \./?%=]*)?",valor_x))){				mensaje = "El campo "+aux["titulo"]+" debe ser un url válido"				return false			}// end if*/			/*	
			if (aux["extension"]=="si" && valor_x.length!=0 && validar_ext(control,valor_x)){				mensaje = "El campo "+aux["titulo"]+" debe ser un número mayor de cero"				return false			}// end if
			*/			if (aux["rango"]!="" && aux["rango"]!=null){				return validar_rangos(control.name,valor_x)			}// end if
						if (aux["condicion"]!="" && aux["condicion"]!=null){				return validar_condicion(control.name,valor_x)			}// end if		}// end if		break	case "select-one":
		if (val[control.name]!="" && val[control.name]!=null){			extraer_val(control.name)
			var activar_msj_def = true;
			if(aux["mostrar"]!="" && aux["mostrar"]!=null && aux["mostrar"]!="undefined"){
				activar_msj_def = false;
				mensaje = aux["mostrar"];
			}else{				mensaje = "El valor del campo "+aux["titulo"]+" "			}			if (aux["obligatorio"]=="si" && (valor_x=="" || valor_x==null)){				if(activar_msj_def)
				mensaje = "El campo "+aux["titulo"]+" es Obligatorio"				return false						}// end if

			if (aux["rango"]!="" && aux["rango"]!=null){				return validar_rangos(control.name,valor_x)			}// end if		}// end if	break
	case "select-multiple":
		if (val[control.name]!="" && val[control.name]!=null){			extraer_val(control.name)
			var activar_msj_def = true;
			if(aux["mostrar"]!="" && aux["mostrar"]!=null && aux["mostrar"]!="undefined"){
				activar_msj_def = false;
				mensaje = aux["mostrar"];
			}else{				mensaje = "El valor del campo "+aux["titulo"]+" "			}			if (aux["obligatorio"]=="si" && (valor_x=="" || valor_x==null)){				if(activar_msj_def)
				mensaje = "El campo "+aux["titulo"]+" es Obligatorio"				return false						}// end if

			if (aux["rango"]!="" && aux["rango"]!=null){				return validar_rangos(control.name,valor_x)			}
					}	break	}	return true}function validar_form(form_x){	n_ele = form_x.elements.length	for (i=0;i<n_ele;i++){		if (!validar_campos(form_x.elements[i])){			alert (mensaje)			nombre_x = form_x.elements[i].name			if (aux["fecha"]=="si" && aux["tipo"]=="combos"){				nombre_x = form_x.elements[i].name+"_dia_aux"			}else{				if (aux["tipo"]=="calendario"){					nombre_x = form_x.elements[i].name+"_aux"				}else{					if (aux["hora"]=="si" && aux["tipo"]=="combos"){						nombre_x = form_x.elements[i].name+"_h_aux"					}//end if				}// end if			}// end if			form_x.elements[nombre_x].focus()			if (form_x.elements[nombre_x].type=="text")				form_x.elements[nombre_x].select()			return false		}// end if	}// next	return true}// end function

var modo_sac = 0;
function buscar_sacapuntas(modo){
	try {
		if(modo!=null || modo!='undefined')
			modo_sac = modo;
		cn_sac = crearXMLHttpRequest();
		var cad_x = encodeURIComponent(null)
		cn_sac.onreadystatechange = procesar_sacapuntas;
		cn_sac.open("POST","extranet/portal/xml/xml_publicos/xml_sacapunta.xml",true);
		cn_sac.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		cn_sac.send(cad_x);
	}catch(exception) {
		if(exception.description == null){
			alert("Excepción a: " + exception.message);  
		}else{
			alert("Excepción a: " + exception.description);
		}//end if
	}//end try
}//end function

var sac_act = '';
function procesar_sacapuntas(){
   if(cn_sac.readyState  == 4){
        if(cn_sac.status  == 200){
        		var n = 0;
           	var datos = cn_sac.responseXML;
  				cds = datos.getElementsByTagName("boletin");
				var cad = new String();
				var t = cds.length;
  				if(modo_sac == 1){
	  				for(i=0;i<cds.length;i++){
						datos2 = cn_sac.responseXML.documentElement;
	           		var mesx = datos2.getElementsByTagName('mes')[n].firstChild.nodeValue;
	           		var anniox = datos2.getElementsByTagName('annio')[n].firstChild.nodeValue;
	           		var dirx = datos2.getElementsByTagName('dir')[n].firstChild.nodeValue;
	           		if(i==0){
	           			sac_act = datos2.getElementsByTagName('dir')[n].firstChild.nodeValue;
	           		}
	           		n++;
	           		cad += '<div style="padding:2px;"><span style="padding-left:5px;" id="id_mas_noticias" onclick="abrir_vinculo(\''+dirx+'\',\'_sac\')" onmouseout="this.className=\'titulo_noticia_mas_inf\'" onmouseover="this.className=\'titulo_noticia_mas_inf_over\'" class="titulo_noticia_mas_inf" title="Ver Sacapunta '+mesx+' '+anniox+'">- Sacapunta '+mesx+' '+anniox+'</span></div>';
	  				}//end for i
	  				 var obj_x = document.getElementById("id_sacapunta");
  					obj_x.innerHTML = cad;
  					var obj_y = document.getElementById("id_mas_sacapunta");
  					obj_y.style.height = '15px';
  					obj_y.innerHTML = '<span onclick="volver_sacapuntas()" onmouseout="this.className=\'titulo_noticia_mas_inf\'" onmouseover="this.className=\'titulo_noticia_mas_inf_over\'" class="titulo_noticia_mas_inf"><- Volver</span>';
  				}else{  					
  					if(cds.length>1){
  						var obj_y = document.getElementById("id_mas_sacapunta");
  						obj_y.style.height = '15px';
  						obj_y.innerHTML = '<span onclick="buscar_sacapuntas(1)" onmouseout="this.className=\'titulo_noticia_mas_inf\'" onmouseover="this.className=\'titulo_noticia_mas_inf_over\'" class="titulo_noticia_mas_inf">[ Mostrar ediciones anteriores ]</span>';
  					}//end if
  				}//end if

        }//end if
   }//end if
}//end function

function volver_sacapuntas(){
	var obj_y = document.getElementById("id_sacapunta");
	obj_y.innerHTML = '<img src="/extranet/portal/imagenes/sacapunta.png" title="Sacapunta" onclick="abrir_vinculo(\''+sac_act+'\',\'_sac\')" style="cursor: pointer;" alt="sacapunta.png" height="80" width="335">';
	//==========
	var obj_x = document.getElementById("id_mas_sacapunta");
  	obj_x.style.height = '15px';
  	obj_x.innerHTML = '<span onclick="buscar_sacapuntas(1)" onmouseout="this.className=\'titulo_noticia_mas_inf\'" onmouseover="this.className=\'titulo_noticia_mas_inf_over\'" class="titulo_noticia_mas_inf">[ Mostrar ediciones anteriores ]</span>';
}//end function
