﻿var win;

function showCMS(sessionNr)
{
    if (win != null)
        win.close();
    
    win = window.open('cms/edit.aspx?nr=' + sessionNr, 'Cms_editor', 'width=900,height=500,scrollbars=yes,toolbar=yes,location=no,resizable=yes'); 

    /*
    var el = document.getElementById('cmsframe');
    if (el != null)
    {
        el.src = "cms/edit.aspx?nr=" + sessionNr;
        el.style.display = "block";
        center(el);
    }
    */
}

function center(object)
{
  object.style.marginLeft = "-" + parseInt(object.offsetWidth / 2) + "px";
  
  if (parseInt(object.offsetHeight / 2) < 300)
    object.style.marginTop = "-" + parseInt(object.offsetHeight / 2) + "px";
    
  object.focus();
}

function hideCMS()
{
    var el = document.getElementById('cmsframe');
    el.style.display = "none";
    
    
    //window.location.href = window.location.href;
}

function resizeCMS()
{
    try
    {	
        var oBody	=	cmsframe.document.body;
        var oFrame	=	document.all("cmsframe");
    		
        oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight + 20);
        oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
    }
        //An error is raised if the IFrame domain != its container's domain
    catch(e)
    {
        window.status =	'Error: ' + e.number + '; ' + e.description;
    }
}

function deleteCMSitem(sessionNr)
{
    if (confirm("Zeker weten?"))
    {
    }
}
