//Anzeigen des Inhaltes
function OnContentSuccess (content) 
{
    showLayer('commentBox');
    // --------------- content ---------------
    writeToElement('commandBoxContent', content);
}

function OnTitleSuccess(title)
{
    // --------------- title --------------- 
    writeToElement('commandBoxTitle', title);
}

// Verstecken des Kommentar-Feldes
function HideComment () 
{
    hideLayer('commentBox');
}

function showLayer (id) 
{
      document.getElementById(id).style.visibility = "visible";
}

function hideLayer (id) 
{
      document.getElementById(id).style.visibility = "hidden";
}

function writeToElement(id, content) 
{
      if (document.getElementById) {
            document.getElementById(id).innerHTML = content;
      }else if (document.layers) {
            document.layers[id].document.write(content);
      }else if (document.all) {
            document.all[id].innerHTML = content;
      }
}

function ShowComment(e, guid)
{
    DeDeNet.DeDeContent.TestWeb.Services.DeDeContentService.GetCommentTitle(guid, OnTitleSuccess);
    DeDeNet.DeDeContent.TestWeb.Services.DeDeContentService.GetCommentContent(guid, OnContentSuccess);
    
    // --------------- e ---------------
    var topPixel = e.clientY + 10; 
    var leftPixel = e.clientX + 10;
    document.getElementById('commentBox').style.top = topPixel + 'px';
    document.getElementById('commentBox').style.left = leftPixel + 'px';
}

function setLayerPosition(id, type, pos) {
        if (document.all) {
               layer = document.all[id].style;
        }else if (document.layers) {
               layer = document.layers[id];
        }else{
               layer = document.getElementById(id).style;
        }

        switch(type) {
        case 'x':
               layer.left = pos + 'px';
               break;
        case 'y':
               layer.top = pos + 'px';
               break;
        case 'w':
               layer.width = pos + 'px';
               break;
        case 'h':
               layer.height = pos + 'px';
               break;
        }
}

function getLayerPosition(id, pos) {
        var x;
        var y;
        var w;
        var h;

        if (document.all) {
               x = document.all[id].offsetLeft;
               y = document.all[id].offsetTop;
               w = document.all[id].scrollWidth;
               h = document.all[id].scrollHeight;
        }else if (document.layers) {
               x = document[id].left;
               y = document[id].top;
               w = document[id].clip.width;
               h = document[id].clip.height;
        }else{
               x = document.getElementById(id).style.left;
               y = document.getElementById(id).style.top;
               w = document.getElementById(id).offsetWidth;
               h = document.getElementById(id).offsetHeight;
        }

        switch (pos)
        {
               case "w":
                       return (w);
                       break;
               case "h":
                       return (h);
                       break;
               case "x":
                       return x;
                       break;
               case "y":
                       return y;
                       break;
        }
}


