/* [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','8901',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/8901.html','true',[],'',''],
	['PAGE','8952',jdecode('O+nas'),jdecode(''),'/8952/index.html','true',[ 
		['PAGE','11201',jdecode('Certyfikaty+i+uprawnienia'),jdecode(''),'/8952/11201.html','true',[],'',''],
		['PAGE','11222',jdecode('Referencje'),jdecode(''),'/8952/11222.html','false',[],'','']
	],'',''],
	['PAGE','8973',jdecode('Us%C5%82ugi'),jdecode(''),'/8973/index.html','true',[ 
		['PAGE','8994',jdecode('Finanse'),jdecode(''),'/8973/8994.html','true',[],'',''],
		['PAGE','9015',jdecode('Ochrona+%C5%9Arodowiska'),jdecode(''),'/8973/9015.html','true',[],'',''],
		['PAGE','9036',jdecode('Inwestycje'),jdecode(''),'/8973/9036.html','true',[],'',''],
		['PAGE','9057',jdecode('Szkolenia'),jdecode(''),'/8973/9057.html','true',[],'','']
	],'',''],
	['PAGE','9078',jdecode('Kontakt'),jdecode(''),'/9078.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Layers';
theSitetree.paletteFamily='3FD2D2';
theSitetree.keyvisualId='676';
theSitetree.keyvisualName='deadline.jpg';
theSitetree.fontsetId='26765';
theSitetree.graphicsetId='147';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='EBF0F0';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Layers',
				paletteFamily: 	'3FD2D2',
				keyvisualId: 	'676',
				keyvisualName: 	'deadline.jpg',
				fontsetId: 		'26765',
				graphicsetId: 	'147',
				contentColor: 	'000000',
				contentBGColor: 'EBF0F0',
				a_color: 		'669999',
				b_color: 		'C1E0DA',
				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:  '8901',
internalId:  '',
customField: '20100929-094406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8952',
internalId:  '',
customField: '20100111-214324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8973',
internalId:  '',
customField: '20091009-214900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9078',
internalId:  '',
customField: '20090826-233105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8994',
internalId:  '',
customField: '20091009-215113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20090826-222534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9015',
internalId:  '',
customField: '20100929-100653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9036',
internalId:  '',
customField: '20100929-100404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9057',
internalId:  '',
customField: '20091009-215805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11222',
internalId:  '',
customField: '20090826-220540'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8901',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8952',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '11201',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '11222',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8973',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8994',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9015',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9036',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9057',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9078',
internalId:  '',
customField: 'language:pl;country:PL;'
};
var canonHostname = 'wsc2.home.net.pl';
var accountId     = 'AHPL10INFU33';
var companyName   = 'BEF+Consulting+S.C.+';
var htmlTitle	  = 'BEF+Consulting+S.C.+-+Business+Environment+Finance';
var metaKeywords  = 'bef+consulting%2C+ocena+oddzia%C5%82ywania+na+%C5%9Brodowisko%2C+pozwolenie+wodnoprawne%2C+raport+oddzia%C5%82ywania+na+%C5%9Brodowisko%2C+pozwolenie+zintegrowane%2C+operat+wodnoprawny%2C+op%C5%82aty+%C5%9Brodowiskowe%2C+program+ochrony+%C5%9Brodowiska%2C+dolno%C5%9Bl%C4%85skie%2C+wojew%C3%B3dztwo+dolno%C5%9Bl%C4%85skie%2C+wroc%C5%82aw%2C+wa%C5%82brzych%2C+lean+six+sigma%2C+bpms%2C+business+process+management+system%2C+six+sigma%2C+lean%2C+doradctwo';
var metaContents  = 'BEF+Consulting+jest+wsparciem+dla+podmiot%C3%B3w+prowadz%C4%85cych+r%C3%B3%C5%BCnego+rodzaju+inwestycje+przy+kt%C3%B3rych+wymagane+jest+pozwolenie+zintegrowane%2C+pozwolenie+na+korzystanie+ze+%C5%9Brodowiska+w+zakresie+gospodarki+wodno%C5%9Bciekowej%2C+powietrza+i+odpad%C3%B3w.Dostarczamy+profesjonalne+analizy%2C+studia+wykonalno%C5%9Bci+i+raporty+oddzia%C5%82ywania+inwestycji+na+%C5%9Brodowisko.';
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();
};

