function okno(url) {  
        win = window.open(url);
  }

/*//////////////////////////////////obrazek w nowym oknie//////////////////////////////////*/
/*
	 Skrypt jest darmowy, poki ten komentarz w nim pozostaje.
	 Released under Creative Commons License
	 http://creativecommons.org/licenses/by/2.0/
	 Original author: Kornel Lesinski
	 http://pornel.net/pups/
*/
var pornpups =
{
	init: function(element)
	{
		if (!element || !element.getElementsByTagName) {return false;}
		var as = element.getElementsByTagName('a');
		for(var i=0;i<as.length;i++)
		{
			if ((as[i].href+'').match(/\.(jpe?g|png|gif)/i))
				as[i].onclick = this.click;
		}
		return true;
	},
	writedoc: function(win,href,title,alt,h)
	{
		var doc = win.document;
		doc.open('text/html;charset=utf-8');
		doc.write(
		'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' +
		'<html id="popup">' +
		'<head><title>' + alt + '</title>' +
		'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' +
		'<meta http-equiv="imagetoolbar" content="false">' +
		'<link rel="stylesheet" href="pornpups.css">' +
		(h?'<style type="text/css">.obrazek {min-height: ' + h + 'px} #iesux#popup .obrazek {height: ' + h + 'px;}</style>':'') +
		'</head><body onclick="window.close();">' +
		'<p class="obrazek"><img src="'+href+'" title="Kliknij aby zamknąć" alt="Kliknij aby zamknąć"></p>' +
		'</body></html>'
		);
		doc.close();
	},
	title2size: function(str)
	{
		if (str)
		{
			var out = str.match(/\(([0-9]+)x([0-9]+)\)/);
			if (out) return new Array(str.replace(/\(([0-9]+)x([0-9]+)\)/g,''),parseInt(out[1]),parseInt(out[2]));
		}
		return new Array(str,550,420);
	},
	click: function()
	{
		try {
			if (this.pp_win && this.pp_win.close && !this.pp_win.closed) {this.pp_win.close(); this.pp_win=false;}
		}
		catch(e){}
		try {
			var imgs = this.getElementsByTagName('img');
			var title = imgs[0].getAttribute('title')?imgs[0].getAttribute('title'):this.getAttribute('title');
			var alt = imgs[0].getAttribute('alt');
			var titleandsize = pornpups.title2size(title);
			var winopts = "dependent=yes,toolbar=no,resizable=yes,width=" + (titleandsize[1]) + ',height=' + (titleandsize[2]);
			var win = window.open(this.href,'_blank',winopts);
			if (win && win.opener)
			{
				this.pp_win = win;
				pornpups.writedoc(win,this.href,titleandsize[0],alt,titleandsize[2]);
				return false;
			}
		}
		catch(e){}
		return true;
	},
	initNow: function()
	{
		this.init(document.body);
	},
	initLoad: function()
	{
		var oldOnload = window.onload;
		var that = this;
		window.onload = function()
		{
			if (oldOnload) try{oldOnload();}catch(e){/*explorer dziwne rzeczy plecie*/}
			that.initNow();
		}
	}
};
pornpups.initLoad();
pornpups.initNow();
/*//////////////////////////////////obrazek w nowym oknie//////////////////////////////////*/

function menuR(menu){

	var menu = $(menu);
	//var submenu = $(submenu);
	
	var ukryj = function(element){
		element.style.visibility = 'hidden';

		//Element.hide(element);
		
	}	
	var pokaz = function(element){
		element.style.visibility = 'visible';
	//Element.show(element);
	}
	
	var ukryjMenu = function(classn){
		$A(menu.select('div'+classn)).each(ukryj);

	}	
	
	var ukryjMenuB = function() { ukryjMenu('.submenu_b'); };
	var ukryjMenuBP = function(poziom) { ukryjMenu('[rel="'+poziom+'"]'); };
	var ukryjMenuR = function() { ukryjMenu('.submenu');  }
	
	var menuBoczne = function(ob,linkLeft){
		var obRel = ob.readAttribute('rel');
		var obMenu = new Element('div',{'rel':obRel.length});
		obMenu.className = 'submenu_b';
		obMenu.style.left=linkLeft+'px';
		
		var elementy = $A(menu.select('div.' + obRel));
		var maxSzer = 0;
		elementy.each(function(ob){var w = ob.getWidth(); if(w > maxSzer) maxSzer = w;});
		maxSzer=116;
		
		obMenu.style.width=maxSzer+'px';
		
		$A(menu.select('div.' + obRel)).each(function(link){obMenu.appendChild(link); link.style.width=maxSzer+'px'; if(obRel.length < 12) menuBoczne(link,maxSzer);});
		if(!obMenu.empty()) 
		{
			ob.appendChild(obMenu);
			Element.observe(ob,'mouseover',function() {ukryjMenuBP(obRel.length+''); pokaz(obMenu);});
		}
	}
	
	$A(menu.select('div')).each(function(ob){
	
		var obRel = ob.readAttribute('rel');
		var maxSzer = 0;
		$A(menu.select('div.' + obRel)).each(function(obiekt){var w = obiekt.getWidth(); if(w > maxSzer) maxSzer = w;});
		maxSzer=116;
		var obMenu = new Element('div');
		obMenu.className = 'submenu';
		obMenu.style.width=116+'px';
		$A(menu.select('div.' + obRel)).each(function(link){obMenu.appendChild(link); link.style.width=maxSzer+'px';menuBoczne(link,maxSzer);  });
		if(!obMenu.empty())
		{
			ob.appendChild(obMenu);

			Element.observe(ob,'mouseover',function() { ukryjMenuR(); pokaz(obMenu);});

		}

	});
	

	Element.observe('menu_r','mouseout',ukryjMenuR);
	Element.observe('menu_r','mouseout',ukryjMenuB);
	//Element.observe('srodek','mouseover',ukryjMenuR);
	//Element.observe('srodek','mouseover',ukryjMenuB);
	document.observe('dom:loaded',ukryjMenuR);
	document.observe('dom:loaded',ukryjMenuB);
ukryjMenuR();

	
}
