/* [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','2401',jdecode('przyjazne+strony'),jdecode(''),'/2401.html','true',[],'',''],
	['PAGE','9164',jdecode('zapis+fragmentu'),jdecode(''),'/9164.html','true',[],'',''],
	['PAGE','9185',jdecode('mowa+wi%C4%85zana'),jdecode(''),'/9185.html','true',[],'',''],
	['PAGE','4143',jdecode('blog'),jdecode(''),'/4143.html','true',[],'',''],
	['PAGE','9143',jdecode('listy+do+tytusa'),jdecode(''),'/9143.html','true',[],'',''],
	['PAGE','4101',jdecode('list+otwarty+do+p.+Jana+P+'),jdecode(''),'/4101.html','true',[],'',''],
	['PAGE','4122',jdecode('kazania+ksi%C4%99dza+Jerzego'),jdecode(''),'/4122.html','true',[],'',''],
	['PAGE','9101',jdecode('%C5%9Bwiadectwo'),jdecode(''),'/9101.html','true',[],'',''],
	['PAGE','9206',jdecode('niech+zst%C4%85pi+Duch+Tw%C3%B3j'),jdecode(''),'/9206.html','true',[],'',''],
	['PAGE','9122',jdecode('kontakt'),jdecode(''),'/9122.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='555454';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='27480';
theSitetree.graphicsetId='10892';
theSitetree.contentColor='555454';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'555454',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'27480',
				graphicsetId: 	'10892',
				contentColor: 	'555454',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'555454',
				e_color: 		'555454',
				f_color: 		'555454',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20100815-191152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9206',
internalId:  '',
customField: '20100523-213434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9185',
internalId:  '',
customField: '20100828-183958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9164',
internalId:  '',
customField: '20100828-183859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9143',
internalId:  '',
customField: '20100605-073756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9122',
internalId:  '',
customField: '20100412-211716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20100616-212140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20100513-204156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4122',
internalId:  '',
customField: '20100610-212856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4143',
internalId:  '',
customField: '20100825-202038'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9164',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-6099']={
webappId:    '7008',
documentId:  '9122',
internalId:  '6099',
customField: 'language:pl;country:PL;'
};
webappMappings['1002']=webappMappings['1002-4101aaz010in3d8r']={
webappId:    '1002',
documentId:  '4101',
internalId:  '4101aaz010in3d8r',
customField: 'icq=false'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN3D8R';
var companyName   = 'd+o+b+r+e++++n+o+w+i+n+y';
var htmlTitle	  = 'Dobre+Nowiny+strona+niepo%C5%9Bwi%C4%99cona+';
var metaKeywords  = 'smole%C5%84sk+10.04.2010+wiersze+katy%C5%84+2+katy%C5%84+II+tragedia+notatnik+stra%C5%BCnica+pami%C4%99%C4%87+stra%C5%BCnik+portal+katolicki+strona+katolicka+prawda+informacja+katolickie+chrze%C5%9Bcijanin+chrze%C5%9Bcija%C5%84ski++linkownia+blogi+real+program+plus+mapa+wiadomo%C5%9Bci+informacji+newsy+wie%C5%9Bci+artyku%C5%82y+literatura+sztuka+religia+prawda+Roman+Misiewicz+';
var metaContents  = 'Dobre+Nowiny+-++Smole%C5%84sk+2010.+Stra%C5%BCnica+pami%C4%99ci+smole%C5%84skiej+tragedii.+Czy+Smole%C5%84sk+jest+znakiem+danym+nam+od+Boga+czy+zwyk%C5%82ym+przypadkiem+.+W+za%C5%82o%C5%BCeniu+autora+mia%C5%82+to+by%C4%87+agregator+stron+katolickich.+Miejsce+spotkania+z+interesuj%C4%85cymi++lud%C5%BAmi+.+Prasa+religijna.+Newsy.+Bolg.+Katolicka+literatura+i+sztuka.+Plus+najlepsze+artyku%C5%82y.+Wa%C5%BCne+informacje.+Nowa+era+w+komunikacji+.+Religia+katolicki+Jezus+Chrystus+chrze%C5%9Bcija%C5%84stwo+biblia+ewangelia+ewangelizacja+misje+katolicka+literatura+blogi+katolickie+Krzy%C5%BC+sacrum+Roman+Misiewicz++';
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();
};
