/* [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 theSitetree=[ 
	['PAGE','601',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/601.html','true',[],''],
	['PAGE','37901',jdecode('urz%C4%85dzenia+demo'),jdecode(''),'/37901.html','true',[],''],
	['PAGE','36801',jdecode('strefa+dla+instalator%C3%B3w'),jdecode(''),'/36801/index.html','true',[ 
		['PAGE','36822',jdecode('ceny+kamer+IP'),jdecode(''),'/36801/36822.html','true',[],''],
		['PAGE','36843',jdecode('ceny+kamer+analogowych'),jdecode(''),'/36801/36843.html','true',[],''],
		['PAGE','36864',jdecode('ceny+rejestrator%C3%B3w'),jdecode(''),'/36801/36864.html','true',[],'']
	],''],
	['PAGE','36101',jdecode('Oferta+CCTV'),jdecode(''),'/36101/index.html','true',[ 
		['PAGE','36122',jdecode('kamery+analogowe'),jdecode(''),'/36101/36122.html','true',[],''],
		['PAGE','36143',jdecode('kamery+IP'),jdecode(''),'/36101/36143.html','true',[],''],
		['PAGE','36164',jdecode('rejestratory'),jdecode(''),'/36101/36164.html','true',[],''],
		['PAGE','36185',jdecode('obiektywy'),jdecode(''),'/36101/36185.html','true',[],''],
		['PAGE','36206',jdecode('pozosta%C5%82e'),jdecode(''),'/36101/36206.html','true',[],'']
	],''],
	['PAGE','15901',jdecode('Oferta++SSWiN'),jdecode(''),'/15901/index.html','true',[ 
		['PAGE','24601',jdecode('czujniki+wewn%C4%99trzne'),jdecode(''),'/15901/24601.html','true',[],''],
		['PAGE','36227',jdecode('czujniki+zewn%C4%99trzne'),jdecode(''),'/15901/36227.html','true',[],''],
		['PAGE','36248',jdecode('bariery'),jdecode(''),'/15901/36248.html','true',[],''],
		['PAGE','36269',jdecode('kontaktrony'),jdecode(''),'/15901/36269.html','true',[],''],
		['PAGE','36290',jdecode('nadajniki+GSM'),jdecode(''),'/15901/36290.html','true',[],''],
		['PAGE','36311',jdecode('obudowy'),jdecode(''),'/15901/36311.html','true',[],''],
		['PAGE','36332',jdecode('zasilacze'),jdecode(''),'/15901/36332.html','true',[],''],
		['PAGE','24701',jdecode('centrale+alarmowe'),jdecode(''),'/15901/24701.html','true',[],''],
		['PAGE','30301',jdecode('centrale+PARADOX'),jdecode(''),'/15901/30301.html','true',[],''],
		['PAGE','36353',jdecode('centarle+DSC'),jdecode(''),'/15901/36353.html','true',[],''],
		['PAGE','36374',jdecode('centrale+Texacom'),jdecode(''),'/15901/36374.html','true',[],'']
	],''],
	['PAGE','36395',jdecode('alarmy+samochodowe'),jdecode(''),'/36395.html','true',[],''],
	['PAGE','36416',jdecode('domofony'),jdecode(''),'/36416.html','true',[],''],
	['PAGE','36437',jdecode('videodomofony'),jdecode(''),'/36437.html','true',[],''],
	['PAGE','37501',jdecode('Oferta+us%C5%82ugowa'),jdecode(''),'/37501.html','true',[],''],
	['PAGE','38101',jdecode('najcz%C4%99stsze+pytania'),jdecode(''),'/38101.html','true',[],''],
	['PAGE','16027',jdecode('Kontakt'),jdecode(''),'/16027.html','true',[],''],
	['PAGE','38401',jdecode('rejestracja+'),jdecode(''),'/38401.html','true',[],'']];
var siteelementCount=31;
theSitetree.topTemplateName='Moonflight';
theSitetree.paletteFamily='5B7A93';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='27053';
theSitetree.graphicsetId='499';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Moonflight',
				paletteFamily: 	'5B7A93',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'27053',
				graphicsetId: 	'499',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'2C5574',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1843']={
webappId:    '7008',
documentId:  '601',
internalId:  '1843',
customField: 'language:pl;country:PL;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20090422-215402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30301',
internalId:  '',
customField: '20090414-203358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15901',
internalId:  '',
customField: '20060821-142054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24601',
internalId:  '',
customField: '20090303-134558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24701',
internalId:  '',
customField: '20090303-134814'
};
webappMappings['1501']=webappMappings['1501-15314912']={
webappId:    '1501',
documentId:  '601',
internalId:  '15314912',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36122',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36101',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16027',
internalId:  '',
customField: '20060821-142054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36143',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36164',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36185',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36206',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36227',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36248',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36269',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36290',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36311',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36332',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36353',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36374',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36395',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36416',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36437',
internalId:  '',
customField: '20090422-210818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36801',
internalId:  '',
customField: '20090426-142031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36822',
internalId:  '',
customField: '20090422-212347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36843',
internalId:  '',
customField: '20090422-212347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36864',
internalId:  '',
customField: '20090422-212347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37501',
internalId:  '',
customField: '20090426-125156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37901',
internalId:  '',
customField: '20090426-141708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38101',
internalId:  '',
customField: '20090426-142216'
};
webappMappings['7008']=webappMappings['7008-3118']={
webappId:    '7008',
documentId:  '38401',
internalId:  '3118',
customField: 'language:pl;country:PL;'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INXLLS';
var companyName   = 'Z.P.U.H.+TODAKS';
var htmlTitle	  = 'todaks';
var metaKeywords  = 'todaks+alarmy+kamery+czujniki+todax+w%C5%82oc%C5%82awek+sygnalizatory+centrale+esprit+paradox+digiplex+satel+gorke+simtecsystem';
var metaContents  = 'todaks+strona+firmowa+';
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();
};

