var Obj;
function newContent(obj, addr) {
    Obj = obj;
    var myAjax = new Ajax.Request(
        addr,
        { method: 'get', onComplete: showContent }
    );
}
function showContent(originalRequest) {
    var cnt, p1, p2, p3, n1, n2;
    
    cnt = originalRequest.responseText;
    p1  = cnt.indexOf('<div id="' + Obj + '"');
    if (p1 > -1) {
        p1 = cnt.indexOf('<div', p1 + 1);
        if (p1 > -1) {
            n1 = 1;
            n2 = 0;
            p2 = cnt.indexOf('<div', p1 + 1);
            p3 = cnt.indexOf('</div', p1 + 1);
            while (n1 > n2) {
                if (p2 > p3) {
                    n2 ++;
                    p3 = cnt.indexOf('</div', p3 + 1);
                } else {
                    n1 ++;
                    p2 = cnt.indexOf('<div', p2 + 1);
                }
            }
            cnt = cnt.substr(p1, p3 - p1 + 5);
            document.getElementById(Obj).innerHTML = cnt;
            initLightbox();
        }
    }
}
