function otworzokno(numer,wys,szer,nazwa) {
okno=window.open("","",'toolbar=no, menubar=no, personalbar=no, status=no, resizable=no,height='+wys+',width='+szer+',left=100,top=100');
okno.document.write("<html><head><META HTTP-EQUIV='Content-type' CONTENT='text/html; charset=iso-8859-2'><link rel='stylesheet' href='style2.css' type='text/css'><title>" + nazwa + "</title></HEAD><body background='img/kolor.gif' leftmargin='0' rightmargin='0' topmargin='0' marginwidth='0' marginheight='0'><center><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td valign='middle' align='center'>");
okno.document.write("<a href='javascript:window.close()'><img src='pliki/" + numer + "' border=0></a><br />" + nazwa + "</td></tr></table></center></body></html>");
}
function otworzokno2(numer,wys,szer,nazwa) {
okno=window.open("","",'toolbar=no, menubar=no, personalbar=no, status=no, resizable=no,height='+wys+',width='+szer+',left=100,top=100');
okno.document.write("<html><head><META HTTP-EQUIV='Content-type' CONTENT='text/html; charset=iso-8859-2'><link rel='stylesheet' href='style2.css' type='text/css'><title>" + nazwa + "</title></HEAD><body background='img/kolor.gif' leftmargin='0' rightmargin='0' topmargin='0' marginwidth='0' marginheight='0'><center><table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td valign='middle' align='center'>");
okno.document.write("<a href='javascript:window.close()'><img src='strony/" + numer + "' border=0></a><br />" + nazwa + "</td></tr></table></center></body></html>");
}

function otworzm1(numer,wys,szer) {
	okno=window.open("","",'toolbar=no, menubar=no, personalbar=no, status=no, resizable=no,height='+wys+',width='+szer+',left=100,top=100');
	okno.document.write("<html><title>Komnaty Parteru - Wawel</title><body background='img/kolor.gif' leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0><center><table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr><td valign=middle align=center>");
	okno.document.write("<img src=ekspozycje/mapa1.gif border=0 USEMAP='/#mapa1_Map'><MAP NAME='mapa1_Map'><AREA SHAPE='rect' ALT='salon wielkorządcy' COORDS='293,187,394,246' HREF='javascript:opener.location.replace(\"index.php?s=ekspozycje&id=1#1\");'><AREA SHAPE='rect' ALT='salon wielkorządcy' COORDS='9,99,195,124' HREF='javascript:opener.location.replace(\"index.php?s=ekspozycje&id=1#1\");' ></MAP></td></tr></table></center></body></html>");
}

