nn4 = (document.layers)? true : false;
ie4 = (document.all)? true : false;
dom = (document.createTextNode)? true : false;

function popup(fileUrl, winW, winH, winN) {
        var status = 'yes';
        var menubar = 'no';
        var scrollbars = 'yes';
        var winWidth = (winW)? winW : 700;
        var winHeight = (winH)? winH : 650;
        var winName = (winN)? winN : 'popupWin';
        if (nn4||ie4||dom) {
                if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
                if (screen.height < winHeight + 180) { winHeight = screen.height - 180; scrollbars = 'yes' }
                posX = Math.round((screen.width - winWidth) / 2);
                posY = Math.round((screen.height - winHeight) / 2.5);
                posCode = ",screenX="+posX+",screenY="+posY+",left="+posX+",top="+posY;
        } else {
                posCode = "";
        }
        var popupWin = window.open(fileUrl, winName,"menubar="+menubar+",toolbar=no,resizable=yes,scrollbars="+scrollbars+",status="+status+",width="+winWidth+",height="+winHeight+posCode);
        if (popupWin) popupWin.focus();
        return false;
}

function popimage(fileUrl) {
        var scrollbars = 'no';
        var winWidth = 600;
        var winHeight = 450;
        var winName = 'imageWin';
        if (nn4||ie4||dom) {
                if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
                if (screen.height < winHeight + 180) { winHeight = screen.height - 180; scrollbars = 'yes' }
                posX = Math.round((screen.width - winWidth) / 2);
                posY = Math.round((screen.height - winHeight) / 2.5);
                posCode = ",screenX="+posX+",screenY="+posY+",left="+posX+",top="+posY;
        } else {
                posCode = "";
        }
        var imageWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,resizable=no,scrollbars="+scrollbars+",status=no,width="+winWidth+",height="+winHeight+posCode);
        if (imageWin) imageWin.focus();
        return false;
}

function correct_email(e) {
         ret = false;
         if (window.RegExp) {
             r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
             r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
             ret = (!r1.test(s)&&r2.test(s));
         }
         return (ret);
}
