/* [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','1814',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/1814.html','true',[],'',''],
	['PAGE','21001',jdecode('Nasza+Szko%C5%82a'),jdecode(''),'/21001.html','true',[],'',''],
	['PAGE','100512',jdecode('Informacje+o+zapisach'),jdecode(''),'/100512.html','true',[],'',''],
	['PAGE','2048',jdecode('Zapisy+ON-LINE'),jdecode(''),'/2048.html','true',[],'',''],
	['PAGE','1901',jdecode('Direct+Method+for+English'),jdecode(''),'/1901.html','true',[],'',''],
	['PAGE','1943',jdecode('Metoda+Komunikatywna'),jdecode(''),'/1943.html','true',[],'',''],
	['PAGE','1964',jdecode('Egzamin+Gimnazjalny'),jdecode(''),'/1964.html','true',[],'',''],
	['PAGE','1985',jdecode('Matura'),jdecode(''),'/1985.html','true',[],'',''],
	['PAGE','21043',jdecode('Zaj%C4%99cia+dla+dzieci'),jdecode(''),'/21043.html','true',[],'',''],
	['PAGE','2006',jdecode('+--+Egzaminy+mi%C4%99dzynarodowe'),jdecode(''),'/2006.html','true',[],'',''],
	['PAGE','22001',jdecode('Zaj%C4%99cia+indywidualne'),jdecode(''),'/22001.html','true',[],'',''],
	['PAGE','122212',jdecode('Kursy+dla+Firm'),jdecode(''),'/122212.html','true',[],'',''],
	['PAGE','2069',jdecode('Cennik'),jdecode(''),'/2069.html','true',[],'',''],
	['PAGE','21106',jdecode('Kontakt'),jdecode(''),'/21106.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='F5F5F5';
theSitetree.keyvisualId='2176';
theSitetree.keyvisualName='studieren.jpg';
theSitetree.fontsetId='26958';
theSitetree.graphicsetId='407';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F5F5F5';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'F5F5F5',
				keyvisualId: 	'2176',
				keyvisualName: 	'studieren.jpg',
				fontsetId: 		'26958',
				graphicsetId: 	'407',
				contentColor: 	'000000',
				contentBGColor: 'F5F5F5',
				a_color: 		'F5F5F5',
				b_color: 		'8EBFC6',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1814',
internalId:  '',
customField: '20100902-155653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20100831-164431'
};
webappMappings['1501']=webappMappings['1501-9588683']={
webappId:    '1501',
documentId:  '1814',
internalId:  '9588683',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1943',
internalId:  '',
customField: '20100121-133032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1964',
internalId:  '',
customField: '20100129-220649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1985',
internalId:  '',
customField: '20100129-223243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2006',
internalId:  '',
customField: '20100313-220903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2048',
internalId:  '',
customField: '20100123-124806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2069',
internalId:  '',
customField: '20100902-161943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '122212',
internalId:  '',
customField: '20100729-231411'
};
webappMappings['7008']=webappMappings['7008-4937']={
webappId:    '7008',
documentId:  '21106',
internalId:  '4937',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22001',
internalId:  '',
customField: '20100729-230904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21001',
internalId:  '',
customField: '20100313-221026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21106',
internalId:  '',
customField: '20100804-000722'
};
webappMappings['7008']=webappMappings['7008-4976']={
webappId:    '7008',
documentId:  '2048',
internalId:  '4976',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21043',
internalId:  '',
customField: '20100307-160122'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1814',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100512',
internalId:  '',
customField: '20100604-231940'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN3QNP';
var companyName   = 'PERFECT+SCHOOL+kursy+j%C4%99zykowe';
var htmlTitle	  = 'PERFECT+SCHOOL+-+szko%C5%82a+j%C4%99zykowa+w+Raciborzu';
var metaKeywords  = '';
var metaContents  = 'Szko%C5%82a+J%C4%99zykowa+w+Raciborzu.+J%C4%99zyk+angielski+metod%C4%85+DIRECT+ENGLISH.+Metoda+Callana.+Matura.+FCE%2FCAE%2FCPE.+Kursy+biznesowe.+Kursy+dla+dzieci.+Zaj%C4%99cia+w+ma%C5%82ych+grupach+4-6+os%C3%B3b.+Zaj%C4%99cia+indywidualne.+UL.+SOLNA+21.+Tel.+032+740+3333%2C+606+355+514.';
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();
};
