var framedone=0;

function showframe(addr) {
  if (!framedone) {
    // Nutscrape 4.04 & Opera 6,7(!!) - don't work, but opens what requested in new window.
    // Opera 4.7 - don't work at all!!! (new window supposed)
//    replyformframe=document.getElemetById('replyformframe');
//    alert('puk!');
    obj=findElement('replyformframe');
    obj.innerHTML=obj.innerHTML+'<IFRAME frameBorder=0 height=300 marginHeight=0 marginWidth=0 scrolling=auto src="'+addr+'" width=100% name=mess>Ваш браузер не отображает фреймы. Чтобы добавить сообщение <a href="'+addr+'" target="_blank">откройте форму в новом окне</a></IFRAME>';
    framedone=1;
  }
}


var muvDOMtype = null;
var muvElementCache = new Array();

if (document.getElementById) {
    muvDOMtype = 'std';
} else if (document.all) {
    muvDOMtype = 'ie4';
} else if (document.layers) {
    muvDOMtype = 'ns4';
}

function findElement(elementName) {
    if (typeof(muvElementCache[elementName]) == 'undefined') {
        switch (muvDOMtype) {

            case 'std': {
                muvElementCache[elementName] = document.getElementById(elementName);
            }
            break;

            case 'ie4': {
                muvElementCache[elementName] = document.all[elementName];
            }
            break;

            case 'ns4': {
                muvElementCache[elementName] = document.layers[elementName];
            }
            break;

        }
    }

    return muvElementCache[elementName];
}


var wpopup = null;
function closewpop(){
//alert ("!!!");
        if (wpopup != null) {
                wpopup.close();
                wpopup = null;
        }
}

function showbigpic(iURL, iW, iH, iTitle){
        if (wpopup == null) {
                wpopup = open("", "wpopup", "width=" + iW + ",height=" + iH);
        }
        else
        {
                wpopup.close();
                wpopup = null;
                wpopup = open("", "wpopup", "width=" + iW + ",height=" + iH);
        }
        wpopup.document.write("<html><head>\n");
        wpopup.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">\n');
        wpopup.document.write("</head>\n");
        wpopup.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' onClick='self.close();'>\n");

        wpopup.document.write("<img src='" + iURL + "' border='0'  vspace='0'  name='zzz' hspace='0'  alt='"+iTitle+"'></body></html>");
//        wpopup.document.write (wpopup.document.images['zzz'].complete) ;
        while (wpopup.document.images['zzz'].complete != true) {};
        var deltax = wpopup.document.images['zzz'].width-wpopup.document.body.clientWidth;
        var deltay = wpopup.document.images['zzz'].height-wpopup.document.body.clientHeight;
        wpopup.resizeBy(deltax, deltay);

        wpopup.document.title = (iTitle == null) ? "" : iTitle;
        wpopup.focus();
        wpopup.document.close();
}
