/* [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','1001',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/1001.html','true',[],''],
	['PAGE','1073',jdecode('OFERTA'),jdecode(''),'/1073/index.html','true',[ 
		['PAGE','1094',jdecode('Pontony+rozk%C5%82adane+BRIG'),jdecode(''),'/1073/1094.html','true',[],''],
		['PAGE','1115',jdecode('%C5%81odzie+RIB+FALCON'),jdecode(''),'/1073/1115.html','true',[],''],
		['PAGE','1157',jdecode('%C5%81odzie+RIB+EAGLE'),jdecode(''),'/1073/1157.html','true',[],''],
		['PAGE','1136',jdecode('%C5%81odzie+RIB+GRAND+Silverline'),jdecode(''),'/1073/1136.html','true',[],'']
	],''],
	['PAGE','12001',jdecode('GALERIA+zdj%C4%99%C4%87+ponton%C3%B3w'),jdecode(''),'/12001.html','true',[],''],
	['PAGE','1178',jdecode('Linki'),jdecode(''),'/1178.html','true',[],''],
	['PAGE','1052',jdecode('Kontakt'),jdecode(''),'/1052.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Gaudy';
theSitetree.paletteFamily='5C5D96';
theSitetree.keyvisualId='5935';
theSitetree.keyvisualName='kv_5935.jpg';
theSitetree.fontsetId='27848';
theSitetree.graphicsetId='11905';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='6E8BCE';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Gaudy',
				paletteFamily: 	'5C5D96',
				keyvisualId: 	'5935',
				keyvisualName: 	'kv_5935.jpg',
				fontsetId: 		'27848',
				graphicsetId: 	'11905',
				contentColor: 	'FFFFFF',
				contentBGColor: '6E8BCE',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-48fa8c9e182d0bc204b13bddd817826e']={
webappId:    '7060',
documentId:  '12001',
internalId:  '48fa8c9e182d0bc204b13bddd817826e',
customField: 'language:pl;country:PL;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20090617-123504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20090617-132233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1178',
internalId:  '',
customField: '20080114-120500'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1052',
internalId:  '',
customField: '20080114-115939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12001',
internalId:  '',
customField: '20080114-120638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1094',
internalId:  '',
customField: '20070306-122533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1115',
internalId:  '',
customField: '20070306-122338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1157',
internalId:  '',
customField: '20070306-122653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1136',
internalId:  '',
customField: '20061007-105137'
};
webappMappings['1501']=webappMappings['1501-15527776']={
webappId:    '1501',
documentId:  '1001',
internalId:  '15527776',
customField: '1501'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10IN2GG4';
var companyName   = 'PONTONY.PL+';
var htmlTitle	  = 'PONTONY.PL+wszystko+o+pontonach+i+%C5%82odziach+hybrydowych+RIB+z+silnikami+zaburtowymi';
var metaKeywords  = 'ponton+%2C+pontony+%2C+nadmuchiwana+%2C+%C5%82%C3%B3d%C5%BA+%2C+motor%C3%B3wka+%2C+hybrydowa+%2C+RIB+%2C+%C5%82%C3%B3d%C5%BA+motorowa+%2C+silnik+przyczepny+%2C+silnik+zaburtowy+%2C+BRIG+%2C+GRAND+%2C+MARINE+%2C+HONDA+%2C+JOHNSON+%2C+EVINRUDE+%2C+TOHATSU+%2C+YAMAHA+%2C+MINNKOTA+%2C+';
var metaContents  = 'Pontony+w%C4%99dkarskie+BRIG+DINGO+%2C+BALTIC+%2C+%C5%82odzie+hybrydowe+pontonowe+RIB+BRIG+FALCON+%2C+EAGLE%2C+GRAND+SILVERLINE+%2C+silniki+elektryczne+%2C+silniki+zaburtowe+i+silniki+przyczepne+do+nap%C4%99du+ponton%C3%B3w+i+%C5%82odzi+motorowych+oraz+wyposa%C5%BCenie+%C5%82odzi+i+ponton%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();
};

