/* [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','701',jdecode('Home'),jdecode(''), jdecode('%2F701.html'), 'true',[],'',''],
	['PAGE','4401',jdecode('O+nas'),jdecode(''), jdecode('%2F4401.html'), 'true',[],'',''],
	['PAGE','4443',jdecode('Oferta'),jdecode(''), jdecode('%2F4443.html'), 'true',[],'',''],
	['PAGE','4464',jdecode('Cennik'),jdecode(''), jdecode('%2F4464.html'), 'true',[],'',''],
	['PAGE','4548',jdecode('Kontakt'),jdecode(''), jdecode('%2F4548.html'), 'true',[],'',''],
	['PAGE','4485',jdecode('Dla+turysty'),jdecode(''), jdecode('%2F4485.html'), 'true',[],'',''],
	['PAGE','4506',jdecode('Kursy'),jdecode(''), jdecode('%2F4506.html'), 'true',[],'',''],
	['PAGE','4569',jdecode('Lokalizacja+'),jdecode(''), jdecode('%2F4569.html'), 'true',[],'',''],
	['PAGE','4527',jdecode('Przepisy'),jdecode(''), jdecode('%2F4527.html'), 'true',[],'',''],
	['PAGE','20401',jdecode('Galeria'),jdecode(''), jdecode('%2F20401.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Seasons_fall';
theSitetree.paletteFamily='ECE1CC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='31550';
theSitetree.graphicsetId='13182';
theSitetree.contentColor='2E2E2E';
theSitetree.contentBGColor='ECE1CC';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var prodDef={
  wl_name: 'azpl',
  product: 'WSCSYSSSSLY0XKDP'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Seasons_fall',
				paletteFamily: 	'ECE1CC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'31550',
				graphicsetId: 	'13182',
				contentColor: 	'2E2E2E',
				contentBGColor: 'ECE1CC',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100915-163543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4464',
internalId:  '',
customField: '20110912-215954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4569',
internalId:  '',
customField: '20110912-225458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4527',
internalId:  '',
customField: '20110912-214804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4401',
internalId:  '',
customField: '20110912-220321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4443',
internalId:  '',
customField: '20090201-185151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4485',
internalId:  '',
customField: '20120126-114138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4548',
internalId:  '',
customField: '20110912-222243'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4506',
internalId:  '',
customField: '20090201-180710'
};
webappMappings['7060']=webappMappings['7060-120097ba1e88c048087fb269be2577ae']={
webappId:    '7060',
documentId:  '20401',
internalId:  '120097ba1e88c048087fb269be2577ae',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20090201-123633'
};
webappMappings['7008']=webappMappings['7008-3484']={
webappId:    '7008',
documentId:  '4548',
internalId:  '3484',
customField: 'language:pl;country:PL;'
};
var webAppHostname = 'cgi-kreatorstron.az.pl:80';
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN2P3D';
var companyName   = 'AGROTURYSTYKA+%22LESZCZYNOWA+DOLINA%22++';
var htmlTitle	  = 'Agroturystyka+z+wegetaria%C5%84skim+wy%C5%BCywieniem';
var metaKeywords  = 'agroturystyka%2C+wegetarianizm%2C+zdrowe+%C5%BCywienie%2C+ekologia%2C+vege%2C+turystyka%2C+eko-turystyka%2C+kursy+gotowania%2C+5+Przemian%2C+zio%C5%82a%2C+makrobiotyka%2C+Beskid+Niski%2C+wczasy+z+dzie%C4%87mi%2C+wypoczynek+na+wsi%2C+gospodarstwo+agroturystyczne%2C+agroturystyka+ma%C5%82opolska%2C+domek+do+wynaj%C4%99cia%2C+sad+leszczynowy%2C+cisza+i+spok%C3%B3j%2C+vege+kuchnia%2C+agrowczasy%2C+';
var metaContents  = 'Ekologiczne+gospodarstwo+zaprasza+na+wegetaria%C5%84skie+wczasy';
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();
};

