function showInfo(w) {
    var ow='';
    if (w=='dati') ow='credits';
    else ow='dati';
    if (!$('#'+w).is(':visible')) {
        $('#'+w).show();
        $.scrollTo($('a#a_'+w),500);
    } else {
        $('#'+w).hide();
    }
    if ($('#'+ow).is(':visible')) $('#'+ow).hide();
}

function getLocation() {
    var res=window.location.toString();
    if (res.length>0) {
        if (res.charAt(res.length-1)=='/' || res.indexOf('.html')<0)  res+='/index.html';
    }    
    return res;
}

function loadPage(href,un,pw) {
    $.ajax({
        type: "POST",
        url: 'page-'+href,
        data: {
            'un' 	: (typeof(un)!='undefined'?un:''),
            'pw' 	: (typeof(pw)!='undefined'?pw:'')
        },
        dataType: 'html',
        success: function (data, status) {
            $('div#content').html(data);
            if (typeof(bf_init)!='undefined') bf_init();
            return true;
        },
        error: function (data, status, e) {
            document.location.href=href;
            return true;
        }
    });
}

function canIUseAjax() {
    return ($.browser.msie?0:1);
}

function showInlineInfo(url) {
    $.ajax({
        url: url,
        dataType: 'text',
        success: function (data, status) {
            $.prompt('<div style="width:100%;overflow-x:hidden;overflow-y:auto;max-height:350px;text-align:left;">'+data+'</div>',{
                loaded: function() {
                    $('#jqi_state_state0').bind('keypress',
                        function (e) {
                            var code = (e.keyCode ? e.keyCode : e.which);
                            if (code == 13 || code == 27 || code == 111 || code == 79) {
                                $('#jqi_state0_button'+okButCaption).click();
                            }
                        });
                },
                buttons: {},
                overlayspeed: "fast"
            });
            return true;
        },
        error: function (data, status, e) {
            document.location.href=href;
            return true;
        }
    });
}
