/* [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','2101',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/2101.html','true',[],'',''],
	['PAGE','2152',jdecode('US%C5%81UGI'),jdecode(''),'/2152/index.html','true',[ 
		['PAGE','2173',jdecode('Wizy+ameryka%C5%84skie'),jdecode(''),'/2152/2173.html','true',[],'',''],
		['PAGE','11012',jdecode('Wiza+do+Indii%2C+Tajlandii'),jdecode(''),'/2152/11012.html','true',[],'',''],
		['PAGE','11033',jdecode('Wizy+do+Chin%2C+Wietnamu'),jdecode(''),'/2152/11033.html','true',[],'','']
	],'',''],
	['PAGE','2215',jdecode('Kontakt'),jdecode(''),'/2215.html','true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='879ED6';
theSitetree.keyvisualId='6873';
theSitetree.keyvisualName='kv_6873.jpg';
theSitetree.fontsetId='27955';
theSitetree.graphicsetId='12030';
theSitetree.contentColor='354B86';
theSitetree.contentBGColor='94AAE1';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'879ED6',
				keyvisualId: 	'6873',
				keyvisualName: 	'kv_6873.jpg',
				fontsetId: 		'27955',
				graphicsetId: 	'12030',
				contentColor: 	'354B86',
				contentBGColor: '94AAE1',
				a_color: 		'94AAE1',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1240']={
webappId:    '7008',
documentId:  '2215',
internalId:  '1240',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20100828-201023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2152',
internalId:  '',
customField: '20100828-201941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2173',
internalId:  '',
customField: '20100828-202028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2215',
internalId:  '',
customField: '20100828-202303'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1031043']={
webappId:    '1501',
documentId:  '2101',
internalId:  '1031043',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11012',
internalId:  '',
customField: '20100828-203858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11033',
internalId:  '',
customField: '20100828-202135'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN29XY';
var companyName   = 'PO%C5%9AREDNICTWO++WIZOWE';
var htmlTitle	  = 'WIZY+po%C5%9Brednictwo%2Cwizy+wnioski%2C+wizy+info%2C+wizy+USA%2C+Indie%2C+Wietnam.+Tajlandia%2C+Chiny';
var metaKeywords  = 'wizy%2Cwizy+ameryka%C5%84skie%2C+wiza%2C+WIZY%2CJUPITER+Plus%2C+po%C5%9Brednictwo+wizowe%2C+wizy+USA%2C+loteria+wizowa%2C+wizy+turystyczne%2C+wizy+s%C5%82u%C5%BCbowe%2C+info+wizy%2C+wnioski+wizowe%2C+wizy+info%2C+wizy+do+USA%2C+wizy+do+Chin%2C+wizy+do+Indii%2C+wizy+Warszawa%2C+e-wizy%2C+ewiza%2C+wiza+do+stan%C3%B3w%2C+podr%C3%B3%C5%BCe+do+USA%2C+wycieczki%2C+podr%C3%B3%C5%BCe%2C+ambasada+%2C+konsulat%2C+druki+wizowe%2C+wizy+druki%2C+wizy+Ameryka%2C+USA+wiza%2C+wiza+do+Tajlandii%2C+wiza+do+Wietnamu%2C+Tajlandia+wiza%2C+Wietnam+wiza%2C+Chiny+wiza%2C+Indie+wiza%2C+wiza+do+Indii%2C+agent+turystyczny%2C+biuro+turystyczne%2C+organizator+turystyki%2C+turystyka%2C+podr%C3%B3%C5%BCe%2C+wycieczki%2C+rejsy%2C+wizy-jupiter%2C+jupiter-wizy%2C+wizy+jupiter%2C+jupiter+wizy%2C+po%C5%9Brednik+turystyczny%2C+mazowieckie+wizy%2C+Mazowsze+wizy%2C+us%C5%82ugi%2C+wizowe+us%C5%82ugi%2C+wizy+us%C5%82ugi%2C+wizy+mazowieckie%2C';
var metaContents  = 'Wizy+JUPITER+PLUS%2C+wizy+po%C5%9Brednictwo+na+zlecenie%2C+wizy+USA%2C+wizy+Indie%2C+wizy+Chiny%2C+wizy+Tajlandia%2C+wizy+Wietnam.+WYPE%C5%81NIAMY+ELEKTRONICZNIE+WNIOSKI+WIZOWE+DO++USA.+Dodatkowo+otrzymacie+Pa%C5%84stwo+szereg+przydatnych+informacji.+Posiadanie+do%C5%9Bwiadczenie+pozwala+nam+zapewni%C4%87+profesjonaln%C4%85+obs%C5%82ug%C4%99+klient%C3%B3w.';
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();
};
