//This code is optimized by the w3compiler from Port80 Software:  BUY w3compiler to remove this comment from your optimized files at www.w3compiler.com!
function borrar(lista){for(var i=lista.length-1;i>=0;i--){if(navigator.appName=="Netscape"){lista.options[i]=null;}else{lista.remove(i);}}}function inicializar_lista(lista_destino,arreglo,idCampo,text){var j;borrar(lista_destino);lista_destino.options[0]=new Option(text,'');for(var x=0;x<arreglo.length;x++){j=x+1;lista_destino.options[j]=new Option(arreglo[x][1],arreglo[x][0]);if(arreglo[x][0]==idCampo){lista_destino.options[j].selected=true;}}}function inicializarListaReferencia(lista_destino,arreglo,idCampoReferencia,idCampo,text){var j;borrar(lista_destino);lista_destino.options[0]=new Option(text,'');if(idCampoReferencia!=0){var tamArreglo=0;if(!(arreglo[idCampoReferencia]==undefined)){tamArreglo=arreglo[idCampoReferencia].length;}for(var x=0;x<tamArreglo;x++){j=x+1;lista_destino.options[j]=new Option(arreglo[idCampoReferencia][x][1],arreglo[idCampoReferencia][x][0]);if(arreglo[idCampoReferencia][x][0]==idCampo){lista_destino.options[j].selected=true;}}}}function seleccionarCheckBox(checkBoxObject,checkBoxObjectArray){maxArray=checkBoxObjectArray.length;for(i=0;i<maxArray;i++){if(checkBoxObject.checked==false){checkBoxObjectArray[i].checked=false;}else{checkBoxObjectArray[i].checked=true;}}}function seleccionarCampoLista(lista_destino,textCampo){maxArray=lista_destino.options.length;for(i=0;i<maxArray;i++){if(lista_destino.options[i].text==textCampo){lista_destino.options[i].selected=true;break;}}}function seleccionarCategoria(url,categoria){window.location=url+categoria;}function moveItems(fromForm,fromItem,toForm,toItem,advice){var fItem=fromItem+"[]";var tItem=toItem+"[]";if((document.forms[fromForm]!=undefined)&&(document.forms[fromForm].elements[fItem]!=undefined)&&(document.forms[toForm]!=undefined)&&(document.forms[toForm].elements[tItem]!=undefined)&&(document.forms[fromForm].elements[fItem].options.selectedIndex>=0)){while(document.forms[fromForm].elements[fItem].options.selectedIndex>=0){ind=document.forms[fromForm].elements[fItem].options.selectedIndex;text=document.forms[fromForm].elements[fItem].options[ind].text;value=document.forms[fromForm].elements[fItem].options[ind].value;document.forms[fromForm].elements[fItem].options[ind]=null;var newOption=new Option(text,value);toFormLength=document.forms[toForm].elements[tItem].options.length;document.forms[toForm].elements[tItem].options[toFormLength]=newOption;}}else{if((advice!=undefined)&&(advice!="")){alert(advice);}}return(false);}function selectAll(form_name){for(var i=1;i<arguments.length;i++){if((document.forms[form_name]!=undefined)&&(document.forms[form_name].elements[arguments[i]]!=undefined)&&(document.forms[form_name].elements[arguments[i]].options!=undefined)){for(var j=0;j<document.forms[form_name].elements[arguments[i]].options.length;j++){document.forms[form_name].elements[arguments[i]].options[j].selected=true;}}}return true;}

function regresar(url_pagina) {
    window.location = url_pagina;
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );
    
    /*
    if the expires variable is set, make the correct 
    expires time, the current script below will set 
    it for x number of days, to make it for hours, 
    delete * 24, for minutes, delete * 60 * 24
    */
    if ( expires )    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    
    var expires_date = new Date( today.getTime() + (expires) );
    
    document.cookie = name + "=" + escape( value ) +
                      ((expires) ? ";expires=" + expires_date.toGMTString() : "" ) + 
                      ((path) ? ";path=" + path : "" ) + 
                      ((domain) ? ";domain=" + domain : "" ) +
                      ((secure) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ((!start) && (name != document.cookie.substring(0, name.length))) {
        return null;
    }
    if ( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
    if ( Get_Cookie( name ) ) 
        document.cookie = name + "=" +
        ((path) ? ";path=" + path : "") +
        ((domain) ? ";domain=" + domain : "" ) +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function validarTarjetaNueva (fechaActualTarjeta, tiempoEstadoTarjeta, urlImagen, imagenName) {
    arrayFecha = fechaActualTarjeta.split("-");
    fecha1 = new Date(arrayFecha[0],arrayFecha[1],arrayFecha[2]);
    Today = new Date(); 
    diaHoy = Today.getDate();
    mesHoy = Today.getMonth();
    yearHoy = Today.getFullYear();
    fecha2 = new Date(yearHoy,mesHoy,diaHoy - tiempoEstadoTarjeta);
    fechaActualTarjeta
    if (fecha2 < fecha1) {
        document.getElementById(imagenName).src = urlImagen;
    }
}
