/* [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','9401',jdecode('Aktualno%C5%9Bci'),jdecode(''), jdecode('%2F9401.html'), 'true',[],'',''],
	['PAGE','1952',jdecode('Nasz+Team'),jdecode(''), jdecode('%2F1952.html'), 'true',[],'',''],
	['PAGE','1973',jdecode('Relacje+z+zawod%C3%B3w'),jdecode(''), jdecode('%2F1973.html'), 'true',[],'',''],
	['PAGE','1994',jdecode('Modyfikacje+%2F+Tuning'),jdecode(''), jdecode('%2F1994.html'), 'true',[],'',''],
	['PAGE','30801',jdecode('Projekt+Suzuki+GSX-R+1070+Nitro'),jdecode(''), jdecode('%2F30801.html'), 'true',[],'',''],
	['PAGE','2015',jdecode('Zdj%C4%99cia+i++Filmy+z+zawod%C3%B3w+1%2F4+mili+'),jdecode(''), jdecode('%2F2015.html'), 'true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Citadel';
theSitetree.paletteFamily='414E8C';
theSitetree.keyvisualId='8166';
theSitetree.keyvisualName='kv_8166.jpg';
theSitetree.fontsetId='31370';
theSitetree.graphicsetId='12397';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='414E8C';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var prodDef={
  wl_name: 'azpl',
  product: 'WSCSYSSSSLY0XOD5'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Citadel',
				paletteFamily: 	'414E8C',
				keyvisualId: 	'8166',
				keyvisualName: 	'kv_8166.jpg',
				fontsetId: 		'31370',
				graphicsetId: 	'12397',
				contentColor: 	'FFFFFF',
				contentBGColor: '414E8C',
				a_color: 		'000000',
				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['7050']=webappMappings['7050-3224']={
webappId:    '7050',
documentId:  '1973',
internalId:  '3224',
customField: 'language:pl;country:PL;'
};
webappMappings['7060']=webappMappings['7060-27a04419cd9f65b107ffdcdd9d2ece15']={
webappId:    '7060',
documentId:  '2015',
internalId:  '27a04419cd9f65b107ffdcdd9d2ece15',
customField: 'language:pl;country:PL;'
};
webappMappings['1501']=webappMappings['1501-16101759']={
webappId:    '1501',
documentId:  '9401',
internalId:  '16101759',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20120104-011246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1952',
internalId:  '',
customField: '20120104-004608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2015',
internalId:  '',
customField: '20110321-221101'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1973',
internalId:  '',
customField: '20110215-123745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1994',
internalId:  '',
customField: '20110222-105030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30801',
internalId:  '',
customField: '20120119-235320'
};
webappMappings['7002']=webappMappings['7002-4050']={
webappId:    '7002',
documentId:  '30801',
internalId:  '4050',
customField: 'language:pl;country:PL;'
};
var webAppHostname = 'cgi-kreatorstron.az.pl:80';
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ340INVGC8';
var companyName   = '++++++NAJSZYBSZE+MOTOCYKLE+W+POLSCE++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++kontakt%40speedbike.pl+';
var htmlTitle	  = 'oRelacje+z+zawod%C3%B3w+1%2F4+mili+SSS++Modyfikacje+Tuning+motocykli+Suzuki+GSXR+Hayabusa+Yamaha+++R6+R1+Honda+CBR+F4i+600rr+1000rr+X11+XX+Kawasaki+ZX10+ZX12+ZX14+scigacz+';
var metaKeywords  = 'Suzuki+GSXR+GSX-R+Tuning+Modyfikacje+Honda+CBR+600+750+1000+podtlenek+azotu+turbo+nitro+drag+racing+racingforum+streetracing+Kawasaki+ZX6R+ZX10R+TRE+forum-gsxr+gsxr-forum';
var metaContents  = 'Drag+Racing+Team+%2C+Najszybsze+Motocykle+w+Polsce+%2C+Tuning%2C+Relacje+z+Zawod%C3%B3w+SSS+%2C+Zdj%C4%99cia%2C+Filmy%2C+Zawody+1%2F4+mili%2C+wy%C5%9Bcigi+r%C3%B3wnoleg%C5%82e.';
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();
};

