/* [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','5001',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','10301',jdecode('Zakres+dzia%C5%82alno%C5%9Bci'),jdecode(''),'/10301/index.html','true',[ 
		['PAGE','10322',jdecode('Maszyny+i+urz%C4%85dzenia'),jdecode(''),'/10301/10322.html','true',[],''],
		['PAGE','10343',jdecode('Hydraulika+si%C5%82owa'),jdecode(''),'/10301/10343.html','true',[],''],
		['PAGE','10364',jdecode('Konstrukcje+stalowe'),jdecode(''),'/10301/10364.html','true',[],''],
		['PAGE','10385',jdecode('Konstrukcje+okr%C4%99towe'),jdecode(''),'/10301/10385.html','true',[],'']
	],''],
	['PAGE','10406',jdecode('Kontakt'),jdecode(''),'/10406.html','true',[],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Struktur';
theSitetree.paletteFamily='B2CCFF';
theSitetree.keyvisualId='1890';
theSitetree.keyvisualName='industrie2.jpg';
theSitetree.fontsetId='26908';
theSitetree.graphicsetId='357';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='488AF0';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Struktur',
				paletteFamily: 	'B2CCFF',
				keyvisualId: 	'1890',
				keyvisualName: 	'industrie2.jpg',
				fontsetId: 		'26908',
				graphicsetId: 	'357',
				contentColor: 	'000000',
				contentBGColor: '488AF0',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'B2CCFF',
				b_color: 		'488AF0',
				c_color: 		'94B7FF',
				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:  '5001',
internalId:  '',
customField: '20100802-205853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20100802-205733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10343',
internalId:  '',
customField: '20100802-203214'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10322',
internalId:  '',
customField: '20100802-203458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10364',
internalId:  '',
customField: '20100802-203843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10385',
internalId:  '',
customField: '20100131-220159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10406',
internalId:  '',
customField: '20100802-205937'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010INEBXX';
var companyName   = '++++Mechanical-Project';
var htmlTitle	  = 'Biuro+projektowe%2C+mechanika+maszyn%2C+hydraulika+si%C5%82owa%2C+konstrukcje+stalowe';
var metaKeywords  = 'hydraulika+si%C5%82owa%2C+agregaty+hydrauliczne%2C+Barierki%2C+d%C5%BAwignice%2C+Elektrozawory%2C+Filtry%2C+Fundamenty%2C+konstrukcje+stalowe%2C+maszyny%2C+Nap%C4%99dy+Hydrauliczne%2C+podno%C5%9Bniki%2C+Prasy+hydrauliczne%2C+Projektowanie%2C+przek%C5%82adnie+mechaniczne%2C+przeno%C5%9Bniki%2C+rampy+%C5%82adunkowe%2C+Rozdzielacze%2C+Schody%2C+Si%C5%82owniki+Hydrauliczne%2C+t%C5%82oczniki%2C+Wci%C4%85garki%2C+maszyny%2C+stal%2C+zawory%2C+cylindry+hydrauliczne%2C+offshore%2C+statek%2C+kotwica%2C+cumownicze%2C+CAD%2C+pompy%2C+suwnica';
var metaContents  = 'Projektowanie+maszyn+i+urz%C4%85dze%C5%84%2C+instalacji+hydrauliki+si%C5%82owej%2C+konstrukcji+stalowych+i+aluminiowych.+Doradztwo+techniczne.';
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();
};
