/* [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','5301',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/5301.html','true',[],'',''],
	['PAGE','5352',jdecode('Us%C5%82ugi'),jdecode(''),'/5352.html','true',[],'',''],
	['PAGE','5373',jdecode('Kontakt'),jdecode(''),'/5373.html','true',[],'',''],
	['PAGE','5394',jdecode('O+nas'),jdecode(''),'/5394/index.html','true',[ 
		['PAGE','5415',jdecode('Nasz+zesp%C3%B3%C5%82'),jdecode(''),'/5394/5415.html','true',[],'',''],
		['PAGE','5436',jdecode('Jak+do+nas+trafi%C4%87'),jdecode(''),'/5394/5436.html','true',[],'','']
	],'',''],
	['PAGE','5457',jdecode('Aktualno%C5%9Bci'),jdecode(''),'/5457.html','true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='A3CAFE';
theSitetree.keyvisualId='807';
theSitetree.keyvisualName='astern.jpg';
theSitetree.fontsetId='26773';
theSitetree.graphicsetId='161';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Metal',
				paletteFamily: 	'A3CAFE',
				keyvisualId: 	'807',
				keyvisualName: 	'astern.jpg',
				fontsetId: 		'26773',
				graphicsetId: 	'161',
				contentColor: 	'DDDDDD',
				contentBGColor: '000000',
				a_color: 		'A3CAFE',
				b_color: 		'87A7D2',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20110417-081643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5352',
internalId:  '',
customField: '20110417-082216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5373',
internalId:  '',
customField: '20110417-082731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5394',
internalId:  '',
customField: '20110417-082803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5415',
internalId:  '',
customField: '20110417-082821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5436',
internalId:  '',
customField: '20110410-090554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5457',
internalId:  '',
customField: '20110410-092140'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-2786222']={
webappId:    '1501',
documentId:  '5301',
internalId:  '2786222',
customField: '1501'
};
var canonHostname = 'kreator.domeny.pl';
var accountId     = 'ADOM10IN2KFP';
var companyName   = 'AGRO+Doradztwo+-+wnioski+o+dotacje';
var htmlTitle	  = 'AGRO+Doradztwo+-+wnioski+o+dotacje+z+Unii+Europejskiej+dla+rolnik%C3%B3w+i+firm';
var metaKeywords  = 'agrodoradztwo%2C+agro+doradztwo%2C+wnioski+dla+rolnik%C3%B3w%2C+wnioski+unijne%2C+wnioski+PROW+2007-2013%2C+wnioski+modernizacja%2C+wnioski+r%C3%B3%C5%BCnicowanie%2C+wnioski+mikroprzedsi%C4%99biorstwa%2C+wnioski+o+dotacje%2C+wnioski+dla+firm%2C+PROW%2C+PROW+2007-2013%2C+S%C5%82awomir+Gutkowski%2C+Gutkowski%2C+dofinansowanie+PROW%2C+maszyny+rolnicze%2C+dop%C5%82aty+bezpo%C5%9Brednie%2C+wype%C5%82nianie+wniosk%C3%B3w+PROW%2C+fundusze+unijne%2C+wype%C5%82nianie+wniosk%C3%B3w+I%C5%82owo%2C+wype%C5%82nianie+wniosk%C3%B3w+Dzia%C5%82dowo%2C+wype%C5%82nianie+wniosk%C3%B3w+M%C5%82awa%2C+dotacje+unijne%2C+dop%C5%82aty+unijne%2C+ARiMR%2C+fundusze+dla+rolnik%C3%B3w%2C+wnioski+na+agroturystyk%C4%99%2C+agroturystyka+dotacje%2C+dotacje+agroturystyka';
var metaContents  = 'agrodoradztwo%2C+agro+doradztwo%2C+wnioski+dla+rolnik%C3%B3w%2C+wnioski+unijne%2C+wnioski+PROW+2007-2013%2C+wnioski+modernizacja%2C+wnioski+r%C3%B3%C5%BCnicowanie%2C+wnioski+mikroprzedsi%C4%99biorstwa%2C+wnioski+o+dotacje%2C+wnioski+dla+firm%2C+PROW%2C+PROW+2007-2013%2C+S%C5%82awomir+Gutkowski%2C+Gutkowski%2C+dofinansowanie+PROW%2C+maszyny+rolnicze%2C+dop%C5%82aty+bezpo%C5%9Brednie%2C+wype%C5%82nianie+wniosk%C3%B3w+PROW%2C+fundusze+unijne%2C+wype%C5%82nianie+wniosk%C3%B3w+I%C5%82owo%2C+wype%C5%82nianie+wniosk%C3%B3w+Dzia%C5%82dowo%2C+wype%C5%82nianie+wniosk%C3%B3w+M%C5%82awa%2C+dotacje+unijne%2C+dop%C5%82aty+unijne%2C+ARiMR%2C+fundusze+dla+rolnik%C3%B3w%2C+wnioski+na+agroturystyk%C4%99%2C+agroturystyka+dotacje%2C+dotacje+agroturystyka';
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();
};

