
window.RICH_FACES_EXTENDED_SKINNING_ON = false;

// Konami code ---------------------------------------------------------------------------------------------------------
if (window.addEventListener) {
    var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
    window.addEventListener("keydown", function(e) {
        kkeys.push(e.keyCode);
        if (kkeys.toString().indexOf(konami) >= 0) {
            kkeys.clear();
            // User entered Konami Code
            alert('Hi #{elUtils.replaceApostrophe(loggedUser.displayName)}!');
        }
        if (kkeys.length > 10) {
            kkeys.clear();
        }
    }, true);
}

// Shadowbox -----------------------------------------------------------------------------------------------------------
Shadowbox.loadLanguage(language, contextPath + '/js/shadowbox/lang');
Shadowbox.loadPlayer(['img', 'flv', 'iframe', 'html', 'qt', 'swf', 'wmp'], contextPath + '/js/shadowbox/player');
Shadowbox.loadSkin('classic', contextPath + '/js/shadowbox/skin');

// Rilegge gli elementi della pagina
function SetupShadowBox() {
    Shadowbox.clearCache();
    Shadowbox.setup();
}

// Usato da flash
var openShadowbox = function(content, player, title) {
    Shadowbox.open({
        content:    content,
        player:     player,
        title:      title
    });
}

window.onload = function()
{
    setTimeout('SetupShadowBox()', 2000);
};

jQuery(document).ready(function() {
    //jQuery("#breadCrumb0").jBreadCrumb({easing:'swing'});
    Shadowbox.init();
});

function scrollToBottom(elementId) {
    var element = $(elementId);
    element.scrollTop = element.scrollHeight;
}

var allowPageReload=true;
var ajaxPageRefreshEnabled=true;
function reloadPage() {
    if (allowPageReload) {
        if (ajaxPageRefreshEnabled) {
            ajaxPageRefresh();
        } else {
            // Cannot use this because it ask for data resubmit if coming from a POST
            //location.reload();
            window.location = window.location.href;
        }
    }
}

function showHelpMP(title, text) {
    jQuery('#helpMPTitle').html(title);
    jQuery('#helpMPContent').html(text);
    Richfaces.showModalPanel('helpMP');
}

function hideHelpMP() {
    Richfaces.hideModalPanel('helpMP');
}