function pop(obj, width, height) {
    if (!width) width = 640;
    if (!height) height = 480;
    pop_win = window.open(obj.href, 'pop_win', 'width='+width+',height='+height+',resizable,scrollbars');
    pop_win.focus();
    return false;
}

function zoom(src, title) {
    if (!title) title = src.href;
    var img = new Image();
    img.src = src.href;
    zoom_view(img, title);
    return false;
}

function zoom_view(img, title) {
    zoom_win = window.open(img.src, 'zoom_win', 'width=600,height=600,scrollbars,resizable');
    zoom_resize(img);
    zoom_win.document.write('<html><head><title>'+title+'</title><meta http-equiv="content-type" content="text/html; charset=windows-1251" /></head>');
    zoom_win.document.write('<body style="margin: 0; padding: 0; background: #000;"><table cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center">');
    zoom_win.document.write('<img src="'+img.src+'" alt="" title="Закрыть окно" onclick="window.close()" style="cursor: pointer;">');
    zoom_win.document.write('</td></tr></table></body></html>');
    zoom_win.document.close();
    zoom_win.focus();
}

function zoom_resize(img) {
    if (img.width==0 || img.height==0) {
        setTimeout(function() {zoom_resize(img)}, 100);
    } else {
        if (img.width > screen.availWidth-70 || img.width==0) {
            win_width = screen.availWidth-70;
        } else {
            win_width = img.width+70;
        }
        if (img.height > screen.availHeight-100 || img.height==0) {
            win_height = screen.availHeight-100;
        } else {
            win_height = img.height+100;
        }
        zoom_win.resizeTo(win_width, win_height);
    }
}

function bucket() {
    document.getElementById('bucket').style.display = 'none';
    document.getElementById('under').style.display = 'block'; 
    if(navigator.userAgent.indexOf('MSIE') > -1) {
        document.getElementById('bgsound').src = '/bucket.mp3';
    } else {
        document.getElementById('sound').innerHTML = '<embed src="/bucket.mp3" autostart="true" hidden="true" />';
    }
}

