var ca_ext_in_page_comments_x0=0,ca_ext_in_page_comments_y0=0,ca_ext_in_page_comments_x1=0,ca_ext_in_page_comments_y1=0; 
var ca_ext_in_page_comments_offx=6,ca_ext_in_page_comments_offy=6; 
var ca_ext_in_page_comments_moveable=false; 
var ca_ext_in_page_comments_hover='orange',ca_ext_in_page_comments_normal='slategray';//color; 
var ca_ext_in_page_comments_index=10000;

function ca_ext_in_page_comments_startDrag(obj) 
{
    if(event.button==1) 
    {
        obj.setCapture(); 

        var win = obj.parentNode; 
        var sha = win.nextSibling; 

        ca_ext_in_page_comments_x0 = event.clientX; 
        ca_ext_in_page_comments_y0 = event.clientY; 
        ca_ext_in_page_comments_x1 = parseInt(win.style.left); 
        ca_ext_in_page_comments_y1 = parseInt(win.style.top); 

        ca_ext_in_page_comments_normal = obj.style.backgroundColor; 

        obj.style.backgroundColor = ca_ext_in_page_comments_hover; 
        win.style.borderColor = ca_ext_in_page_comments_hover; 
        obj.nextSibling.style.color = ca_ext_in_page_comments_hover; 
        sha.style.left = ca_ext_in_page_comments_x1 + ca_ext_in_page_comments_offx; 
        sha.style.top = ca_ext_in_page_comments_y1 + ca_ext_in_page_comments_offy; 
        ca_ext_in_page_comments_moveable = true; 
    } 
} 
function ca_ext_in_page_comments_drag(obj) 
{ 
    if(ca_ext_in_page_comments_moveable) 
    { 
        var win = obj.parentNode; 
        var sha = win.nextSibling; 
        win.style.left = ca_ext_in_page_comments_x1 + event.clientX - ca_ext_in_page_comments_x0; 
        win.style.top = ca_ext_in_page_comments_y1 + event.clientY - ca_ext_in_page_comments_y0; 
        sha.style.left = parseInt(win.style.left) + ca_ext_in_page_comments_offx; 
        sha.style.top = parseInt(win.style.top) + ca_ext_in_page_comments_offy; 
    } 
} 

function ca_ext_in_page_comments_stopDrag(obj) 
{ 
    if(ca_ext_in_page_comments_moveable) 
    { 
        var win = obj.parentNode; 
        var sha = win.nextSibling; 
        var msg = obj.nextSibling; 
        win.style.borderColor = ca_ext_in_page_comments_normal; 
        obj.style.backgroundColor = ca_ext_in_page_comments_normal; 
        msg.style.color = ca_ext_in_page_comments_normal; 
        sha.style.left = obj.parentNode.style.left; 
        sha.style.top = obj.parentNode.style.top; 
        obj.releaseCapture(); 
        ca_ext_in_page_comments_moveable = false; 
        ca_ext_in_page_comments_changed();
    } 
} 

function ca_ext_in_page_comments_getFocus(obj) 
{ 
    if(obj.style.zIndex!=ca_ext_in_page_comments_index) 
    { 
        ca_ext_in_page_comments_index = ca_ext_in_page_comments_index + 2; 
        var idx = ca_ext_in_page_comments_index; 
        obj.style.zIndex=idx; 
        obj.nextSibling.style.zIndex=idx-1; 
    } 
} 

function ca_ext_in_page_comments_min(obj) 
{ 
    var win = obj.parentNode.parentNode; 
    var sha = win.nextSibling; 
    var tit = obj.parentNode; 
    var msg = tit.nextSibling; 
    var flg = msg.style.display=="none"; 

    if (flg) 
    { 
        win.style.height = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2; 
        sha.style.height = win.style.height; 
        msg.style.display = "block"; 
        obj.innerHTML = "0"; 
    } 
    else 
    { 
        win.style.height = parseInt(tit.style.height) + 2*2; 
        sha.style.height = win.style.height; 
        obj.innerHTML = "2"; 
        msg.style.display = "none"; 
    }
} 

function ca_ext_in_page_comments_cls(obj)
{ 
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling; 
    //win.style.visibility = "hidden"; 
    //sha.style.visibility = "hidden";
    //
    var parent = win.parentNode;
    parent.removeChild(sha);
    parent.removeChild(win);
    //    
    ca_ext_in_page_comments_changed();
}

function ca_ext_in_page_comments_changed()
{
    document.body.setAttribute("ca_ext_modified_flag", "1");
}