// --- debug console --- start --- //
var _console = null;

function dbg(msg) {
	debug_console("<h3>Vlastnosti: " + msg + "</h3>");
	for (i in msg)
		try {	debug_console("<b>" + i + "</b> : " + msg[i]); }
		catch(e) { debug_console("<i>Exception: " + i + "</i>"); }
}

function debug_console(msg) {
	if ((_console == null) || (_console.closed)) {
		_console = window.open("","console","width=600,height=300,resizable,scrollbars");
		_console.document.open("text/html");
	}
	_console.document.writeln("<br />" + msg);
}
// --- debug console --- end --- //

// --- browser detection --- start --- //
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

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

if (checkIt('konqueror')) {
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
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"
	version = detect.charAt(8);
} else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS) {
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}
// --- browser detection --- end --- //


