
// -----------------------------------------------------
// --- Custom Function
// -----------------------------------------------------

function loadPage(page)
{
        document.location.href = page;
        return;
}


function goToAnchor(anchor)
{
    document.location.href =
        'http://' + location.hostname + ':' + location.port + '/' +
        location.pathname.replace(/^\//,'') +
        '#' + anchor;
}




var newWindow = null;

/**
 * Chiamata proxy per la finestra popup
 */
function openVideoWindow(name)
{
    popUpWin(
    'http://' + location.hostname + ':' + location.port + '/' +
    'playvideo.php?videoid=' + name, 'console', 600, 450);
}




function closeWin()
{
    if (newWindow != null){
        if(!newWindow.closed)
        newWindow.close();
    }
}


function popUpWin(url, type, strWidth, strHeight){

    // === Controllo se già aperta
    closeWin();

    // --- Se fullScreen imposto le dimensioni
    if (type == "fullScreen"){
        strWidth = screen.availWidth - 10;
        strHeight = screen.availHeight - 160;
    }

    var tools="";
    if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
    if (type == "console") tools = "resizable=false,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";

    // --- Apro la finestra e imposto il focus
    newWindow = window.open(url, 'newWin', tools);
    newWindow.focus();
}