 ns4 = (document.layers)? true:false
 ie4 = (document.all)? true:false
 
 /*<%
 '*********************************************************
 ' Proposito: Activa objeto radio.
 ' Entrada: obj_radio - objeto radio
 '          int_value - indice a seleccionar
 ' Retorno: true - No valido
 '          false - Valido   
 '*********************************************************
 %>*/ 
 function activar_radio(obj_radio,int_value){
    for (i=0; i < obj_radio.length; i++){
	    if (obj_radio[i].value == int_value){
		    obj_radio[i].checked = true;
			asignacion = 1;
		}
    }
	if (asignacion == 0) return true;  	  
    return false;
 }

 /*<%
 '*********************************************************
 ' Proposito: Activa objeto select.
 ' Entrada: obj_select - objeto select
 '          int_value - valor a seleccionar
 ' Retorno: true - no seleccionado
 '          false - seleccionado   
 '*********************************************************
 %>*/ 
 function activar_select(obj_select,int_value){
	if (!obj_select) {return true}
    asignacion = 0; 
    for (i=0; i < obj_select.length; i++){
	    if (obj_select.options[i].value == int_value){
		    obj_select.options[i].selected = true;
			asignacion = 1;
		}
    }
	if (asignacion == 0) return true;  	  
    return false;
 }

 /*<%
 '*********************************************************
 ' Proposito: Activa objetos checkbox por nombre.
 ' Entrada: obj_forma - objeto forma
 '           str_nombre - parte nombre del checkbox
 ' Retorno: true - no seleccionado
 '          false - seleccionado   
 '*********************************************************
 %>*/ 
 
  function checkbox_nombre(obj_forma,str_nombre,bln_estado){
     var obj_elemento,int_retorno
	 int_retorno = 1;
     for(var int_i=0;int_i< obj_forma.length;int_i++){
         obj_elemento = obj_forma.elements[int_i];
         if (obj_elemento.type=='checkbox' && Boolean(obj_elemento.name.indexOf(str_nombre) + 1) ){
    	     obj_elemento.checked = bln_estado
			 int_retorno = 0
	     }
	  }
      return(int_retorno)
 }	
 /*<%
 '*********************************************************
 ' Proposito: Decodifica el urlencode.
 ' Entrada: str_urlencoded - string codificada
 ' Retorno: cadena decodificada   
 '*********************************************************
 %>*/ 
 function urldecode(str_urlencoded) 
{
  if (str_urlencoded == '') return ''
  var lsRegExp = /\+/g;
  return unescape(String(str_urlencoded).replace(lsRegExp, " ")); 
}

 /*<%
 '*********************************************************
 ' Proposito: Selecciona check box en base al nombre
 ' Entrada: 
 ' Retorno:    
 '*********************************************************
 %>*/ 
 function checkbox_singular(obj_checkbox_singular,obj_checkbox_total){
	 if (!obj_checkbox_singular.checked) obj_checkbox_total.checked = false;
 }
 function checkbox_todo(obj_checkbox_total,obj_forma){
	 if (obj_checkbox_total.checked) checkbox_nombre(obj_forma,'borrar',1)
	 else checkbox_nombre(obj_forma,"borrar",0)
 }   	
 function checkbox_nombre(obj_forma,str_nombre,int_estado){
     for(int_i=0;int_i< obj_forma.length;int_i++){
         obj_elemento = obj_forma.elements[int_i];
         if (obj_elemento.type=='checkbox' && Boolean(obj_elemento.name.indexOf(str_nombre) + 1)) obj_elemento.checked = int_estado;	
     }
 } 
 /*<%
 '*********************************************************
 ' Proposito: escribe sobre un Layer
 ' Entrada: 
 ' Retorno:    
 '*********************************************************
 %>*/ 
function layerWrite(id,nestref,text) {
	if (ns4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	else if (ie4) document.all[id].innerHTML = text
}
 /*<%
 '*********************************************************
 ' Proposito: Abre modulo de subir archivo
 ' Entrada: 
 ' Retorno:    
 '*********************************************************
 %>*/ 
 function subir(int_archivo_id,str_campo,int_set){
	window.open('/includes/modulos/s_archivo.asp?int_archivo_id='+int_archivo_id+'&str_campo='+str_campo+'&int_set='+int_set,'subir_archivo','width=350,height=200,scrollbars=yes, Left=' + (screen.width /2- 400) + ', Top=' + (screen.height / 2 - 200) + '');
 }

  /*<%
 '*********************************************************
 ' Proposito: Abre modulo de subir archivo
 ' Entrada: 
 ' Retorno:    
 '*********************************************************
 %>*/ 
 function lanzar_ventana(str_media,int_imprimir,str_param){
 	if (str_param == null) str_param = 'width=155,height=400,scrollbars=no, Left=' + (screen.width /2- 200) + ', Top=' + (screen.height / 2 - 78) + ''
	window.open('/includes/modulos/ventana.asp?str_media='+str_media+'&bln_imprimir='+int_imprimir+'&"','ventana', str_param ); 
}
