/* [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','20701',jdecode('AKTUALNO%C5%9ACI'),jdecode(''),'/20701.html','true',[],'',''],
	['PAGE','4952',jdecode('O+SOBIE'),jdecode(''),'/4952.html','true',[],'',''],
	['PAGE','5036',jdecode('PUBLIKACJE'),jdecode(''),'/5036.html','true',[],'',''],
	['PAGE','5099',jdecode('DLA+STUDENT%C3%93W'),jdecode(''),'/5099.html','true',[],'',''],
	['PAGE','8001',jdecode('ZATRZYMANE+CHWILE'),jdecode(''),'/8001.html','true',[],'',''],
	['PAGE','23201',jdecode('ANKIETA'),jdecode(''),'/23201.html','false',[],'',''],
	['PAGE','8022',jdecode('KSI%C4%98GA+GO%C5%9ACI'),jdecode(''),'/8022.html','true',[],'',''],
	['PAGE','5120',jdecode('KONTAKT'),jdecode(''),'/5120.html','true',[],'',''],
	['PAGE','8043',jdecode('SZNUROWNIA'),jdecode(''),'/8043.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='660000';
theSitetree.keyvisualId='978';
theSitetree.keyvisualName='adresskartei.jpg';
theSitetree.fontsetId='26793';
theSitetree.graphicsetId='197';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'660000',
				keyvisualId: 	'978',
				keyvisualName: 	'adresskartei.jpg',
				fontsetId: 		'26793',
				graphicsetId: 	'197',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'660000',
				c_color: 		'000000',
				d_color: 		'990000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-2431']={
webappId:    '7008',
documentId:  '23201',
internalId:  '2431',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4952',
internalId:  '',
customField: '20100326-130843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8022',
internalId:  '',
customField: '20081116-140140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20081115-132750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20701',
internalId:  '',
customField: '20100602-180327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5036',
internalId:  '',
customField: '20100602-181918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8043',
internalId:  '',
customField: '20091216-113726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5099',
internalId:  '',
customField: '20100602-181337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5120',
internalId:  '',
customField: '20081116-154256'
};
webappMappings['7060']=webappMappings['7060-33b52c564c7a91308491c17e88fa6cf2']={
webappId:    '7060',
documentId:  '8001',
internalId:  '33b52c564c7a91308491c17e88fa6cf2',
customField: 'language:pl;country:PL;'
};
webappMappings['1002']=webappMappings['1002-8022ahpl10inz1nv']={
webappId:    '1002',
documentId:  '8022',
internalId:  '8022ahpl10inz1nv',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-1513']={
webappId:    '7008',
documentId:  '5120',
internalId:  '1513',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23201',
internalId:  '',
customField: '20100302-123311'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '20701',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INZ1NV';
var companyName   = 'Dominika+%C5%81%C4%99cka';
var htmlTitle	  = 'DOMINIKA+%C5%81%C4%98CKA';
var metaKeywords  = 'Dominika%2C+%C5%81%C4%99cka+Dominika%2C+Krawczinska%2C+Lecka%2C+UMK%2C+IS%2C+Uniwersytet+Miko%C5%82aja+Kopernika%2C+Toru%C5%84%2C+zdrowie%2C+choroba%2C+profilaktyka%2C+terapia%2C+systemowa%2C+psychoterapia%2C+Instytut+Socjologii%2C+socjologia+zdrowia+i+choroby%2C+wtts%2C+Czernikowo%2C+Stolno%2C+Bydgoszcz%2C+Toru%C5%84%2C+Warszawa%2C+Problemy+Narkomanii%2C+warsztat%2C+warsztaty%2C+superwizja%2C+psychoterapia%2C+Poza+stygmatem+narkomana%2C+Kobieta+w+dobie+HIV%2FAIDS';
var metaContents  = 'Dominika+%C5%81%C4%99cka+-+socjolog%2C+pedagog%2C+terapeuta+systemowy.+Doktorantka+w+Instytucie+Socjologii+Miko%C5%82aja+Kopernika+w+Toruniu.+Strona+zawiera+informacje+na+temat+jej+dzia%C5%82alno%C5%9Bci+i+zainteresowa%C5%84+naukowych+oraz+wybrane+pozycje+bibliograficzne+z+wersjami+online.';
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();
};

