﻿function LTrim( value ) {
	
    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
    return LTrim(RTrim(value));
	
}
function abrir_popup(ruta, ancho, alto) {
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
    win = window.open(ruta, "ventana", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "");
    win.opener=self;
}
function abrir_popup_foto(ruta, ancho, alto) {
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
    win = window.open(ruta, "ventana_foto", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, top=" + 0 + ", left=" + 0 + " width=" + ancho + ", height=" + alto + "");
    win.opener=self;
}
function auto_tamano_imagen() {
if (document.all || document.layers);
    window.resizeTo(document.images[0].width + 12,document.images[0].height + 50);
}

function esLetra( t ) {
    var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz";
    var checkStr = t;
    var allValid = true;
    var found = false;
    
    for (i = 0; i < checkStr.length; i++) {
        ch = checkStr.charAt(i);
        for (j = 0; j < checkOK.length; j++) {
            if ( ch == checkOK.charAt(j) ) {
                found = true;
                break;
            }
            if ( j == checkOK.length - 1 ) {
                allValid = false;
                break;
            }
        }
    }
    if (!allValid) {
        return false;
    }
    else {
        return true;
     }
}

function validaPassword(source, arguments) {     
    //Obtiene valor inicial                
    var valor = document.all.ctl00_containerEditable_txtClave1.value;
    if ( valor.length < 8 ) {
        arguments.IsValid = false;
        return;
    }
    else {
        var i, numeros = 0, otro = 0, letra = 0;
        //Bucle para comparar los valores introducidos en las cajas de texto
        for (i = 0;i < valor.length;i++){
            if ( !isNaN(parseInt( valor.charAt( i ) ) ) ) {
                numeros++;
            }
            else if ( esLetra( valor.charAt( i ) ) )  {
                letra++;
            }
            else {
                otro++;
            }
        }
        if ( numeros < 2 ) {
            arguments.IsValid = false;
            return;
        }
        if ( letra < 4 ) {
            arguments.IsValid = false;
            return;
        }
        if ( otro > 0 ) {
            arguments.IsValid = false;
            return;
        }
    }
    arguments.IsValid=true;    //Si llego hasta aqui entonces la validación fue exitosa
}

function validaPasswordPublico(source, arguments) {     
    //Obtiene valor inicial                
    var valor = document.all.txtClave1.value;
    if ( valor.length < 8 ) {
        arguments.IsValid = false;
        return;
    }
    else {
        var i, numeros = 0, otro = 0, letra = 0;
        //Bucle para comparar los valores introducidos en las cajas de texto
        for (i = 0;i < valor.length;i++){
            if ( !isNaN(parseInt( valor.charAt( i ) ) ) ) {
                numeros++;
            }
            else if ( esLetra( valor.charAt( i ) ) )  {
                letra++;
            }
            else {
                otro++;
            }
        }
        if ( numeros < 2 ) {
            arguments.IsValid = false;
            return;
        }
        if ( letra < 4 ) {
            arguments.IsValid = false;
            return;
        }
        if ( otro > 0 ) {
            arguments.IsValid = false;
            return;
        }
    }
    arguments.IsValid=true;    //Si llego hasta aqui entonces la validación fue exitosa
}

<!--
//Función que abre una ventana
//@id: Parámetro identificador 
//@pag: Nombre de la Página 
function ventana_emergente(id, pag, ancho, alto)
{   
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
	if (id != ""){
	    url = pag; 
	}else{
		url = pag;
	}
    ventana = window.open(url,"ventana_emergente" + id,"toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizeable=0, top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "")
}

//Función que abre una ventana con las propiedades deseadas
//@id: Parámetro identificador 
//@pag: Nombre de la Página 
function ventana_sin_propiedades(id, pag, prop, ancho, alto)
{   
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
	if (id != ""){
	    url = pag + "?id=" + id; 
	}else{
		url = pag;
	}
    ventana = window.open(url, "ventana_sin_propiedades", prop + ", top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "")
}



//Función que abre una ventana con las propiedades deseadas
//@id: Parámetro identificador 
//@pag: Nombre de la Página 
function ventana_equipo(id, pag, prop, ancho, alto)
{   
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
	if (id != ""){
	    url = pag + "?id=" + id; 
	}else{
		url = pag;
	}
    ventana = window.open(url, "ventana_equipo", prop + ", top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "")
}


//Función que oculta un <td> o <tr> de una tabla
//@Estado_actual: 0 Si está oculto 
//                1 Si está visible
//@id: Nombre de id del <td> o <tr>
//@frm: Nombre de la forma
function ocultar(num, id)
{   
    if (num == 1){
        id.style.display = "block";
    }else{      
        id.style.display = "none";
    }
}


//Funciones utilizadas para crear y cargar  COOKIES
//INICIO
function setCookie(name, value, expires, path, domain, secure)
{
      document.cookie = name + "=" + escape(value) +
      ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
      ((path == null) ? "" : "; path=" + path) +
      ((domain == null) ? "" : "; domain=" + domain) +
      ((secure == null) ? "" : "; secure");
}

var expiration = new Date();
expiration.setTime(expiration.getTime() + 24 * 60 * 60 * 60 * 1000 * 3);

function set_cookie(idioma)
{
        setCookie('caracol',idioma, expiration);
        cargar_cookie();
}

function getCookie(name)
{
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1){
             begin += cname.length;
             end = dc.indexOf(";", begin);
             if (end == -1) end = dc.length;
             return unescape(dc.substring(begin, end));
    }
  }
}

function cargar_cookie()
{
   forma = document.frm_idioma;
   if(getCookie('canalcaracol')){
      var o_idioma = getCookie('canalcaracol')
      if (o_idioma == "espanol"){
           forma.idioma.value = "esp";
           forma.submit();
      }else if (o_idioma == "ingles"){
           forma.idioma.value = "eng";
           forma.submit();
      }
   }
}
//FIN

//Efecto para cerrar un popup
/*var ns4 = (parent.document.layers)? true:false
var ie4 = (parent.document.all)? true:false*/

function cerrarVentana(){
   if (ie4){
       parent.resizeBy(0,-15);
       setTimeout("cerrarVentana()",20);
       setTimeout("parent.close()",600);
   }else{
       parent.close();}
}
//-->


function upload(nombre_campo, rotulo, validacion, clase, pag, ancho, alto)
{   
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
    url = pag + "?iNombre_campo=" + nombre_campo + "&iRotulo=" + rotulo + "&iValidacion=" + validacion + "&iClase=" + clase;
    ventana_upload = window.open(url,"ventana_upload","toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizeable=0, top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "")
}

//FUNCION QUE BUSCA DENTRO DE UN OBJETO SELECT 
//INICIO
var timerid     = null;
var matchString = "";
var mseconds    = 1000; // Length of time before search string is reset

function shiftHighlight(keyCode,targ)
{
    keyVal      = String.fromCharCode(keyCode); // Convert ASCII Code to a string
    matchString = matchString + keyVal; // Add to previously typed characters
    elementCnt  = targ.length - 1;  // Calculate length of array -1
    for (i = elementCnt; i > 0; i--)
    {
        selectText = targ.options[i].text.toLowerCase(); // convert text in SELECT to lower case
        if (selectText.substr(0,matchString.length) ==  matchString.toLowerCase())
        {
            targ.options[i].selected = true; // Make the relevant OPTION selected
        }
    }
    clearTimeout(timerid); // Clear the timeout
    timerid = setTimeout('matchString = ""',mseconds); // Set a new timeout to reset the key press string
    return false; // to prevent IE from doing its own highlight switching
}
//FIN

//FUNCION QUE VALIDA SI EL AÑO ES BISIESTO
//INICIO
function v_fecha(vmes,vdia,vano)
{
    n_dias=31;
    if (vmes==4 || vmes==6 || vmes==9 || vmes==11){
        n_dias=30;
    }else{
        if (vmes==2){
            if (vano%4 == 0){
                n_dias = 29;
            }else{
                n_dias = 28;
            }
        }
    }
    if (vdia > n_dias || vdia<1){
        alert("No existe el dia "+vdia+" en el mes "+vmes);
        return 1;
    }
    return 0;
}
//FIN


//FUNCION QUE ABRE UNA VENTANA EMERGENTE
//INICIO
function abrir_image(ruta, ancho, alto)
{
    wintop = 0
    winleft = 0
    win = window.open(ruta, "ventana", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "");

    win.opener=self;
}
//FIN


//FUNCION QUE ABRE UNA VENTANA EMERGENTE
//INICIO
function abrir_popuptitulo(ruta, ancho, alto, titulo)
{
    wintop = (window.screen.height/2)-(alto/2);
    winleft = (window.screen.width/2)-(ancho/2);
	ventana=window.open(ruta,'ventana',"toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, top=" + wintop + ", left=" + winleft + " width=" + ancho + ", height=" + alto + "");
	ventana.document.write('<html><head><title>' + titulo + '</title></head><body bottommargin=0 rightmargin=0 leftmargin=0 marginheight=0 marginwidth=0 topmargin=0 oncontextmenu="return false" ondragstart="return false" onselectstart="return false"><img src="' + ruta + '" width="' + ancho + ' height="' + alto + '"></body></head></html>') 
	ventana.document.close() 
}
//FIN


//FUNCION QUE ABRE EL EDITOR EN UNA VENTANA EMERGENTE
//INICIO
function open_editor(form_name,field_name,temp_dir) {
  window.open('../includes/javascripts/editor/htmlarea/index.asp?parent_form='+form_name+'&parent_field='+field_name,'editorWindow','toolbars=no,scrollbars=yes,resizable=yes,width=780,height=420');

}
//FIN

//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function detalle(forma, pagina, identificador)
{
    forma = eval(forma);
    forma.hid_id.value = identificador;
    forma.action = pagina;
    forma.submit(); 
}
//FIN



//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function detalle_noticia(forma, pagina, ident1, ident2)
{
    forma = eval(forma);
    forma.hid_id_menu.value = ident1;	
	forma.hid_id.value = ident2;
    forma.action = pagina;
    forma.submit(); 
}
//FIN


//FUNCION QUE ENVIA EL ID DEL MENU POR POST
//INICIO
function detalle_menu(forma, pagina, identificador)
{
    forma = eval(forma);
    forma.hid_id_menu.value = identificador;
    forma.action = pagina;
    forma.submit(); 
}
//FIN

//FUNCION QUE ENVIA EL ID DEL PERSONAJE POR POST
//INICIO
function detalle_personaje(forma, pagina, identificador)
{
    forma = eval(forma);
    forma.hid_id_personaje.value = identificador;
    forma.action = pagina;
    forma.submit(); 
}
//FIN


//FUNCION QUE ENVIA EL ID DEL BUSCADOR POR POST
//INICIO
function detalle_buscador(forma, pagina, identificador)
{
    forma = eval(forma);
    forma.id_buscador.value = identificador;
    forma.action = pagina;
    forma.submit(); 
}
//FIN


//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function ordenar_por(identificador, campo)
{
    frm.hid_tipo_ordenar.value 	  = identificador;
    frm.cmdAccion.value = 'ordenar';
    frm.hid_ordenar.value = campo;
   	frm.action = document.URL;
    frm.submit(); 
}
//FIN


//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function nivel(valor, identificador, estado)
{
    frm.cmdAccion.value = 'nivel';
	frm.hid_valor.value = valor;
	frm.hid_id.value 	= identificador;
	frm.hid_campo.value = estado;
	frm.action = document.URL;
    frm.submit(); 
}
//FIN

//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function nivelm(valor, identificador, estado, modulo)
{
    frm.cmdAccion.value = 'nivel';
	frm.hid_valor.value = valor;
	frm.hid_id.value 	= identificador;
	frm.hid_campo.value = estado;
	frm.hid_modulo.value = modulo;
	frm.action = document.URL;
    frm.submit(); 
}
//FIN

//FUNCION QUE ENVIA UN CAMPO POR POST
//INICIO
function insertar(pagina)
{    
	frm.action = pagina;
	frm.submit(); 
}
//FIN

//FUNCION QUE ENVIA DATOS POR POST PARA BORRAR
//INICIO
function borrar(pagina, identificador)
{
    var confirmacion = window.confirm("Esta acción no se puede deshacer. ¿Desea continuar?");
    if (confirmacion) {
	    frm.hid_id.value 		= identificador;
		frm.cmdAccion.value 	= 'borrar';
    	frm.action = pagina;
	    frm.submit(); 
    }else{
        return;  
    }
}

//FUNCION QUE ENVIA DATOS PARA PUBLICAR UN REGISTRO
//INICIO
function publicar(pagina, identificador, valor)
{	
	if (valor == 0){ descripcion = 'Despublicar';}else{descripcion = 'Publicar';}
    var confirmacion = window.confirm("¿Está seguro de \"" + descripcion + "\" el registro seleccionado?");
    if (confirmacion) {
		frm.hid_id.value 	= identificador;
		frm.hid_valor.value = valor;
		frm.cmdAccion.value = 'publicar';
    	frm.action = pagina;       
        frm.submit();
    }else{
        return;  
    }
}
//FIN


//FUNCION QUE ENVIA DATOS PARA PUBLICAR UN REGISTRO
//INICIO
function publicar_int(pagina, identificador, tipo, valor)
{	
	if (valor == 0){ descripcion = 'Despublicar';}else{descripcion = 'Publicar';}
    var confirmacion = window.confirm("¿Está seguro de \"" + descripcion + "\" el registro seleccionado?");
    if (confirmacion) {
		frm.hid_id.value 	= identificador;
		frm.hid_valor.value = valor;
		frm.hid_tipo.value  = tipo;
		frm.cmdAccion.value = 'publicar';
    	frm.action = pagina;       
        frm.submit();
    }else{
        return;  
    }
}
//FIN



//FUNCION QUE ENVIA DATOS PARA PUBLICAR UN REGISTRO
//INICIO
function publicar_ppal(pagina, identificador, tipo, valor)
{	
	if (valor == 0){ descripcion = 'Despublicar';}else{descripcion = 'Publicar';}
    var confirmacion = window.confirm("¿Está seguro de \"" + descripcion + "\" el registro seleccionado?");
    if (confirmacion) {
		frm.hid_id.value 	= identificador;
		frm.hid_valor.value = valor;
		frm.hid_tipo.value  = tipo;
		frm.cmdAccion.value = 'publicar_ppal';
    	frm.action = pagina;       
        frm.submit();
    }else{
        return;  
    }
}
//FIN


//FUNCION QUE ENVIA DATOS PARA PUBLICAR SOLO UN REGISTRO
//@id = Identificador o valor del campo a publicar 
//@descripcion = Texto de la acción a realizar
//@valor = Valor con que se debe actualizar el campo de publicar 
//      0 = Despublicar
//      1 = Publicar
//INICIO
function PublicarPpal(pagina, identificador, valor)
{	
	if (valor == 0){ descripcion = 'Despublicar';}else{descripcion = 'Publicar';}
    var confirmacion = window.confirm("¿Está seguro de \"" + descripcion + "\" el registro seleccionado?");
    if (confirmacion) {
		frm.hid_id.value 	= identificador;
		frm.hid_valor.value = valor;
		frm.cmdAccion.value = 'publicar_ppal';
    	frm.action = pagina;       
        frm.submit();
    }else{
        return;  
    }
}
//FIN


//FUNCION QUE ENVIA EL VALOR DE LOS CAMPOS A PUBLICAR Y DESPUBLICAR
//@forma = Nombre de la forma
//@campo = Nombre del campo checkbox
//Nota: Requeriere de 3 objetos hidden 
//Archivo asociado = activar_varios.asp
//INICIO
function publicar_seleccion(forma, campo)
{
    var oPub;
    var oNoPub;
    var forma;
    oPub = "";
    oNoPub = "";
    var confirmacion = window.confirm("¿Está seguro de \"Publicar\" sólo el(los) registro(s) marcado(s)?");
    if (confirmacion) {
        total = eval("forma.elements.namedItem('" + campo + "').length;");
        for (i=0; i<total ;i++){ 
            obj_check = eval("forma." + campo + "[" + i + "].checked;");                    
            if (obj_check){                     
                if (oPub != ""){ 
                    oPub = oPub + ",";
                }
                oPub = oPub + eval("forma." + campo + "[" + i + "].value");
            }else{
                if (oNoPub != ""){ 
                    oNoPub = oNoPub + ",";
                }
                oNoPub = oNoPub + eval("forma." + campo + "[" + i + "].value");
            }
        }   
        forma.hid_chk.value     = oPub;
        forma.hid_no_chk.value  = oNoPub;
        forma.action            = "activar_varios.asp";
        forma.submit();
    }else{
        return;  
    }
    
}
//FIN



//FUNCION QUE ENVIA EL VALOR DE LOS CAMPOS A ELIMINAR
//@forma = Nombre de la forma
//@campo = Nombre del campo checkbox
//Nota: Requeriere de 3 objetos hidden 
//Archivo asociado = borrar_varios.asp
//INICIO
function eliminar_seleccion(forma, campo)
{
    var oBorrar;
    oBorrar = "";
    var confirmacion = window.confirm("¿Está seguro de \"Borrar\" el(los) registro(s) marcado(s)?");
    if (confirmacion) {
        total = eval("forma.elements.namedItem('" + campo + "').length;");
        for (i=0; i<total ;i++){ 
            obj_check = eval("forma." + campo + "[" + i + "].checked;");                    
            if (obj_check){                     
                if (oBorrar != ""){ 
                    oBorrar = oBorrar + ",";
                }
                oBorrar = oBorrar + eval("forma." + campo + "[" + i + "].value");   
            }
        }   
        forma.hid_chk.value = oBorrar;
        forma.action        = "borrar_varios.asp";
        forma.submit();
    }else{
        return;  
    }   
}
//FIN

//MARCA O LIMPIA LOS OBJETOS CHECK
//@forma = Nombre de la forma
//@campo = Nombre de los campos checkbox
//@campo_chk = Nombre del campo que marca y desmarca TODOS los check
//INICIO
function MarcarChecked(forma, campo, campo_chk)
{
    if (campo_chk.checked){ val=1; }else{ val=0;}
    total = eval("forma.elements.namedItem('" + campo + "').length;");
    for( i=0 ; i<total ; i++) {
        obj_check = eval("forma." + campo + "[" + i + "]");
        obj_check.checked = val;
    }
}
//FIN


//VALIDA Y LIMITA LOS CARACTERES DE UN TEXTAREA
//INICIO
function limCaracteres(tam, campo, nom_div)
{
    TamMensaje = campo.value.length;
     if (TamMensaje > tam ){
        campo.value = campo.value.substring(0, tam);
        oRestantes = 0;
     }else{
        oRestantes = tam - TamMensaje;
     }
     oDiv = eval("document.getElementById('restantes" + nom_div + "').innerHTML = oRestantes + ' caracteres disponibles'"); 
}
//FIN

function abrir_ventana(destino, tabla, id, id_campo, descripcion, campos, ancho, alto)
{
    var pagina;
    w = (screen.width/2)-(ancho/2);
    h = (screen.height/2)-(alto/2);
    pagina = destino + "?tabla=" + tabla + "&id=" + id + "&campo=" + id_campo + "&descripcion=" + descripcion + "&campos=" + campos;
    win = window.open(pagina,"ventana","width="+ancho+",height="+alto+",top="+h+",left="+w+", resizable=yes, scrollbars=yes, toolbar=no");
    win.opener = self;
}


//:::::::CAMBIA LAS COMILLAS SIMPLES POR COMILLAS DOBLES ::::::::
//.: INICIO :.
function limpiarInfo(strObj)
{	
	strInfo = strObj.value;
    strSinComillas = cambiarComillas(strInfo);      
    strObj.value = strSinComillas;
}

function cambiarComillas(strCont) 
{
    var strRet;
    var str;
	var comilla = /\'/g;
	var comillaAbierta = /\‘/g;
	var comillaCerrada = /\’/g;	

    str 	= '' + strCont;
    str 	= str.replace(comilla, "\"");
	str 	= str.replace(comillaAbierta, "\"");
	strRet = str.replace(comillaCerrada, "\"");
    return strRet;
}   
//.: FIN :.


//:::::::ARROJA UN POPUP PARA CREAR UN PERFIL ::::::::
//.: INICIO :.
function CrearPerfil() 
{
    var fr = document.frm;
    var o_nom = "";
    var o_msg = "";
    
    o_nom = prompt("Ingrese el \"Nombre\" del perfil:","");
    if (o_nom != null){
        if (o_nom.length < 1){
            o_msg = "El campo \"Perfil\" es obligatorio.";
        }   
        if(o_msg.length > 0){
            alert(o_msg);
        }else{
            fr.hid_campo.value = o_nom;
            fr.cmdAccion.value = "insertar";
            fr.submit();
        }
    }
}
//.: FIN :.

//:::::::ARROJA UN POPUP PARA EDITAR UN PERFIL ::::::::
//.: INICIO :.
function EditarPerfil(p_id, p_nombre) 
{
    var fr = document.frm;
    var o_nom = "";
    var o_msg = "";

    o_nom = prompt("Esta acción no se puede deshacer. ¿Desea editar el perfil \"" + p_nombre + "\" ?","");
    if (o_nom != null){
        if (o_nom.length < 1){
            o_msg = "El campo \"Perfil\" es obligatorio.";
        }   
        if (o_msg.length > 0){
            alert(o_msg);
        }else{
            fr.hid_campo.value = o_nom;
            fr.hid_id.value = p_id;
            fr.cmdAccion.value = "editar";
            fr.submit();
        }
    }
}
//.: FIN :.


//:::::::MUESTRA LAS PROPIEDADES DE LA IMAGEN ::::::::
//.: INICIO :.
function propiedades(o_num)
{	
	strMsg = "Propiedades de la Imágen\n\nAncho: " + document.images[o_num].width + " px";
	strMsg = strMsg + "\nAlto: " + document.images[o_num].height + " px";
	strMsg = strMsg + "\nPeso: " + document.images[o_num].fileSize + " bytes";	
	/*strMsg = strMsg + "\nFecha Creación: " + document.images[o_num].fileCreatedDate;	
	strMsg = strMsg + "\nFecha Modificación: " + document.images[o_num].fileModifiedDate;*/
	alert(strMsg);
}
//.: FIN :.

//:::::::INSERTA UNA FILA Y SUS COLUMNAS EN UNA TABLA ::::::::
//.: INICIO :.
function insertarFila()
{
	var oFila;
	var oCelda;	
	var oTotal = (document.forms[0].hid_total.value*1) + 1;
	oFila = tbl.insertRow();
	oFila.className = "interlineado1"
	oCelda1 = oFila.insertCell();
	oCelda2 = oFila.insertCell();
	oCelda3 = oFila.insertCell();
	oCelda4 = oFila.insertCell();
	oCelda5 = oFila.insertCell();
	oCelda1.innerHTML = oTotal + "."
	oCelda2.innerHTML = "&nbsp;Nombre"
	oCelda3.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['nombre" + oTotal + "'] = 'Nombre N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='nombre" + oTotal + "' value='' class='campos' size='30' maxlength='50'>"
	oCelda4.innerHTML = "&nbsp;Sobrenombre"
	oCelda5.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['sobrenombre" + oTotal + "'] = 'Sobrenombre N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='sobrenombre" + oTotal + "' value='' class='campos' size='30' maxlength='50'>"
	document.forms[0].hid_total.value = oTotal;
}
//.: FIN :.



//:::::::INSERTA UNA FILA Y SUS COLUMNAS EN UNA TABLA ::::::::
//.: INICIO :.
function insertarFilaGanador()
{
	var oFila;
	var oCelda;	
	var oTotal = (document.forms[0].hid_total.value*1) + 1;
	oFila = tbl.insertRow();
	oFila.className = "interlineado1"
	oCelda1 = oFila.insertCell();
	oCelda2 = oFila.insertCell();
	oCelda3 = oFila.insertCell();
	oCelda4 = oFila.insertCell();
	oCelda5 = oFila.insertCell();
	oCelda6 = oFila.insertCell();
	oCelda7 = oFila.insertCell();
	oCelda1.innerHTML = oTotal + "."
	oCelda2.innerHTML = "&nbsp;Nombre:"
	oCelda3.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['nombre" + oTotal + "'] = 'Nombre N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='nombre" + oTotal + "' value='' class='campos' size='30' maxlength='70'>"
	oCelda4.innerHTML = "&nbsp;Ciudad:"
	oCelda5.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['ciudad" + oTotal + "'] = 'Ciudad N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='ciudad" + oTotal + "' value='' class='campos' size='30' maxlength='70'>"

	oCelda6.innerHTML = "&nbsp;Premio:"
	oCelda7.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['premio" + oTotal + "'] = 'Premio N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='premio" + oTotal + "' value='' class='campos' size='30' maxlength='200'>"
	document.forms[0].hid_total.value = oTotal;
}
//.: FIN :.


//:::::::INSERTA UNA FILA Y SUS COLUMNAS EN UNA TABLA ::::::::
//.: INICIO :.
function insertarFilaConcurso()
{
	var oFila;
	var oCelda;	
	var oTotal = (document.forms[0].hid_total.value*1) + 1;
	oFila = tbl.insertRow();
	oFila.className = "interlineado1"
	oCelda1 = oFila.insertCell();
	oCelda2 = oFila.insertCell();
	oCelda3 = oFila.insertCell();
	oCelda4 = oFila.insertCell();
	oCelda5 = oFila.insertCell();
	oCelda6 = oFila.insertCell();
	oCelda7 = oFila.insertCell();
	oCelda1.innerHTML = oTotal + "."
	oCelda2.innerHTML = "&nbsp;Nombre:"
	oCelda3.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['nombre" + oTotal + "'] = 'Nombre N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='nombre" + oTotal + "' value='' class='campos' size='30' maxlength='70'>"
	oCelda4.innerHTML = "&nbsp;Identificación:"
	oCelda5.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['identificacion" + oTotal + "'] = 'Identificación N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='identificacion" + oTotal + "' value='' class='campos' size='30' maxlength='70'>"

	oCelda6.innerHTML = "&nbsp;Premio:"
	oCelda7.innerHTML = "&nbsp;&nbsp;<script language='JavaScript'>nombres_campos['premio" + oTotal + "'] = 'Premio N°" + oTotal + "';</script>" +
						"<input type='text' id='___CText__' name='premio" + oTotal + "' value='' class='campos' size='30' maxlength='200'>"
	document.forms[0].hid_total.value = oTotal;
}
//.: FIN :.

//:::::::BORRA LA FILA DE UNA TABLA ::::::::
//.: INICIO :.
function borrarFila()
{
	oFila = tbl.deleteRow();
}
//.: FIN :.


//::::::: FORMATEA UNA CIFRA  ::::::::
//.: INICIO :.
function FormatoMoneda(Valor, Signo)  {
	var Cifra = "";
	
	Cifra = "" + Valor;
	if (Cifra.indexOf (".", 0)!=-1) {
		Cifra = Cifra.substring(0, Cifra.indexOf (".", 0));
	}
	
	OutString="";
	len = Cifra.length;
	if ( (len >= 3) && !isNaN(Cifra) ) {
		TempString=Cifra.substring(len-2, len)
		OutString=","+TempString+OutString
		Cifra = Cifra.substring(0, len-2)
		
		len = Cifra.length;
		while (len>0) {
			TempString=Cifra.substring(len-3, len)				
			if (TempString.length==3) {
				OutString="."+TempString+OutString
				len=len-3;
			} else {
				OutString=TempString+OutString
				len=0
   			}
			
		}

		if (OutString.substring(0, 1)==".") 
			Cifra=OutString.substring (1, OutString.length)
		else
			Cifra=OutString
	} 
	if (Signo)
		return ("$"+Cifra);		
	else
		return (Cifra);
}
//.: FIN :.


//::::::: QUITA LOS ., $, '', DE UN NUMERO ::::::::
//.: INICIO :.
function quita_caracteres(campo)
{
	var ch, nvo_valor = '';
	for (i=0; i<(campo.length); i++){
		ch=(campo.substring(i,i+1));
		if (ch != ' ' && ch != '$' && ch != '.'){
		   nvo_valor +=ch;
		}
	}	
	return(nvo_valor);
}
//.: FIN :.



function imprimir(oArea)
{
	oPagina = window.parent.frames[oArea];
	oPagina.focus();
	oPagina.print();
}


//::::::: EFECTO DE DESVANECIMIENTO SOBRE UNA IMAGEN PIXELADO::::::::
//.: INICIO :.
function DesvanecimientoPixel(oDiv) { 
    oDiv.filters[0].Apply();
	if (oDiv.style.visibility == "visible"){ 		
		oDiv.filters.revealTrans.transition = 12; 
	}else{ 
		oDiv.filters[0].transition = 12; 
	} 
	oDiv.filters[0].Play(); 
} 
//.: FIN :.


//::::::: EFECTO DE DESVANECIMIENTO SOBRE UNA IMAGEN PIXELADO::::::::
//.: INICIO :.
function Desvanecimiento(oDiv) 
{
	oDiv.style.filter="blendTrans(duration=2)";
	if (oDiv.filters.blendTrans.status != 2){
		oDiv.filters.blendTrans.apply();		
		oDiv.filters.blendTrans.play();
	}
}
//.: FIN :.


//.: INICIO :.
function limpiarMsg()
{
	oPara.innerText = "";
}

//::::::: OCULTA UN OBJETO ::::::::
function ocultarTxt(){
	document.getElementById("varTxt").style.display = 'none';
}	

//::::::: EMBED DE UN FLASH COMO ARCHIVO ::::::::
function embedFlash(ubicacion, pelicula, ancho, alto){
	  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'" title="Canal Caracol">');
		document.write('<param name="movie" value="'+ubicacion+pelicula+'.swf" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed src="'+ubicacion+pelicula+'.swf" width="'+ancho+'" height="'+alto+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>');
	  document.write('</object>');
}

//::::::: EMBED DE UN FLASH DE BASE DE DATOS ::::::::
function embed(pelicula, ancho, alto){
	  document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + ancho + "' height='" + alto + "' title='Canal Caracol'>");
		document.write("<param name='movie' value='" + pelicula + "'/>");
		document.write("<param name='quality' value='high' />");
		document.write("<param name='wmode' value='transparent' />");
		document.write("<embed src='" + pelicula + "' width='" + ancho + "' height='" + alto + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed>");
	  document.write("</object>");
}

//-->