
function getDate() {
    // Get today's current date.
    var now = new Date();

    // Array list of days.
    var days = new Array('Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'Sabado');

    // Array list of months.
    var months = new Array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Sept', 'Octubre', 'Noviembre', 'Diciembre');

    // Calculate the number of the current day in the week.
    var date = ((now.getDate() < 10) ? "0" : "") + now.getDate();

    // Calculate four digit year.
    function fourdigits(number) {
        return (number < 1000) ? number + 1900 : number;
    }

    var hour = now.getHours();
    var minute = now.getMinutes();
    var ap = "a.m.";
    var zerohour = "";
    var zerominute = "";
    if (hour > 11) { ap = "p.m."; }
    if (hour > 12) { hour = hour - 12; }
    if (hour == 0) { hour = 12; }
    if (hour < 10) { zerohour = "0"; }
    if (minute < 10) { zerominute = "0"; }

    today = " <strong>" + days[now.getDay()] + "</strong> " + date + " de " + months[now.getMonth()] + " <strong>" + (fourdigits(now.getYear())) + "</strong> | " + zerohour + hour + ":" + zerominute + minute + " " + ap;
    // Print out the data.
    document.write(today);

    //  End -->
}

function flavideo(nomb_video, nomb_imagen) {
    flashvars.file = nomb_video;
    flashvars.image = nomb_imagen;
    swfobject.embedSWF("../swf/player_video.swf", "playervideo", "366", "285", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}
function changeHoroscopos(combo) {
    if (combo.options[combo.selectedIndex].value != 0)
        cargaDivURL('Horoscopos', '../template/cargaHoroscopo.aspx?id=' + combo.options[combo.selectedIndex].value);
}

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toGMTString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toGMTString();
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

function NewWindow(mypage, args, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable=' + scroll;

    mypage += escape(args);    
    win = window.open(mypage, myname, winprops);
    if (parseInt(navigator.appVersion) >= 4) {
        win.window.focus();
    }

}

// Radio Button Validation
function valButton(btn) {
    var cnt = -1;
    for (var i = btn.length - 1; i > -1; i--) {
        if (btn[i].checked) { cnt = i; i = -1; }
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}


function searchForm(form) {
    var btn = valButton(form.RadioGroup1);
    if (btn == null)
        alert('Seleccione una opción de búsqueda');
    else {
        if (btn == 'imagen') {
            form.action = '../template/content.aspx?se=buscador';
            form.submit();
        }
        else if (btn == 'google') {
            document.frmGoogle.q.value = form.keyword.value;
            document.frmGoogle.action = '../template/content.aspx';
            document.frmGoogle.submit();
        }
    }
}


function anchor(strAnchor) {
    strLiga = document.location.href.replace('#comentarios', '');
    strLiga = strLiga + strAnchor;
    document.location.href = strLiga;
}
function cargaDivURL(container, url, blnShadow) {
    $("#" + container).html('<div><img src="../images/icons/ajax-loader3.gif"/></div>');
    if (blnShadow == true)
        $("#" + container).load(encodeURI(url), function() { Shadowbox.init(); });
    else
        $("#" + container).load(encodeURI(url));
}
function cargaDatosVideo(container, id, blnShadow) {
    $("#" + container).html('<div><img src="../images/icons/loading.gif"/></div>');
    if (blnShadow == true)
        $("#" + container).load('../template/cargaDatosVideo.aspx?id=' + id, function() { Shadowbox.init(); });
    else
        $("#" + container).load('../template/cargaDatosVideo.aspx?id=' + id);
}


function makeSublist(parent, child, isSubselectOptional, childVal) {
    $("body").append("<select style='display:none' id='" + parent + child + "'></select>");
    $('#' + parent + child).html($("#" + child + " option"));

    var parentValue = $('#' + parent).attr('value');
    $('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());

    childVal = (typeof childVal == "undefined") ? "" : childVal;
    $("#" + child + ' option[@value="' + childVal + '"]').attr('selected', 'selected');

    $('#' + parent).change(
				function() {
				    var parentValue = $('#' + parent).attr('value');
				    $('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());
				    if (isSubselectOptional) $('#' + child).prepend("<option value='none'> -- Selecciona -- </option>");
				    $('#' + child).trigger("change");
				    $('#' + child).focus();
				}
			);
}