﻿function ShowSectionMask(el)
{
    var classAttr = document.createAttribute("class");
    classAttr.value = "section-mask";
    el.attributes.setNamedItem(classAttr);
}

function HideSectionMask(el)
{
    var classAttr = document.createAttribute("class");
    classAttr.value = "";
    el.attributes.setNamedItem(classAttr);
}

function AddSection(webPageID)
{
    var url = "Add/PageSection/" + webPageID + ".aspx";

    var width = 800;
    var height = 600;
    var resizable = false;

    var left = (screen.availWidth - width) / 2;
    var top = (screen.availHeight - height) / 2;
    var features = "left=" + left + ",top=" + top + ",width=" + width + "px,height=" + height + "px,center=yes,help=no,status=no,resizable=" + (resizable ? "yes" : "no");

    window.open(url, "", features);
}

function EditSection(webPageID, webPageSectionID)
{
    var url = "Edit/PageSection/" + webPageID + "/" + webPageSectionID + ".aspx";

    var width = 800;
    var height = 600;
    var resizable = false;

    var left = (screen.availWidth - width) / 2;
    var top = (screen.availHeight - height) / 2;
    var features = "left=" + left + ",top=" + top + ",width=" + width + "px,height=" + height + "px,center=yes,help=no,status=no,resizable=" + (resizable ? "yes" : "no");

    window.open(url, "", features);
}