// $Id: page.js,v 1.8 2006/03/22 14:47:59 jo Exp $
// ----------------------------------------------
// Funkcje obsługi górnego menu + test przeglądarki + centrowanie


function PageInit() {
	try {
		// Test przeglądarki dla www.heuthes.pl
		//
		browserInfo = new BrowserInfo();
		if (!(browserInfo.is_ie5up || browserInfo.is_nav6up || browserInfo.is_opera7up))
			alert("Państwa przeglądarka internetowa może nie wyświetlać prawidłowo zawartości witryny www.heuthes.pl. Polecamy następujące przeglądarki:\n\nMicrosoft Internet Explorer, wersja 5 lub nowsze;\nNetscape Navigator, wersja 6 lub nowsze;\nMozilla / Mozilla Firefox;\nOpera, wersja 7 lub nowsze.");

/*
		if (browserInfo.is_ie5up) {
			var marg = Math.round((document.documentElement.clientWidth - 825) / 2);
			var bodyStyle = document.body.style;
			if (marg < 0)
				marg = 0;
			bodyStyle.position = "relative";
			bodyStyle.left = "" + marg + "px";
			bodyStyle.backgroundPosition = "" + marg + "px";
			window.onresize = WindowResize;
		}
*/
		if (typeof OnPageLoad == "function")
			OnPageLoad();
	}
	catch (e) {}
}

function WindowResize() {
	var marg = Math.round((document.documentElement.clientWidth - 825) / 2);
	var bodyStyle = document.body.style;
	if (marg < 0)
		marg = 0;
	bodyStyle.left = "" + marg + "px";
	bodyStyle.backgroundPosition = "" + marg + "px";
}

function PageUnload() {
	RequestURL("/stats/onunload.html?n=" + String(Math.random()).replace(/0\./, ""));
}

function RequestURL(url) {
	var req = null;
	
	if (typeof XMLHttpRequest != "undefined") {
		try {
			var req = new XMLHttpRequest();
		}
		catch (e) {}
	}
	if (req == null && typeof ActiveXObject != "undefined")
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	if (req != null)
		try {
			req.open('GET', url, false);
			req.send(null);
		}
		catch (e) {}
	return req.status;
}


//====================================================================
// browser.js -- klasa BrowserInfo
// -------------------------------------------------------------------
// Jacek Ostrowski, 23.1.2004
// bazowane na kodzie Netscape:
// http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
// ===================================================================

