/* [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 theSitetree=[ 
	['PAGE','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','279501',jdecode('Koszyk%C3%B3wka'),jdecode(''),'/279501.html','true',[],''],
	['PAGE','179164',jdecode('PI%C5%81KARSKIE'),jdecode(''),'/179164.html','true',[],''],
	['PAGE','181801',jdecode('GOLFOWE'),jdecode(''),'/181801.html','true',[],''],
	['PAGE','5622',jdecode('BRELOKI+i+Zawieszki+'),jdecode(''),'/5622.html','true',[],''],
	['PAGE','179185',jdecode('AKCESORIA+sportowe'),jdecode(''),'/179185.html','true',[],''],
	['PAGE','5643',jdecode('Elektronika++Zegarki'),jdecode(''),'/5643.html','true',[],''],
	['PAGE','179122',jdecode('Pi%C5%82ki++i++Gry'),jdecode(''),'/179122.html','true',[],''],
	['PAGE','179143',jdecode('Frotki%2C+torby%2C+smycze'),jdecode(''),'/179143.html','true',[],''],
	['PAGE','179101',jdecode('Biurowe+i+Antystresowe'),jdecode(''),'/179101.html','true',[],''],
	['PAGE','5601',jdecode('Kontakt++++++Warunki'),jdecode(''),'/5601.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Straight';
theSitetree.paletteFamily='336633';
theSitetree.keyvisualId='1546';
theSitetree.keyvisualName='freizeit.jpg';
theSitetree.fontsetId='26853';
theSitetree.graphicsetId='302';
theSitetree.contentColor='006633';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Straight',
				paletteFamily: 	'336633',
				keyvisualId: 	'1546',
				keyvisualName: 	'freizeit.jpg',
				fontsetId: 		'26853',
				graphicsetId: 	'302',
				contentColor: 	'006633',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'336633',
				b_color: 		'D7D7D7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090828-203700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5601',
internalId:  '',
customField: '20090226-122344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5622',
internalId:  '',
customField: '20090226-122052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5643',
internalId:  '',
customField: '20090226-122144'
};
webappMappings['7008']=webappMappings['7008-158']={
webappId:    '7008',
documentId:  '5601',
internalId:  '158',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '179185',
internalId:  '',
customField: '20071028-184601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '179122',
internalId:  '',
customField: '20080120-183522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '179164',
internalId:  '',
customField: '20090226-122443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '179143',
internalId:  '',
customField: '20090226-122216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '179101',
internalId:  '',
customField: '20080325-123246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '181801',
internalId:  '',
customField: '20090226-122014'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '279501',
internalId:  '',
customField: '20090828-205511'
};
webappMappings['1501']=webappMappings['1501-15645011']={
webappId:    '1501',
documentId:  '401',
internalId:  '15645011',
customField: '1501'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10IN3XKM';
var companyName   = 'GAD%C5%BBETY+SPORTOWE%2C+GOLFOWE+I+DLA+KIBICA';
var htmlTitle	  = 'Gad%C5%BCety+Sportowe%2C+Gad%C5%BCety+na+Olimpiad%C4%99+i+Mistrzostawa%2C++Gad%C5%BCety+Pi%C5%82karskie%2C+futbolowe%2C+koszykarskie%2C+kibicowskie%2C+pa%C5%82eczki+d%C5%BAwi%C4%99kowe%3B+zwia%C5%BCane+z+koszyk%C3%B3wka+i+siatk%C3%B3wk%C4%85.+Warszawa';
var metaKeywords  = 'klaskacze%2C+pa%C5%82ki+d%C5%BAwi%C4%99kowe%2C+pa%C5%82eczki+kibica%2C+gad%C5%BCety+sportowe%2C+golfowe%2C+do+siatk%C3%B3wki%2C+koszyk%C3%B3wka%2C+pi%C5%82karskie%2C+pi%C5%82ka+no%C5%BCna%2C+futbolowe%2C+koszykarskie';
var metaContents  = 'Gad%C5%BCety+sportowe.+Gad%C5%BCety+mundialowe%2C+na+Olimpiad%C4%99%2C+pi%C5%82karskie%2C+golfowe%2C+zwi%C4%85zane+z+koszyk%C3%B3wk%C4%85%2C+kibicowskie.+Pa%C5%82ki+kibica+%28pa%C5%82eczki+d%C5%BAwi%C4%99kowe%29+klaskacze.+Breloki%2C+zawieszki%3A+pi%C5%82ka+no%C5%BCna%2C+koszyk%C3%B3wka%2C+siatk%C3%B3wka%2C+tenis%2C+rugby%2C+bilard.+Zegarki%2C+zegary%2C+pami%C4%99ci+USB+-+zwi%C4%85zane+z+tematyk%C4%85+sportow%C4%85.+Torby%2C+plecaki+sportowe+i+fitness.+W%C5%82asna+wzorcownia+w+Warszawie.';
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();
};

