var fotoObj = null;

function PageInit() {
	// Test przeglądarki dla www.isof.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.isof.pl. Polecamy następujące przeglądarki:\n\nMicrosoft Internet Explorer, wersja 5 lub nowsze;\nNetscape Navigator, wersja 6 lub nowsze;\nMozilla;\nOpera, wersja 7 lub nowsze.");
	if (typeof OnPageLoad == "function")
		OnPageLoad();
}

function PageUnload() {
	RequestURL("/stats/onunload.html?n=" + String(Math.random()).replace(/0\./, ""));
}

function ZoomFoto(f) {
	var fn = f.src;
	var fc = f.className;
	
	if (fc == "foto_l" || fc == "foto_p") {
		f.src = fn.replace(/m(\.\w+$)/, "$1");
		f.className = fc.replace(/foto_/, "foto_z");
		f.title = "Kliknij aby zmniejszyć";
		if (browserInfo.is_gecko) {
			fotoObj = f;
			AddEvent(f, "load", ZoomShow);
		}
	}
	else {
		f.src = fn.replace(/(\.\w+$)/, "m$1");
		f.className = fc.replace(/foto_z/, "foto_");
		f.title = "Kliknij aby powiększyć";
	}
}

function ZoomShow() {
		fotoObj.style.visibility = "hidden";
		fotoObj.style.visibility = "visible";
		RemoveEvent(fotoObj, "load", ZoomShow);
}

function AddEvent(node, evtType, func) {
	if (node.addEventListener) {
		node.addEventListener(evtType, func, false);
		return true;
	} else if (node.attachEvent)
		return node.attachEvent("on" + evtType, func);
	else
		return false;
}

function RemoveEvent(node, evtType, func) {
	if (node.removeEventListener) {
		node.removeEventListener(evtType, func, false);
		return true;
	} else if (node.detachEvent)
		return node.detachEvent("on" + evtType, func);
	else
		return false;
}

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;
}




function zoom(href,x,y) {
  //var opcje = "toolbar=0,location=0,direction=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=yes";
  
  var opcje = "toolbar=0,location=0,direction=0,status=0,menubar=0,scrollbars=0,resizable=1,width=" + screen.availWidth +",height=" + screen.availHeight+",left=0, top=0";
  var okienko = window.open(href, "zoom", opcje);
  okienko.focus();
}


function zoomdwa(href,x,y) {
  //location=no,menubar=no,resizable=yes,scrollbars=no,status=yes,titlebar=no,toolbar=no
  
  var opcje = "location=no,menubar=no,resizable=yes,scrollbars=no,status=yes,titlebar=no,toolbar=no,width=" + (screen.availWidth - 10) +",height=" + (screen.availHeight - 10)+",left=0, top=0";
  var okienko = window.open(href, "zoom", opcje);
  okienko.focus();
}




function zoomPicture(nazwa,x,y) {
	var dok;
	x += 10;
	y += 10;
	opcje="toolbar=0,location=0,direction=0,status=0,menubar=0,scrollbars=0,width=" + x +",height=" + y;
	okienko = window.open("obrazki/mozliwosci/" + nazwa, "zoom", opcje);
	okienko.focus();
}

function zoomPicture2(nazwa,x,y) {
	zoomPicture('../zastosowania/' + nazwa, x, y);
}

function film(nazwa, changePage) {

	if (typeof nazwa != "string" || nazwa == "")
		nazwa = "filmy/filmy.htm";
	else
  	nazwa = "filmy/film_" + nazwa + ".htm";
  zoomdwa(nazwa, 780, 590);
  if (typeof changePage != "boolean" || changePage)
  	location.href = "filmy.hdb";
}

function subfilm(nazwa, changePage) {

	if (typeof nazwa != "string" || nazwa == "")
		nazwa = "../filmy/filmy.htm";
	else
  	nazwa = "../filmy/film_" + nazwa + ".htm";
  zoomdwa(nazwa, 780, 590);
  if (typeof changePage != "boolean" || changePage)
  	location.href = "../filmy.hdb";
}

function ffilm(nazwa, changePage) {

	if (typeof nazwa != "string" || nazwa == "")
		nazwa = "filmy/filmy.htm";
	else
  	nazwa = "filmy/film_" + nazwa + ".htm";
  zoomdwa(nazwa, 780, 590);
  
}




//film plus przekierowanie
function filmRedir(nazwa, changePage) {

	expiredays = 1000*3 ;
	var exdate=new Date();
	exdate.setTime(exdate.getTime()+ expiredays );
	document.cookie =  "soundblock=;expires=" + exdate.toGMTString();


	if (typeof nazwa != "string" || nazwa == "")
		nazwa = "filmy/filmy.htm";
	else
  	nazwa = "filmy/film_" + nazwa + ".htm";
  zoom(nazwa, 780, 590);
 
  	location.href = changePage;
}



//====================================================================
// 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);
	}
}

AddEvent(window, "load", PageInit);
AddEvent(window, "unload", PageUnload);



function clearForm(x)
{
     document.getElementById(x).value=""

}