function otworzm(tytul,plik,szer,wys) {
	okno=window.open("","",'toolbar=no, menubar=no, personalbar=no, status=no, resizable=no,height='+ wys +',width='+ szer +',left=100,top=100');
	okno.document.write("<html><title>" + tytul + "</title><body background='img/kolor.gif' leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0><center><table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr><td valign=middle align=center>");
	okno.document.write("<img src=ekspozycje/" + plik + " border=0></td></tr></table></center></body></html>");
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
    
    var today = new Date();
    today.setTime( today.getTime() );
    
    if ( expires ) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    
    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( name ) {
    
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) &&
    ( name != document.cookie.substring( 0, name.length ) ) ) {
        return null;
    }
    if ( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

function change_values(obj) {
 if (obj.value == obj.defaultValue)
  obj.value = "";
 else if (obj.value == "")
  obj.value = obj.defaultValue;
}






/**
 * @author Sławomir Kokłowski {@link http://www.kurshtml.boo.pl}
 * @copyright NIE usuwaj tego komentarza! (Do NOT remove this comment!)
 */

function Menu(id, style, otworz, wysun, czasRozwin, czasZwin, czasOtworz, czasZamknij, nieInicjalizuj)
{
	if (typeof czasRozwin == 'undefined' || czasRozwin < 0) czasRozwin = 25;
	if (typeof czasZwin == 'undefined' || czasZwin < 0) czasZwin = 25;
	if (typeof czasOtworz == 'undefined' || czasOtworz < 0) czasOtworz = 250;
	if (typeof czasZamknij == 'undefined' || czasZamknij < 0) czasZamknij = 500;
	
	if (style)
	{
		if (style.indexOf(':') < 0)
		{
			document.getElementById(id).className += ' ' + style;
		}
		else
		{
			style = style.replace(/(^\s+|(\s|;)+$)/g, '').split(/\s*;\s*/);
			for (var i = 0; i < style.length; i++)
			{
				style[i] = style[i].split(/\s*:\s*/);
				for (var j = 0, c, property = ''; j < style[i][0].length; j++)
				{
					c = style[i][0].charAt(j);
					property += c == '-' ? style[i][0].charAt(++j).toUpperCase() : c.toLowerCase();
				}
				eval('document.getElementById("' + id + '").style.' + property + ' = "' + style[i][1].replace(/"/g, '\\"') + '"');
			}
		}
	}
	
	for (var i = 0; i < document.getElementById(id).getElementsByTagName('dt').length; i++)
	{
		var dd = new Array();
		var el = document.getElementById(id).getElementsByTagName('dt')[i].nextSibling;
		var nodeName;
		while (el && (nodeName = el.nodeName.toLowerCase()) != 'dt')
		{
			if (nodeName == 'dd')
			{
				el._dt = document.getElementById(id).getElementsByTagName('dt')[i];
				if (otworz)
				{
					el.onmouseover = function()
					{
						clearTimeout(this._dt._timoutID);
						this._dt._displayed = false;
						this._dt.onclick();
					}
					el.onmouseout = function()
					{
						clearTimeout(this._dt._timoutID);
						var dt = this._dt;
						this._dt._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
					};
				}
				dd[dd.length] = el;
			}
			el = el.nextSibling;
		}
		document.getElementById(id).getElementsByTagName('dt')[i]._j = i;
		document.getElementById(id).getElementsByTagName('dt')[i]._dd = dd;
		document.getElementById(id).getElementsByTagName('dt')[i]._timoutID = null;
		document.getElementById(id).getElementsByTagName('dt')[i]._displayed = false;
		document.getElementById(id).getElementsByTagName('dt')[i].onclick = function()
		{

			clearTimeout(this._timoutID);
			if (!this._displayed)
			{
				var el = this.parentNode.getElementsByTagName('dt')[0];
				while (el)
				{
					if (el.nodeName.toLowerCase() == 'dt' && el != this)
					{
						el._displayed = false;
						if (czasZwin) display(el, 0);
						else display(el);
					}					
					el = el.nextSibling;
				}
			}
			this._displayed = !this._displayed;
			if (this._displayed && czasRozwin || !this._displayed && czasZwin) 
			{
				display(this, 0);
			}
			else 
			{
				display(this);
    	  	}
			
			//************************
			if (this._displayed == true) 
			{ 
				if (this.className.toLowerCase() == 'p1') 
				{ 
					var res = '';
					
					location.href = this.parentNode.childNodes[2].childNodes[0].childNodes[0].childNodes[0].href; 
					
				} 
			}
			
    	  	//alert(this.id);
    	   Set_Cookie( 'tabs_lewa', this.id, 10, '/', '', '' );	
		};
		if (otworz)
		{
			document.getElementById(id).getElementsByTagName('dt')[i].onmouseover = function()
			{
				clearTimeout(this._timoutID);
				var dt = this;
				this._timoutID = setTimeout(function () { dt._displayed = false; dt.onclick(); }, czasOtworz);
			};
			document.getElementById(id).getElementsByTagName('dt')[i].onmouseout = function()
			{
				clearTimeout(this._timoutID);
				var dt = this;
				this._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
			};
		}
	}
	
	start(document.getElementById(id).getElementsByTagName('dt')[0]);
	
	function start(dt)
	{
		var hide = true;
		var el = dt;
		var jjj = -1;
		var jj = 0;
		while (el)
		{
			jjj++;
			if (jjj > jj)
				jj = jjj;

			var nodeName = el.nodeName.toLowerCase();
			if (nodeName == 'dt')
			{
				dt = el;
				hide = true;
			}
			if (nodeName == 'dt' || nodeName == 'dd')
			{
			//alert (unescape(el.getElementsByTagName('a')[0].href)+'->'+Get_Cookie('tabs_lewa'));
				//if (!nieInicjalizuj && el.getElementsByTagName('a').length && el.getElementsByTagName('a')[0].href && unescape(el.getElementsByTagName('a')[0].href) == unescape(window.location.href))
				if (!nieInicjalizuj && el.id  == Get_Cookie('tabs_lewa'))
				{
			//alert (el.id+'->'+Get_Cookie('tabs_lewa'));
					//el.className = (el.className ? el.className + '' : '') + '_active';
					//alert (el.className);
					dt._displayed = true;
					display(dt);
					hide = false;
					var el_parentNode = el.parentNode;
					while (el_parentNode != document.getElementById(id))
					{
						if (el_parentNode.nodeName.toLowerCase() == 'dd')
						{
							var el_sibling = el_parentNode.previousSibling;
							while (el_sibling)
							{
								if (el_sibling.nodeName.toLowerCase() == 'dt')
								{
									el_sibling._displayed = true;
									display(el_sibling)
									break;
								}
								el_sibling = el_sibling.previousSibling;
							}
						}
						el_parentNode = el_parentNode.parentNode;
					}
				}
			}
			if (nodeName == 'dd')
			{
				//alert('nie: '+jj);
				if (hide) el.style.display = 'none';
				start(el.getElementsByTagName('dt')[0]);
			}
			el = el.nextSibling;
		}
	}
	
	function display(dt, i)
	{
		if (typeof i == 'undefined')
		{
			for (var i = 0; i < dt._dd.length; i++)
			{
				dt._dd[i].style.display = dt._displayed ? 'block' : 'none';
				if (!dt._displayed)
				{
					for (var j = 0; j < dt._dd[i].getElementsByTagName('dt').length; j++)
					{
						dt._dd[i].getElementsByTagName('dt')[j]._displayed = false;
						display(dt._dd[i].getElementsByTagName('dt')[j]);
					}
				}
			}
		}
		else if (i < dt._dd.length)
		{
			var dir = wysun ? !dt._displayed : dt._displayed;
			var n = dir ? i : dt._dd.length - 1 - i;
			dt._dd[n].style.display = dt._displayed ? 'block' : 'none';
			if (!dt._displayed)
			{
				for (var j = 0; j < dt._dd[n].getElementsByTagName('dt').length; j++)
				{
					dt._dd[n].getElementsByTagName('dt')[j]._displayed = false;
					display(dt._dd[n].getElementsByTagName('dt')[j]);
				}
			}
			dt._timoutID = setTimeout(function() { display(dt, i + 1); }, dt._displayed ? czasRozwin : czasZwin);
		}
	}
}

function change_values(obj) {
 if (obj.value == obj.defaultValue)
  obj.value = "";
 else if (obj.value == "")
  obj.value = obj.defaultValue;
}



function z1()
{
 document.getElementById('z1').style.display='block';
 document.getElementById('z2').style.display='none';
 document.getElementById('z3').style.display='none';
 document.getElementById('zo1').className='selected';
 document.getElementById('zo2').className='';
 document.getElementById('zo3').className='';
 Set_Cookie('tabs_promocja','1', 10, '/', '', '' );
}


function z2()
{
 document.getElementById('z1').style.display='none';
 document.getElementById('z2').style.display='block';
 document.getElementById('z3').style.display='none';
 document.getElementById('zo1').className='';
 document.getElementById('zo2').className='selected';
 document.getElementById('zo3').className='';
 Set_Cookie('tabs_promocja','2', 10, '/', '', '' );
}
function z3()
{
 document.getElementById('z1').style.display='none';
 document.getElementById('z2').style.display='none';
 document.getElementById('z3').style.display='block';
  document.getElementById('zo1').className='';
 document.getElementById('zo2').className='';
 document.getElementById('zo3').className='selected';
 Set_Cookie('tabs_promocja','3', 10, '/', '', '' );
}
