﻿// © Maciej Róg
W=window;
D=document;
B=D.body;
if (location.protocol=="https:") Base="https://www.mrog.org/";
else if (location.protocol=="http:") Base="http://www.mrog.org/";
else Base="";

if (location.protocol=="http:"&&location.hostname.indexOf("www.")!=0&&!Base) {
	setTimeout("location.replace(location.href.replace(/http:\/\//,'http://www.'));",2);
	location.replace(location.href.replace(/http:\/\//,"http://www."));
} else if (top!=self) {
	document.write("<a href='"+location.href+"' target='_top'>Kliknij tutaj, jeżeli chcesz zobaczyć stronę bez ramek</a><div style='display: none;'>");
}

function eID(x) {
	if (D.getElementById) return D.getElementById(x);
	if (D.all) return D.all[x];
	if (D.layers) return D.layers[x];
	return null;
}

function eTAG(x,y) {
	if (D.getElementsByTagName) return (y||D).getElementsByTagName(x);
	return null;
}

function eGetAttr(x,y) {
	if ((typeof x)!="object") x=eID(x);
	if (!x) return null;
	return x.getAttribute(y);
}

function getCookie(x) {
	if (!x||navigator.cookieEnabled==false) return;
	var s,t;
	if (D.cookie.length>0) {
		t=D.cookie.indexOf(x+"=");
		if (t==-1) return;
		t+=x.length+1;
		s=D.cookie.indexOf(";",t);
		if (s==-1) s=D.cookie.length;
		return unescape(D.cookie.substring(t,s));
	}
}

function setCookie(x,y,z) {
	if (!x||navigator.cookieEnabled==false) return;
	if (!z&&z!=0) z=60;
	var t=new Date().getTime()+(z*60000);
	D.cookie=x+"="+escape(y)+";expires="+new Date(t).toGMTString();
}

function dw(x) {
	D.write(x);
}

function ws(x) {
	W.status=x;
	return true;
}

var menu=["genealogia","prawo","rozne","maciejrog","kontakt"];

function r19link(x,y) {
	var a,b,c,d,e,f,i,t;
	a=menu;
	if (x=="default") x="maciejrog";
	if (W.menuLink&&!x) x=W.menuLink;
	f=[];
	for (i=0; i<a.length; i++) {
		b=eID(a[i]+"_link");
		c=eID(a[i]+"_img");
		d=eID(a[i]+"_body");
		c.src=Base+"menu/"+a[i]+(a[i]==x? 3 :"")+".gif";
		c.onmouseover=new Function("this.src='"+Base+"menu/"+a[i]+(a[i]==x? 4 :2)+".gif'; ws(this.alt);");
		c.onmouseout=new Function("this.src='"+Base+"menu/"+a[i]+(a[i]==x? 3 :"")+".gif'; ws('');");
		c.title=c.alt||"";
		c.parentNode.onmouseup=new Function("this.onfocus=new Function('this.blur()');");
		if (d) d.style.display=(a[i]==x? "" :"none");
		if (a[i]==x) W.menuLink=x;
		if (!W.r19bufor) for (j=1; j<=4; j++) f.push("<img src='"+Base+"menu/"+a[i]+(j==1? "" :j)+".gif'>");
	} if (!W.r19bufor) {
		D.write("<div class='none hidden'>"+f.join("")+"</div>");
		W.r19bufor=1;
	}
}

function r19check() {
	return;//kompatybilnosc
}

function r19menu(x) {
	var a,b,c,i,t;
	a=[];
	b=[];
	for (i=0; i<menu.length; i++) {
		t=menu[i];
		c=Base+(t!="maciejrog"? t+".html" :"");
		if (t=="genealogia"&&location.href.indexOf("http://genealog.mrog.org/odsylacze_")==0) {
			c="http://genealog.mrog.org/odsylacze.html";
		} else if (t=="genealogia"&&location.href.indexOf("http://genealog.mrog.org/")==0
		&&location.href.split("#")[0]!="http://genealog.mrog.org/") {
			c="http://genealog.mrog.org/";
		} else if (t=="genealogia"&&location.href.indexOf("http://jsfamilia.mrog.org/")==0
		&&location.href.split("#")[0]!="http://jsfamilia.mrog.org/") {
			c="http://jsfamilia.mrog.org/";
		} a.push("<div id='"+t+"_link'><a href='"+c+"'><img id='"+t+
			"_img' src='"+Base+"menu/"+t+".gif' class='menuimg' alt=''></a></div>");
		b.push("<img src='"+Base+"menu/"+t+".gif'><img src='"+Base+"menu/"+t+"2.gif'><img src='"+Base+"menu/"+t+
			"3.gif'><img src='"+Base+"menu/"+t+"4.gif'>");
	} document.write("<div id='menu'>"+a.join("")+"</div>"+
		(location.hostname=="www.mrog.org"||location.hostname=="mrog.org"
		||(location.protocol!="http:"&&location.protocol!="https:")?
		"<h1 class='header'>"+(navigator.language=="en"||window.r19lang=="en"? "Maciej Róg — home page"
		:"Maciej Róg — strona domowa")+"</h1>" :"")+"<div class='none'>"+b.join("")+"</div>");
}