function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
    var is_opera = (window.opera)?true:false;
    var is_opera7 = (window.opera)?true:false;
    var is_gecko = (agt.indexOf('gecko') != -1);

if(document.all && !document.getElementById)
    document.getElementById = function(id) { return document.all[id]; }

if(document.all && !document.getElementsByTagName)
    document.getElementsByTagName = function(tag) { return document.all.tags(tag); }
	

function sClear(obj,itxt) {
	if (obj.value == itxt) obj.value = '';
}
function sReturn(obj,itxt) {
	if (obj.value == '') obj.value = itxt;
}

var activeSubMenu = false;
var timeOut = 1000;

function subMenu(obj,show) {
	if (obj.nextSibling.tagName == 'UL') {
	activeSubMenu = t = obj.nextSibling;	

	if (show) {
		allul = document.getElementsByTagName('ul');
		for (a = 0; a < allul.length; ++a) if (allul[a].className == 'submenu') allul[a].style.display = 'none';
		t.style.display = 'block';
		//alert (obj.parentNode.parentNode.scrollLeft);
		t.style.left = (obj.scrollLeft<230)?obj.scrollLeft+ 'px':'190px';
	}
	else {
		activeSubMenu = false;
	 	setTimeout ("hideSubmenu(document.getElementById('"+t.id+"'))",timeOut);
	}
	}
}
function hideSubmenu(t) {
	if (!activeSubMenu || activeSubMenu != t) t.style.display = 'none';
}

function overMenu(t) {
	activeSubMenu = t;
}

function outMenu(t) {
	activeSubMenu = false;
 	setTimeout ("hideSubmenu(document.getElementById('"+t.id+"'))",timeOut);
}

function flash(name,src,x,y,ver,opcja,opcja2) {
	

	if (is_ie) { b = 'ie' }
	
	else if (is_gecko) { b = 'gecko' }
	else if (is_opera) { b = 'opera' }

	if (opcja == 'w3c' || (opcja == 'jsOpti' && b != 'ie')) {
		document.write ('<object id="'+name+'" type="application/x-shockwave-flash" data="'+src+'" width="'+x+'" height="'+y+'" ');
		if (opcja2 == 'opaque') document.write ('wmode="opaque" ');
		document.write (' >');
		document.write ('<param name="movie" value="'+src+'" >');
		document.write ('<param name="swliveconnect" value="true">');
		if (opcja2 == 'opaque') document.write ('<param name="wmode" value="opaque">');
		document.write ('</object>');
	}
	else if (opcja == 'fsc' || (opcja == 'jsOpti' && b == 'ie') || (opcja == 'transparent' && b == 'ie')) {

		document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0"');
		document.write ('width='+x+' height='+y+' id="'+name+'">');
		document.write ('<param name=movie value="'+src+'">');
		document.write ('<param name=quality value=high>');

		if (opcja == 'opaque' || opcja2 == 'opaque') document.write ('<param name="wmode" value="opaque">');
		if (opcja == 'transparent') document.write ('<param name="wmode" value="transparent">');

		document.write ('<param name="swliveconnect" value="true">');
		document.write ('<embed src="'+src+'" quality="high" width="'+x+'" height="'+y+'"');
		document.write (' type="application/x-shockwave-flash"');
		if (opcja == 'opaque' || opcja2 == 'opaque') document.write (' wmode="opaque" ');
		document.write (' pluginspage="http://www.macromedia.com/downloads/"');
		document.write (' name="'+name+'" swliveconnect="true">');
		document.write ('</embed>');
		document.write ('</object>');
	}
}
var cg = 0;

function rotateGal() {
	
	document.getElementById('g'+cg).style.visibility = 'hidden';
	++cg;
	if( !document.getElementById('g'+cg) ) cg = 0;
	document.getElementById('g'+cg).style.visibility = 'visible';
	
	setTimeout("rotateGal()",2000);
}


function oW (path,Xsiz,Ysiz,popUnder) {
	var przed = '';
	if (!(Xsiz > 0)) { Xsiz = 450; }
	if (!(Ysiz > 0)) { Ysiz = 300; }
	w = window.open(przed+path, 'fotozoom', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,fullscreen=no,channelmode=no,width='+Xsiz+',height='+Ysiz+',top=30,left=30');
	if (popUnder) {
		w.blur();
		window.focus();
	}
	else {
		w.focus();
	}
	void(0);
}


function openWindow(path,name,scrollbars,x,y) {
	w = window.open(path, name, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable=yes,fullscreen=no,channelmode=no,width='+x+',height='+y+',top=30,left=30');
	w.focus();
	void(0);

}

function getValue(varname)
{

  var url = window.location.href;
  var qparts = url.split("?");
  if (qparts.length == 0)
  {
    return "";
  }
  var query = qparts[1];
  var vars = query.split("&");
  var value = "";

  for (i=0;i<vars.length;i++)
  {
    var parts = vars[i].split("=");
    if (parts[0] == varname)
    {
      value = parts[1];
      break;
    }
  }
  
  value = unescape(value);
  value.replace(/\+/g," ");

  return value;
}

function pobierz(nazwa) {
    if (document.cookie.length > 0) {
        startc = document.cookie.indexOf(nazwa + "=");
        if (startc != -1) {
            startc += nazwa.length + 1;
            endc = document.cookie.indexOf(";", startc);
            if (endc == -1) {
                endc = document.cookie.length;
            }
            return unescape(document.cookie.substring(startc,endc));
        }
	return false;
    }
    return false;
}

function rejestruj(nazwa, wartosc,dni) {
    var dzisiaj=new Date();
    var wygasnie=new Date();
    !dni ?dni=7 :"";
    // dni - data po której ciastko traci ważność (domyślnie tydzień)
    // jeśli dni==0 to ważne w ciągu danej "sesji"
    wygasnie.setTime(dzisiaj.getTime()+1000*60*60*24*dni);
	document.cookie=nazwa+"="+escape(wartosc)+";expires="+wygasnie.toGMTString();
}



function init() {
	if (komunikat) alert(komunikat);
}


function showFields(opt) {
	argv = showFields.arguments;
	a = 1;
	while (argv[a]) {
		if (document.getElementById('dbformF'+argv[a])) {
			tr = document.getElementById('dbformF'+argv[a]).parentNode;
			while (tr.tagName.toUpperCase() != 'TR') tr = tr.parentNode;
//			tr.style.display = (opt)?'':'none';
//			alert(tr.className);
			tr.className = (opt)?'formRow':'hidden';
		
		}
		++a;
	}
	footReset();	
}
