/* [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','4701',jdecode('O+firmie'),jdecode(''),'/4701.html','true',[],'',''],
	['PAGE','5201',jdecode('Sauny'),jdecode(''),'/5201/index.html','true',[ 
		['PAGE','6801',jdecode('Sauny+tradycyjne'),jdecode(''),'/5201/6801.html','true',[],'',''],
		['PAGE','11101',jdecode('Sauny+Infrared'),jdecode(''),'/5201/11101.html','true',[],'',''],
		['PAGE','6822',jdecode('Akcesoria'),jdecode(''),'/5201/6822.html','true',[],'','']
	],'',''],
	['PAGE','4752',jdecode('Wyroby+ogrodowe'),jdecode(''),'/4752.html','true',[],'',''],
	['PAGE','16612',jdecode('%C5%9Awiat+soli'),jdecode(''),'/16612.html','true',[],'',''],
	['PAGE','21112',jdecode('Wanny+SPA'),jdecode(''),'/21112.html','true',[],'',''],
	['PAGE','14112',jdecode('e-Sklep'),jdecode(''),'/14112.html','true',[],'',''],
	['PAGE','4899',jdecode('Kontakt'),jdecode(''),'/4899.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='86862D';
theSitetree.keyvisualId='957';
theSitetree.keyvisualName='gruss.jpg';
theSitetree.fontsetId='26793';
theSitetree.graphicsetId='196';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'86862D',
				keyvisualId: 	'957',
				keyvisualName: 	'gruss.jpg',
				fontsetId: 		'26793',
				graphicsetId: 	'196',
				contentColor: 	'666666',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'86862D',
				c_color: 		'000000',
				d_color: 		'2C331B',
				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:  '4701',
internalId:  '',
customField: '20090630-111723'
};
webappMappings['1501']=webappMappings['1501-9686828']={
webappId:    '1501',
documentId:  '4701',
internalId:  '9686828',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20090514-154917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4752',
internalId:  '',
customField: '20090520-105911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21112',
internalId:  '',
customField: '20090529-002420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14112',
internalId:  '',
customField: '20090607-121204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20090514-193636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6822',
internalId:  '',
customField: '20090514-183456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16612',
internalId:  '',
customField: '20090519-103337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20090522-224336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4899',
internalId:  '',
customField: '20090630-111844'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INFKSF';
var companyName   = 'Sauna+Wellness+SPA';
var htmlTitle	  = 'sauny%2C+SPA%2C+jaskinie+solne%2C+meble+ogrodowe%2C+altany%2C+baseny%2C+producent';
var metaKeywords  = 'baseny%2C+baseny+producent%2C+baseny+radom%2C+beczka+polska%2C+beczki%2C+beczki+producent%2C+jakuzzi%2C+kabiny+ciep%C5%82a%2C+minibaseny%2C+producent+basen%C3%B3w%2C+producent+beczek%2C+producent+saun%2C+ruska+bania%2C+sauna%2C+sauna+fi%C5%84ska%2C+sauna+producent%2C+sauna+sucha%2C+sauny%2C+sauny+fi%C5%84skie%2C+sauny+fi%C5%84skie+producent%2C+sauny+kielce%2C+sauny+mazowieckie%2C+sauny+parowe%2C+sauny+producent%2C+sauny+radom%2C+sauny+suche%2C+sauny+Warszawa%2C+sauny+zewn%C4%99trzne%2C+wanny+spa%2C+wanny+z+hydromasa%C5%BCem%2C+tanie+sauny%2C+altany%2C+altanki%2C+meble+ogrodowe%2C+domki+ogrodowe%2C+sauny+warszawa';
var metaContents  = 'Sauny+fi%C5%84skie%2C+kabiny+infrared%2C+baseny%2C+wanny+SPA%2C+jaskinie+i+groty+solne%2C+altany%2C+meble+ogrodowe.+Produkcja+i+monta%C5%BC+w+ca%C5%82ym+kraju.+Indywidualne+projekty.';
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();
};

