<!--
//-------------------------- globalne -----------------------------
function addBookmark(url, title)
{
	if (window.sidebar)
		window.sidebar.addPanel(title, url,"");
	else if( document.all)
		window.external.AddFavorite(url,title);

	return false;
}

function ffcopy(text)
{
	try
	{
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return false;

		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) return false;

		trans.addDataFlavor('text/unicode');

		var str = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);

		var copytext=text;
		str.data=copytext;

		trans.setTransferData("text/unicode",str,copytext.length*2);

		var clipid=Components.interfaces.nsIClipboard;
		if (!clip) return false;
		clip.setData(trans,null,clipid.kGlobalClipboard);

		return true;
	}
	catch (exception)
	{
		return false;
	}
	return true;
}

function _htmlentities(text, amp, quot, apostrophe, less_than, greater_than)
{
	if (!text.length) return text;
	if (amp) text=text.replace(/&/g,'&amp;');
	if (quot) text=text.replace(new RegExp('"','g'),'&quot;');
	if (apostrophe) text=text.replace(/\'/g,'&#39;');
	if (less_than) text=text.replace(/</g,'&lt;');
	if (greater_than) text=text.replace(/>/g,'&gt;');
	return text;
}

function _addshlashes(text)
{
	text=text.replace(/&#39;/g,'\&#39;');
	return text;
}

function Object2Text(option)
{
	var text=null;
	var out=Array();
	var i=0;

	for (field in option)
	{
		if(typeof(option[field])=="number")
			out[i]="&#39;"+field+"&#39;:"+option[field];
		else
		{
			if (option[field].length) text=_htmlentities(option[field], 1, 0, 0, 0, 0);
			out[i]="&#39;"+field+"&#39;:&#39;"+text+"&#39;";
		}
		i++;
	}

	out.join(', ');
	out='{'+out+'}';
	return out;
}

function check(fields, regs, mess)
{
	for (i=0; i<fields.length; i++)
		if (!fields[i].value.match(regs[i]))
		{
			Message(mess[i]);
			fields[i].focus();
			return false;
		}
	return true;
}

var mouse=0
function mouseDown(e) 
{
	var ctrl=0;
	var alt=0;
	var shift=0;
 
	if (parseInt(navigator.appVersion)>3) 
	{
		if (navigator.appName=="Netscape") 
		{
			shift=(e.shiftKey)?4:0;
			alt=(e.altKey)?2:0;
			ctrl=(e.ctrlKey)?1:0;
		}
		else
		{
			shift=event.shiftKey;
			alt =event.altKey;
			ctrl=event.ctrlKey;
		}
		mouse=shift+alt+ctrl;
	}

	return true;
}

if (parseInt(navigator.appVersion)>3) 
	document.onmousedown = mouseDown;

var win = new Array();
function WinOpen(nr,path,title,sx,sy, sc)
{
	if (win[nr]!=null && !win[nr].closed) 
		win[nr].close();

	if (!sc)
	{
		if (sx>(screen.width-100)) sx=screen.width-100;
		if (sy>(screen.height-100)) sy=screen.height-100;
	}

	if (sx && sx<250) sx=250;	//popup < 250 ff ¼le wywietlany

	if (sx!=0 && sy!=0)
	{
		sl = (screen.width-sx)/2;
		st = (screen.height-sy)/2;
		win[nr] = window.open(path,title,'left='+sl+',top='+st+',width='+sx+',height='+sy+',scrollbars=yes,resizable=yes,status=no');
		if (win[nr]) win[nr].focus();
	}
	
	return false;
}

var upload_win = null;

function UploadWinOpen()
{
	if (upload_win!=null && !upload_win.closed) upload_win.close();

	upload_win = window.open('./upload.php','Upload','left=100,top=100,scrolling=no,width=350,height=250,scrollbars=no,resizable=no,status=no');
	upload_win.focus();
}

function UploadWinClose()
{
	if (upload_win!=null && !upload_win.closed) upload_win.close();
}

function WinResizeTo(sx, sy)
{
	if (sx>(screen.width-100)) sx=screen.width-100;
	if (sy>(screen.height-100)) sy=screen.height-100;
	if (sx && sx<200) sx=200;	//popup < 200 ff ¼le wywietlany

	window.resizeTo(sx,sy);
}

function ToolTipShow(elem, text)
{
	if (!(newElem=document.getElementById('tooltip1')))
	{
		var newElem = document.createElement("div");
		newElem.setAttribute("id", "tooltip1");
		newElem.setAttribute("style", "visibility: visible; ");
		document.body.appendChild(newElem);
	}

	var x=elem.offsetLeft;
	var y=elem.offsetTop+elem.offsetHeight;

	var parent = elem;
	while (parent.offsetParent) {
		parent = parent.offsetParent;
		x += parent.offsetLeft;
		y += parent.offsetTop ;
	}

	newElem.style.visibility = "visible" ;
	newElem.style.backgroundColor= "#CCCC00" ;
	newElem.style.position = "absolute";
	newElem.style.left = x+"px";
	newElem.style.top = y+"px";
	newElem.innerHTML="<table ><tr><td>"+text+"</td></tr></table>";

	return false;
}

function ToolTipHide()
{
	var elem;
	if (elem=document.getElementById('tooltip1'))
		elem.style.visibility = "hidden" ;

	return false;
}
-->
