﻿// AdminMenuArea
//Admin
function goOrganize(id) {
    var xx = window.open(id, "Organize", "top=50,left=50,height=600,width=800,menubar=no,scrollbars=no,toolbar=no,status=no,location=no");
    xx.focus();
}


function showAdminMenu(eventElement) {
    ctl00_popMenu1.showContextMenu(eventElement)
}


var newsLetterEditor = null;

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
///
///                       Module Editing
///
var currentModule = null;
var currentModuleStatus = null;
var currentModuleType = null;
function editclick(eventElement, id, status, type) {
    currentModule = id;
    currentModuleStatus = status;
    if (type == undefined)
        currentModuleType = "HTML";
    else
        currentModuleType = type;
        
    var optionsMenu = ctl00_moduleMenu.findItemById("moduleAdmin");
    if (currentModuleStatus == 0) {
        optionsMenu.set_text("<img src='/Common/UI/popMenu/Images/pubblicato.png' align='absmiddle' alt='Pubblicato'> Opzioni del modulo");
    }
    else {
        optionsMenu.set_text("<img src='/Common/UI/popMenu/Images/provvisorio.png' align='absmiddle' alt='Provvisorio'> Opzioni del modulo");
    }
    ctl00_moduleMenu.showContextMenu(eventElement);
    return false;
}
function moduleMenu_itemclick(sender, eventArgs) {
    var menuItem = eventArgs.get_item();
    switch (menuItem.get_id()) {
        case "moduleEdit":
            goEdit(currentModule);
            break;
        case "moduleAdmin":
            moduleOptions(currentModule);
            break;
        case "close":
            currentModule = null;
            break;
    }
}
function goEdit(id, mType) {
    if (mType != undefined)
        currentModuleType = mType;
    switch (currentModuleType) {
        case "HTML":
            var sUrl = "/Editor/advancedEditorMain.aspx?pid=" + xpAlias + "&mid=" + id;
            break;
        case "NEWS":
            var sUrl = "/Editor/newsEditor.aspx?pid=" + xpAlias + "&mid=" + id;
            break;

    }
    var xx = window.open(sUrl, "Editing", "top=50,left=50,height=700,width=1000,resizable=yes,menubar=no,scrollbars=no,toolbar=no,status=no,location=no");
    xx.focus();
}
function moduleOptions(id) {
    goOrganize("/Administration/_siteAdmin.aspx?S=T&pid=" + xpAlias + "&tabid=" + tabId + "&mid=" + id);
}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
///
///                       Toggle Full Screen
///
function toggleFullScreen() {
    var top = $get("ctl00_headerRow");
    var footer = $get("ctl00_footerRow");

    if (top != undefined) {
        if (top.style.display == "none") {
            top.style.display = "";
        }
        else {
            top.style.display = "none";
        }
    }

    if (footer != undefined) {
        if (footer.style.display == "none") {
            footer.style.display = "";
            try {
                sanityCheck();
            }
            catch (e) { }
        }
        else {
            footer.style.display = "none";
            try {
                $get("mainContainer").style.height = getWindowHeight() + "px";
                $get("ctl00_contentPane").style.height = getWindowHeight() + "px";
            }
            catch (e) { }
        }
    }
}


function grid_item_hover(ctl) {
    Sys.UI.DomElement.addCssClass(ctl, "gridItemHover");
}
function grid_item_out(ctl) {
    Sys.UI.DomElement.removeCssClass(ctl, "gridItemHover");
}


/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
///
///                       Newsletter
///
function goEditNewsletter(id) {
    newsLetterEditor = window.open(id, "newsLetterEditor", "top=20,left=20,height=730,width=1020,resizable=yes,menubar=no,scrollbars=no,toolbar=no,status=no,location=no");
    window.setTimeout("newsLetterEditor.focus();", 200);
}



