/* [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','1501',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/1501.html','true',[],'',''],
	['PAGE','1552',jdecode('Obecne+oferty'),jdecode(''),'/1552.html','true',[],'',''],
	['PAGE','34822',jdecode('SCORPION'),jdecode(''),'/34822.html','true',[],'',''],
	['PAGE','41815',jdecode('IPONE+-+oleje%2C+chemia'),jdecode(''),'/41815.html','true',[],'',''],
	['PAGE','34801',jdecode('SHIRO'),jdecode(''),'/34801.html','true',[],'',''],
	['PAGE','34843',jdecode('NO+FEAR'),jdecode(''),'/34843.html','true',[],'',''],
	['PAGE','41215',jdecode('FORMA%2C+TCX'),jdecode(''),'/41215.html','true',[],'',''],
	['PAGE','6101',jdecode('+VENTICO'),jdecode(''),'/6101.html','true',[],'',''],
	['PAGE','1573',jdecode('Jak+do+nas+trafi%C4%87'),jdecode(''),'/1573.html','true',[],'',''],
	['PAGE','1594',jdecode('Kontakt'),jdecode(''),'/1594.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Kreis';
theSitetree.paletteFamily='4D4CD2';
theSitetree.keyvisualId='602';
theSitetree.keyvisualName='motorrad.jpg';
theSitetree.fontsetId='26762';
theSitetree.graphicsetId='140';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Kreis',
				paletteFamily: 	'4D4CD2',
				keyvisualId: 	'602',
				keyvisualName: 	'motorrad.jpg',
				fontsetId: 		'26762',
				graphicsetId: 	'140',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'4D4CD2',
				b_color: 		'7794F8',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1501',
internalId:  '',
customField: '20100414-213515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1552',
internalId:  '',
customField: '20110130-091948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34822',
internalId:  '',
customField: '20100403-172723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1573',
internalId:  '',
customField: '20110130-091715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1594',
internalId:  '',
customField: '20110130-091805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20090220-122153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34801',
internalId:  '',
customField: '20100110-132507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34843',
internalId:  '',
customField: '20100414-215339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41215',
internalId:  '',
customField: '20100414-220448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41815',
internalId:  '',
customField: '20100418-120843'
};
webappMappings['1501']=webappMappings['1501-15985692']={
webappId:    '1501',
documentId:  '1501',
internalId:  '15985692',
customField: '1501'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INEINU';
var companyName   = '';
var htmlTitle	  = 'Cz%C4%99%C5%9Bci+zamienne+do+skuter%C3%B3w%2C+maxiskuter%C3%B3w%2C+motorower%C3%B3w%2Cmotocykli%2C+atv%2Fquad+';
var metaKeywords  = 'cz%C4%99%C5%9Bci+do+skuter%C3%B3w+%2Cmaxiskuter%C3%B3w%2C+atv%2Fquad%2C+motorower%C3%B3w%2C+motocykli+125cc+%2C+t%C5%82oki%2C+cylindry%2C+paski+nap%C4%99dowe%2C+uszczelki%2C+akumulatory%2C+rolki+wariatora%2C+klocki+hamulcowe%2C+szcz%C4%99ki+hamulcowe%2C+castrol%2C+%C5%82o%C5%BCyska%2C+zestawy%2C+uszczelniacz%2C+parmakit%2Cvertex%2C+%C5%82a%C5%84cuch+nap%C4%99dowy%2Cwariatory%2Ccz%C4%99%C5%9Bci+zamienne+chi%C5%84skie+skutery%2F+atv%2C+zestawy+tuningowe%2C+cz%C4%99%C5%9Bci+zamienne%2C+motul%2Copony%2C%C5%BCar%C3%B3wki%2Cakumulatory%2Cvalvoline%2Cmobil';
var metaContents  = 'sklep+internetowy-+cz%C4%99%C5%9Bci+do+skuter%C3%B3w%2C+maxiskuter%C3%B3wcATV%2CQuad%2C+motocykli+-+klocki%2C+szcz%C4%99ki+hamulcowe%2C+akumulatory%2Cpaski+nap%C4%99dowe%2C+rolki+wariatora%2C+opony+inne';
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();
};

