/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','1701',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/1701.html','true',[],'',''],
	['PAGE','14101',jdecode('Przepisy'),jdecode(''),'/14101/index.html','true',[ 
		['PAGE','18701',jdecode('Prawo+o+notariacie'),jdecode(''),'/14101/18701.html','true',[],'',''],
		['PAGE','19501',jdecode('Taksa+notarialna'),jdecode(''),'/14101/19501.html','true',[],'',''],
		['PAGE','19701',jdecode('PCC'),jdecode(''),'/14101/19701.html','true',[],'',''],
		['PAGE','19722',jdecode('Spadki+i+darowizny'),jdecode(''),'/14101/19722.html','true',[],'','']
	],'',''],
	['PAGE','13401',jdecode('Jak+do+nas+trafi%C4%87'),jdecode(''),'/13401.html','true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Communication';
theSitetree.paletteFamily='669999';
theSitetree.keyvisualId='332';
theSitetree.keyvisualName='books.jpg';
theSitetree.fontsetId='26682';
theSitetree.graphicsetId='36';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='507979';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Communication',
				paletteFamily: 	'669999',
				keyvisualId: 	'332',
				keyvisualName: 	'books.jpg',
				fontsetId: 		'26682',
				graphicsetId: 	'36',
				contentColor: 	'000000',
				contentBGColor: '507979',
				a_color: 		'669999',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'003333',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20100626-194851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13401',
internalId:  '',
customField: '20101009-102333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14101',
internalId:  '',
customField: '20101009-102339'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1701',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14101',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '13401',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-14578394']={
webappId:    '1501',
documentId:  '1701',
internalId:  '14578394',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18701',
internalId:  '',
customField: '20100619-205607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19501',
internalId:  '',
customField: '20101009-102611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19701',
internalId:  '',
customField: '20101009-103439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19722',
internalId:  '',
customField: '20100619-211201'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INP70T';
var companyName   = 'NOTARIUSZE';
var htmlTitle	  = 'Arkadiusz+Sk%C5%82ucki+Piotr+Prorok';
var metaKeywords  = 'Piotr+Prorok%2C+Arkadiusz+Sk%C5%82ucki%2C+notariusz+gda%C5%84sk%2C+akt+notarialny%2C+po%C5%9Bwiadczenie%2C+umowa+sprzeda%C5%BCy%2CNotariusz+dokonuje+nast%C4%99puj%C4%85cych+czynno%C5%9Bci%3A++1%29+++sporz%C4%85dza+akty+notarialne%3B++1a%29++sporz%C4%85dza+akty+po%C5%9Bwiadczenia+dziedziczenia%3B++2%29+++sporz%C4%85dza+po%C5%9Bwiadczenia%3B++3%29+++dor%C4%99cza+o%C5%9Bwiadczenia%3B++4%29+++spisuje+protoko%C5%82y%3B++5%29+++sporz%C4%85dza+protesty+weksli+i+czek%C3%B3w%3B++6%29+++przyjmuje+na+przechowanie+dokumenty%2C+pieni%C4%85dze+i+papiery+warto%C5%9Bciowe%3B++7%29+++sporz%C4%85dza+wypisy%2C+odpisy+i+wyci%C4%85gi+dokument%C3%B3w%3B++8%29+++sporz%C4%85dza%2C+na+%C5%BC%C4%85danie+stron%2C+projekty+akt%C3%B3w%2C+o%C5%9Bwiadcze%C5%84+i+innych+dokument%C3%B3w%3B++9%29+++sporz%C4%85dza+inne+czynno%C5%9Bci+wynikaj%C4%85ce+z+odr%C4%99bnych+przepis%C3%B3w';
var metaContents  = 'Notariusz+dokonuje+nast%C4%99puj%C4%85cych+czynno%C5%9Bci%3A++1%29+++sporz%C4%85dza+akty+notarialne%3B++1a%29++sporz%C4%85dza+akty+po%C5%9Bwiadczenia+dziedziczenia%3B++2%29+++sporz%C4%85dza+po%C5%9Bwiadczenia%3B++3%29+++dor%C4%99cza+o%C5%9Bwiadczenia%3B++4%29+++spisuje+protoko%C5%82y%3B++5%29+++sporz%C4%85dza+protesty+weksli+i+czek%C3%B3w%3B++6%29+++przyjmuje+na+przechowanie+dokumenty%2C+pieni%C4%85dze+i+papiery+warto%C5%9Bciowe%3B++7%29+++sporz%C4%85dza+wypisy%2C+odpisy+i+wyci%C4%85gi+dokument%C3%B3w%3B++8%29+++sporz%C4%85dza%2C+na+%C5%BC%C4%85danie+stron%2C+projekty+akt%C3%B3w%2C+o%C5%9Bwiadcze%C5%84+i+innych+dokument%C3%B3w%3B++9%29+++sporz%C4%85dza+inne+czynno%C5%9Bci+wynikaj%C4%85ce+z+odr%C4%99bnych+przepis%C3%B3w';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};

