NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;


var detect = navigator.userAgent.toLowerCase();
var browser;

if (checkIt('konqueror')) browser = "Konqueror";
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) 
{
    browser = "Opera";
    IE4 = 0;
}
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')) browser = "Netscape Navigator"
else browser = "An unknown browser";

function checkIt(string)
{
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
}





function close_me () {
    self.close();
}

function fill_form ( frm, fld, val ) {
    if (IE4) {
        opener.document.forms(frm)(fld).value = val;
        close_me();
    } else {
        opener.document.forms[frm][fld].value = val;
        close_me();
    }
    return false;
}


function popup_window ( url, form, field, width, height ) {
    if (IE4) {
        val = document.forms(form)(field).value;
    } else {
        val = document.forms[form][field].value;
    }
    if(val) {
       url = url + '?SUBS=' + val;
    }
    //window.open( url, 'WM_POPUP', 'toolbar=0,location=1,scrollbars=1,width='+width+',height='+height );
    window.open(url, "WM_POPUP", "toolbar=no,directories=no,menubar=no,width=" + width + ",height=" + height + ",scrollbars=no,titlebar=0,resizable=0");
    //alert( 'HODNOTA:' + val );
    return false;
}

function popup_window_no_subs ( url, form, field, width, height ) {
    if (IE4) {
        val = document.forms(form)(field).value;
    } else {
        val = document.forms[form][field].value;
    }
    window.open( url, 'WM_POPUP', 'toolbar=0,location=1,scroll=1,width='+width+',height='+height );
    //alert( 'HODNOTA:' + val );
    return false;
}
