/* [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','6001',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/6001.html','true',[],'',''],
	['PAGE','15401',jdecode('O+nas'),jdecode(''),'/15401.html','true',[],'',''],
	['PAGE','15422',jdecode('Produkty'),jdecode(''),'/15422/index.html','true',[ 
		['PAGE','15443',jdecode('Elektroencefalografia'),jdecode(''),'/15422/15443.html','true',[],'',''],
		['PAGE','15485',jdecode('Polisomnografia+i+bezdech+senny'),jdecode(''),'/15422/15485.html','true',[],'',''],
		['PAGE','16301',jdecode('Akcesoria+do+EEG+i+PSG'),jdecode(''),'/15422/16301.html','true',[],'',''],
		['PAGE','16601',jdecode('Aparatura+naukowo-badawcza'),jdecode(''),'/15422/16601.html','true',[],'',''],
		['PAGE','15464',jdecode('Neurologia'),jdecode(''),'/15422/15464.html','true',[],'',''],
		['PAGE','15506',jdecode('Elektrokardiografia'),jdecode(''),'/15422/15506.html','true',[],'','']
	],'',''],
	['PAGE','15527',jdecode('Kontakt'),jdecode(''),'/15527.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Aeskulap';
theSitetree.paletteFamily='C00405';
theSitetree.keyvisualId='2494';
theSitetree.keyvisualName='arzt.jpg';
theSitetree.fontsetId='27043';
theSitetree.graphicsetId='487';
theSitetree.contentColor='006633';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Aeskulap',
				paletteFamily: 	'C00405',
				keyvisualId: 	'2494',
				keyvisualName: 	'arzt.jpg',
				fontsetId: 		'27043',
				graphicsetId: 	'487',
				contentColor: 	'006633',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20090710-094228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15401',
internalId:  '',
customField: '20090126-135407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15422',
internalId:  '',
customField: '20090124-003201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15527',
internalId:  '',
customField: '20090924-225330'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15443',
internalId:  '',
customField: '20090509-002631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15464',
internalId:  '',
customField: '20090509-001818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15485',
internalId:  '',
customField: '20090623-235855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15506',
internalId:  '',
customField: '20090124-020640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16301',
internalId:  '',
customField: '20090510-231205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16601',
internalId:  '',
customField: '20090509-000709'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6001',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15401',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15422',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15443',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15485',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '16301',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '16601',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15464',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15506',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '15527',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['1501']=webappMappings['1501-7001218']={
webappId:    '1501',
documentId:  '6001',
internalId:  '7001218',
customField: '1501'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INZ4IA';
var companyName   = 'PWSIM+MEDISOFT';
var htmlTitle	  = 'PWSIM+MEDISOFT';
var metaKeywords  = 'Medisoft%2C+Piotr+Walerjan%2C+EEG%2C+elektroencefalografia%2C+wideo-EEG%2C+LTM%2C+Grass+Technologies%2C+PSG%2C+polisomnografia%2C+bezdech+senny%2C+bezdech+podczas+snu%2C+OSA%2C+OBS%2C+OBPS%2C+przetworniki%2C+czujniki%2C+SLP%2C+mapping%2C+mapowanie%2C+EKG%2C+TCD%2C+stymulacja+magnetyczna%2C+TMS%2C+doppler+przezczaszkowy%2C+holter%2C+aparat+stereotaktyczny%2C+David+Kopf+Instruments.';
var metaContents  = 'Strona+PWSIM+MEDISOFT.+Aparatura+medyczna+-+EEG%2C+LTM%2C+PSG%2C+EKG%2C+SEEG%2C+ECoG%2C+TCD%2C+TMS.+Akcesoria.';
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();
};

