/* [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','29401',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/29401.html','true',[],'',''],
	['PAGE','36001',jdecode('Konsutacje+dietetyczne'),jdecode(''),'/36001.html','true',[],'',''],
	['PAGE','29452',jdecode('Programy+szkole%C5%84'),jdecode(''),'/29452/index.html','true',[ 
		['PAGE','29473',jdecode('Zdrowie+na+talerzu'),jdecode(''),'/29452/29473.html','true',[],'',''],
		['PAGE','29494',jdecode('Wiem%2C+wybieram%2C+jem'),jdecode(''),'/29452/29494.html','true',[],'',''],
		['PAGE','29515',jdecode('Mamo%2C+jestem+g%C5%82odny%21'),jdecode(''),'/29452/29515.html','true',[],'',''],
		['PAGE','29536',jdecode('Czekaj%C4%85c+na+dziecko'),jdecode(''),'/29452/29536.html','true',[],'','']
	],'',''],
	['PAGE','29557',jdecode('O+nas'),jdecode(''),'/29557.html','true',[],'',''],
	['PAGE','29578',jdecode('Kontakt'),jdecode(''),'/29578.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Trade';
theSitetree.paletteFamily='68856A';
theSitetree.keyvisualId='12110';
theSitetree.keyvisualName='kv_12110.jpg';
theSitetree.fontsetId='36737';
theSitetree.graphicsetId='14173';
theSitetree.contentColor='1d3821';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Trade',
				paletteFamily: 	'68856A',
				keyvisualId: 	'12110',
				keyvisualName: 	'kv_12110.jpg',
				fontsetId: 		'36737',
				graphicsetId: 	'14173',
				contentColor: 	'1d3821',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29401',
internalId:  '',
customField: '20100303-201943'
};
webappMappings['7008']=webappMappings['7008-4830']={
webappId:    '7008',
documentId:  '29578',
internalId:  '4830',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29494',
internalId:  '',
customField: '20100226-223122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29515',
internalId:  '',
customField: '20091013-230758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29536',
internalId:  '',
customField: '20091013-231039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29452',
internalId:  '',
customField: '20091014-192450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29578',
internalId:  '',
customField: '20100226-234857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29473',
internalId:  '',
customField: '20091014-191239'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '29401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29557',
internalId:  '',
customField: '20091014-192416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36001',
internalId:  '',
customField: '20100303-200733'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10INZ1FI';
var companyName   = 'Masz+pouk%C5%82adane+w+g%C5%82owie%3F++++++A+na+talerzu%3F';
var htmlTitle	  = '';
var metaKeywords  = 'szkolenia+dietetyczne%2C+szkolenia+z+od%C5%BCywiania%2C+warsztaty+dietetyczne%2C+zdrowa+dieta%2C+prawid%C5%82owe+%C5%BCywienie%2C+szkolenia+dla+firm%2C+warsztaty+dla+firm%2C+prawid%C5%82owe+%C5%BCywienie+';
var metaContents  = 'Szko%C5%82a+%C5%9Awiadomego+Od%C5%BCywiania+edukacja+dietetyczna+dla+firm%2C+EU+w+walce+z+nadwag%C4%85+i+oty%C5%82o%C5%9Bci%C4%85+';
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();
};

