var incr = 0;
function showpicture(id, bw, bh, pos, mwidth, mheight, oblozka) {



                bwidth = bw;
                picturediv = document.getElementById("bigpic");
                var book_href = document.getElementById("href" + id).href;
                pleft = pos.x;
                ptop = pos.y;

                if (navigator.userAgent.indexOf("MSIE 7.0")!=-1) { pleft -= 11;        }

                else str_buy_batton="";

                picturediv.style.left = pleft + 'px';
                picturediv.style.top  = ptop + 'px';

                picturediv.innerHTML = "<div onmouseout='hidepicture()' onmousemove='show=1'><a href='" + book_href + "'><img id='"+id+"' src='http://www.centrmag.ru/"+oblozka+"'></a></div><div id='noshow' onmouseout='hidepicture()' onmousemove='show=1'></div>";

                bpic = new Image();
                bpic.onload = function () {
                        document.getElementById("loading-pic").innerHTML = "";
                        pic.src = bpic.src;
                }



                bpic.src = "http://www.centrmag.ru/"+oblozka+"";
                pic = document.getElementById(id);
                pic.width = mwidth;
                picturediv.style.display = "block";
                increase();



}



function hidepicture() {
        show = 0;
        setTimeout('starthide()', 10);
}

function starthide() {
        if (show == 0) {
                document.getElementById("noshow").style.display = "none";
                pic.width = pic.width - 10;
                pleft = pleft + 5;
                ptop = ptop + 5;
                picturediv.style.left = pleft + 'px';
                picturediv.style.top = ptop + 'px';
                if (pic.width > 100) setTimeout('starthide()', 0); else picturediv.style.display = "none";
        }
}

function increase() {
        if ((pic.width + incr)>bwidth) incr = (bwidth-pic.width); else incr = 10;
        pic.width = pic.width + incr;

        pleft = pleft - Math.round(incr/2);
        ptop = ptop - Math.round(incr/2);
        picturediv.style.left = pleft + 'px';
        picturediv.style.top = ptop + 'px';

        if (pic.width < bwidth) {
                setTimeout('increase()', 0);
        }
        else {
                if (bpic.complete) pic.src = bpic.src;
                document.getElementById("noshow").style.display = "block";
               
        }

        if (pic.width > 100) document.getElementById("loading-pic").style.display = "block";
}


function absPosition(obj) {
        var x = y = 0;
        while(obj) {
                x += obj.offsetLeft;
                y += obj.offsetTop;
                obj = obj.offsetParent;
        }
        return {x:x, y:y};
}