function BrowserInfo()
{
	// 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.
	this.is_major = parseInt(navigator.appVersion);
	this.is_minor = parseFloat(navigator.appVersion);

	// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
	// If you want to allow spoofing, take out the tests for opera and webtv.
	this.is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
	            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
	            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	this.is_nav2 = (this.is_nav && (this.is_major == 2));
	this.is_nav3 = (this.is_nav && (this.is_major == 3));
	this.is_nav4 = (this.is_nav && (this.is_major == 4));
	this.is_nav4up = (this.is_nav && (this.is_major >= 4));
	this.is_navonly = (this.is_nav && ((agt.indexOf(";nav") != -1) ||
									(agt.indexOf("; nav") != -1)) );
	this.is_nav6 = (this.is_nav && (this.is_major == 5));
	this.is_nav6up = (this.is_nav && (this.is_major >= 5));
	this.is_gecko = (agt.indexOf('gecko') != -1);

	this.is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	this.is_ie3 = (this.is_ie && (this.is_major < 4));
	this.is_ie4 = (this.is_ie && (this.is_major == 4) &&
								(agt.indexOf("msie 4")!=-1) );
	this.is_ie4up = (this.is_ie && (this.is_major >= 4));
	this.is_ie5    = (this.is_ie && (this.is_major == 4) &&
										(agt.indexOf("msie 5.0")!=-1) );
	this.is_ie5_5  = (this.is_ie4up &&	(agt.indexOf("msie 5.5") !=-1));
	this.is_ie5up  = (this.is_ie && !this.is_ie3 && !this.is_ie4);
	this.is_ie5_5up =(this.is_ie5up && !this.is_ie5);
	this.is_ie6    = (this.is_ie && (this.is_major == 4) &&
										(agt.indexOf("msie 6.")!=-1) );
	this.is_ie6up  = (this.is_ie5_5up && !this.is_ie5_5);

	this.is_opera = (agt.indexOf("opera") != -1);
	this.is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
	this.is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
	this.is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
	this.is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
	this.is_opera5up = (this.is_opera && !this.is_opera2 && !this.is_opera3 &&
										!this.is_opera4);
	this.is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
	this.is_opera6up = (this.is_opera5up && !this.is_opera5);
	this.is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1);
	this.is_opera7up = (this.is_opera6up && !this.is_opera6);
	this.is_opera8 = (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/8") != -1);
	this.is_opera8up = (this.is_opera7up && !this.is_opera7);

	this.is_hotjava = (agt.indexOf("hotjava") != -1);
	this.is_hotjava3 = (this.is_hotjava && (this.is_major == 3));
	this.is_hotjava3up = (this.is_hotjava && (this.is_major >= 3));

	// *** JAVASCRIPT VERSION CHECK ***
	if (this.is_nav2 || this.is_ie3) this.is_js = 1.0;
	else if (this.is_nav3) this.is_js = 1.1;
	else if (this.is_opera5up) this.is_js = 1.3;
	else if (this.is_opera) this.is_js = 1.1;
	else if ((this.is_nav4 && (this.is_minor <= 4.05)) || this.is_ie4) 
		this.is_js = 1.2;
	else if ((this.is_nav4 && (this.is_minor > 4.05)) || this.is_ie5)
		this.is_js = 1.3;
	else if (this.is_hotjava3up) this.is_js = 1.4;
	else if (this.is_nav6 || this.is_gecko) this.is_js = 1.5;
	// NOTE: In the future, update this code when newer versions of JS
	// are released. For now, we try to provide some upward compatibility
	// so that future versions of Nav and IE will show they are at
	// *least* JS 1.x capable. Always check for JS version compatibility
	// with > or >=.
	else if (this.is_nav6up) this.is_js = 1.5;
	// NOTE: ie5up on mac is 1.4
	else if (this.is_ie5up) this.is_js = 1.3

	// HACK: no idea for other browsers; always check for JS version with > or >=
	else this.is_js = 0.0;

	// *** PLATFORM ***
	this.is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
	// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
	//        Win32, so you can't distinguish between Win95 and WinNT.
	this.is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
	this.is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
	this.is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

	// NOTE: Reliable detection of Win98 may not be possible. It appears that:
	//       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
	//       - On Mercury client, the 32-bit version will return "Win98", but
	//         the 16-bit version running on Win98 will still return "Win95".
	this.is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
	this.is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
	this.is_win32 = (this.is_win95 || this.is_winnt || this.is_win98 || 
	                ((is_major >= 4) && (navigator.platform == "Win32")) ||
	                (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

	if (this.is_win) {
		this.is_linux = false;
		this.is_unix = false;
	}
	else {
	  this.is_linux = (agt.indexOf("inux")!=-1);
	  var is_sun   = (agt.indexOf("sunos")!=-1);
	  var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
	  var is_hpux  = (agt.indexOf("hp-ux")!=-1);
	  var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
	  var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
	  var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
	  var is_mpras    = (agt.indexOf("ncr")!=-1); 
	  var is_reliant  = (agt.indexOf("reliantunix")!=-1);
	  var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
	         (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
	         (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
	  var is_sinix = (agt.indexOf("sinix")!=-1);
	  var is_freebsd = (agt.indexOf("freebsd")!=-1);
	  var is_bsd = (agt.indexOf("bsd")!=-1);
	  this.is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
	               is_sco ||is_unixware || is_mpras || is_reliant || is_dec ||
	               is_sinix || is_aix || this.is_linux || is_bsd || is_freebsd);
	}
}

/*window.onload = PageInit;
window.onunload = PageUnload;*/


function clearForm(x)
{
      return "";

}


var okienko="";

function zoom(href,x,y) {
  var opcje = "toolbar=0,location=0,direction=0,status=0,menubar=0,scrollbars=0,width=" + x +",height=" + y ;
  okienko = window.open(href, "zoomwin", opcje);
  okienko.focus();
}

// Otwarcie okna filmów i załadowanie filmu o podanej nazwie
//
function film(nazwa) {
  zoom("filmy/" + nazwa + "/index.html", 760, 540);
}





$(document).ready(function() {
// $('head').append('<script src="/js/snowstorm.js" type="text/javascript"></script>');

 
$("#query").focus(function() {
if($("#query").val()=="szukaj") $("#query").val("");
});


});


 


