/* [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','1801',jdecode('BABYLON-XMP'),jdecode(''),'/1801.html','true',[],'',''],
	['PAGE','11101',jdecode('ACL-32'),jdecode(''),'/11101.html','true',[],'',''],
	['PAGE','1852',jdecode('Programy'),jdecode(''),'/1852.html','true',[],'',''],
	['PAGE','1873',jdecode('Kontrolery'),jdecode(''),'/1873.html','true',[],'',''],
	['PAGE','29305',jdecode('Upgrade+do+kontroler%C3%B3w'),jdecode(''),'/29305.html','true',[],'',''],
	['PAGE','1894',jdecode('Czytniki'),jdecode(''),'/1894.html','true',[],'',''],
	['PAGE','17205',jdecode('Zamki+autonomiczne+eLock'),jdecode(''),'/17205.html','true',[],'',''],
	['PAGE','11122',jdecode('Automatyka+budynku'),jdecode(''),'/11122.html','true',[],'',''],
	['PAGE','1936',jdecode('Akcesoria'),jdecode(''),'/1936.html','true',[],'',''],
	['PAGE','1915',jdecode('Kontakt'),jdecode(''),'/1915.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Georgia';
theSitetree.paletteFamily='6080D3';
theSitetree.keyvisualId='5979';
theSitetree.keyvisualName='kv_5979.jpg';
theSitetree.fontsetId='27849';
theSitetree.graphicsetId='11911';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='6080D3';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Georgia',
				paletteFamily: 	'6080D3',
				keyvisualId: 	'5979',
				keyvisualName: 	'kv_5979.jpg',
				fontsetId: 		'27849',
				graphicsetId: 	'11911',
				contentColor: 	'FFFFFF',
				contentBGColor: '6080D3',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20100619-202123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20100225-191754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20100619-201111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20100222-131253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20101023-223932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20100301-113824'
};
webappMappings['1501']=webappMappings['1501-19286944']={
webappId:    '1501',
documentId:  '1801',
internalId:  '19286944',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17205',
internalId:  '',
customField: '20100218-221045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11122',
internalId:  '',
customField: '20100220-110924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20100330-085229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29305',
internalId:  '',
customField: '20100222-180631'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '1801',
internalId:  'search',
customField: 'language:pl;country:PL;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INH0VL';
var companyName   = 'PUT-KAS';
var htmlTitle	  = 'BABYLON-XMP';
var metaKeywords  = 'kontrola%2Cdost%C4%99p%2Cautomatyka%2Cbudynek%2Cszlaban%2Cczytnik%2Cprogram%2Cautec%2Cbabylon%2Cvesta%2Curanus%2Cxmp%2Clegc%2Cmifare%2Chitag%2Cfinger%2Clinie%2Cpapilarne%2Chand%2C%C5%BCy%C5%82%2Cgeometria%2Cd%C5%82oni%2Cbramki%2C%C5%9Bluza%2Cmobile%2Cbabylonnt%2Cbabylon%2Fnt%2Ckontroler%2Ck-32%2Ck-12%2Ck-24%2CKAS%2Cprzedsi%C4%99biorstwo%2Cus%C5%82ug%2Ctechnicznych%2Czak%C5%82ad%2Celektroniczny%2Ceugeniusz%2Cwiniecki%2Ckontrola++dost%C4%99pu%2Ckontrola+dost%C4%99pu%2Cdost%C4%99p%2Cdost%C4%99p%2CRCP%2Crejestracja+czasu+pracy%2Ckarty%2Celektroniczne%2Crcp%2Calarmy%2Czabezpieczenia%2Cprojekty%2Cprojektowanie%2Cszlaban%2Cczytnik%2Cczujka%2Ccentrala%2Cszlabany%2Cczujki%2Ccentrale%2Ckontroli%2Crejestracji%2Curz%C4%85dzenia%2Curz%C4%85dzenia%2Csystem%2Csystemy%2Ckontrola%2Cdost%C4%99pu%2Caccess%2Ccontrol%2Csystemy%2Calarmowe%2Cprzeciw%2Cpo%C5%BCarowe%2Calarm%C3%B3wka%2Cpo%C5%BCar%C3%B3wa%2Ckamery%2CCCTV%2Csieci%2Ckomputerowe%2Cinstalacje%2Cprojekty%2Cprojektowanie%2Csprzeda%C5%BC%2Ckarty%2Cidentyfikacyjne%2Cetui%2C%C5%82a%C5%84cuszki%2Ckarty%2Cmagnetyczne%2Cdrukarki%2Cpersonifikacja%2Ckart%2Ckarty%2Cdost%C4%99powe%2Cdost%C4%99pu%2Ctripdy%2Cinteligentne%2Cbudynki%2Czarz%C4%85dzanie%2Cnieruchomo%C5%9Bciami%2Cnieruchomo%C5%9Bci%2Cintegracja%2Csystemy%2Cinduc%2Ckarty%2CLegic%2CMifare%2CProximity%2CWieganda%2CBarcode%2CBedas%2Cbramki%2CKerberos%2CBasic%2CBenzing%2CKaba';
var metaContents  = 'P+U+T+-+KAS+OEM+partner+firmy+AUTEC+GmbH.+Firma+zajmuj%C4%85ca+si%C4%99+dystrybucj%C4%85+oraz+projektowaniem+i+instalowaniem+systemu+kontroli+dost%C4%99pu+BABYLON-XMP.++Najwi%C4%99ksze+do%C5%9Bwiadczenie+w+pracy+z+systemem+BABYLON-XMP.+Najwi%C4%99cej+zainstalowanych+system%C3%B3w.%0ASystem+jest+ci%C4%85gle+rozbudowywany%2C+unowocze%C5%9Bniany+i+aktualizowany+do+obecnych+system%C3%B3w+operacyjnych%2C+zabezpiecze%C5%84+oraz+urz%C4%85dze%C5%84+peryferyjnych.';
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();
};

