/* [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','5301',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/5301.html','true',[],'',''],
	['PAGE','5352',jdecode('O+nas'),jdecode(''),'/5352.html','true',[],'',''],
	['PAGE','5373',jdecode('Statut+NZOZ'),jdecode(''),'/5373.html','true',[],'',''],
	['PAGE','5394',jdecode('Regulamin+NZOZ'),jdecode(''),'/5394.html','true',[],'',''],
	['PAGE','5415',jdecode('Karta+Praw+Pacjenta'),jdecode(''),'/5415.html','true',[],'',''],
	['PAGE','5436',jdecode('Wa%C5%BCne+informacje'),jdecode(''),'/5436.html','true',[],'',''],
	['PAGE','5478',jdecode('Foto+Galeria'),jdecode(''),'/5478.html','true',[],'',''],
	['PAGE','5499',jdecode('Napisz+do+nas...'),jdecode(''),'/5499.html','true',[],'',''],
	['PAGE','5457',jdecode('Polecane+linki'),jdecode(''),'/5457.html','true',[],'',''],
	['PAGE','5520',jdecode('Ksi%C4%99ga+Go%C5%9Bci'),jdecode(''),'/5520.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Finance';
theSitetree.paletteFamily='EBF2FF';
theSitetree.keyvisualId='2724';
theSitetree.keyvisualName='arzt.jpg';
theSitetree.fontsetId='28904';
theSitetree.graphicsetId='10675';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Finance',
				paletteFamily: 	'EBF2FF',
				keyvisualId: 	'2724',
				keyvisualName: 	'arzt.jpg',
				fontsetId: 		'28904',
				graphicsetId: 	'10675',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-e292c7ecc4a5be08e15936f5bba39f53']={
webappId:    '7060',
documentId:  '5478',
internalId:  'e292c7ecc4a5be08e15936f5bba39f53',
customField: 'language:pl;country:PL;'
};
webappMappings['7008']=webappMappings['7008-3662']={
webappId:    '7008',
documentId:  '5499',
internalId:  '3662',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100429-080436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5352',
internalId:  '',
customField: '20090705-221152'
};
webappMappings['1501']=webappMappings['1501-10787744']={
webappId:    '1501',
documentId:  '5301',
internalId:  '10787744',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5373',
internalId:  '',
customField: '20090625-210409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5394',
internalId:  '',
customField: '20090625-210513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5415',
internalId:  '',
customField: '20100429-084256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5436',
internalId:  '',
customField: '20090625-210629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5457',
internalId:  '',
customField: '20090628-170824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5478',
internalId:  '',
customField: '20090625-210753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5499',
internalId:  '',
customField: '20090625-210847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5520',
internalId:  '',
customField: '20090625-212039'
};
webappMappings['1002']=webappMappings['1002-5520ahpl10infaub']={
webappId:    '1002',
documentId:  '5520',
internalId:  '5520ahpl10infaub',
customField: 'icq=false'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INFAUB';
var companyName   = 'NZOZ+%22O%C5%9Brodek+Zdrowia%22+';
var htmlTitle	  = '';
var metaKeywords  = 'nzoz%2C+o%C5%9Brodek+zdrowia%2C+us%C5%82ugi+medyczne%2C+POZ%2C+lekarz%2C+piel%C4%99gniarka%2C+homeopatia%2C+usg%2C+nfz%2C++szkolna%2C+%C5%9Brodowiskowa%2C+po%C5%82o%C5%BCna%2C+badania%2C+porady+lekarskie%2C+leczenie%2C+specjalizacja%2C+chor%C3%B3b+wewn%C4%99trznych%2C+lekarz+rodzinny+';
var metaContents  = 'Strona+internetowa+NZOZ+O%C5%9Brodek+Zdrowia+w+W%C3%B3jcinie%2C+88-324+Jeziora+Wielkie.+Oferujemy+wszystkie+us%C5%82ugi+medyczne+w+zakresie+POZ+w+ramach+kontraktu+z+NFZ.+Dysponujemy+wysoko+kwalifikowan%C4%85+kadr%C4%85+lekarsk%C4%85+i+piel%C4%99gniarsk%C4%85+o+bogatym+do%C5%9Bwiadczeniu+zawodowym.+Serdecznie+zapraszamy.';
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();
};
