/* [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','820',jdecode('SPECJALISTYCZNE'),jdecode(''),'/820.html','true',[],'',''],
	['PAGE','799',jdecode('UTRZYMANIE+PORZ%C4%84DKU'),jdecode(''),'/799.html','true',[],'',''],
	['PAGE','42301',jdecode('POBUDOWLANE'),jdecode(''),'/42301.html','true',[],'',''],
	['PAGE','673',jdecode('KONTAKT'),jdecode(''),'/673.html','true',[],'',''],
	['PAGE','736',jdecode('CENNIK'),jdecode(''),'/736.html','true',[],'',''],
	['PAGE','694',jdecode('ZAKRES-WIZYT%C3%93WKA'),jdecode(''),'/694.html','true',[],'',''],
	['PAGE','601',jdecode('HOME'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','21001',jdecode('ZDJ%C4%98CIA-REFERENCJE'),jdecode(''),'/21001.html','true',[],'',''],
	['PAGE','56801',jdecode('WSP%C3%93%C5%81PRACA'),jdecode(''),'/56801.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='A3CAFE';
theSitetree.keyvisualId='807';
theSitetree.keyvisualName='astern.jpg';
theSitetree.fontsetId='28583';
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: 		'28583',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20101114-212748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42301',
internalId:  '',
customField: '20101107-224356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20101107-224449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '694',
internalId:  '',
customField: '20101110-144946'
};
webappMappings['7008']=webappMappings['7008-458']={
webappId:    '7008',
documentId:  '42301',
internalId:  '458',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '736',
internalId:  '',
customField: '20101114-222355'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '820',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '799',
internalId:  '',
customField: '20101107-224258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '820',
internalId:  '',
customField: '20101114-222734'
};
webappMappings['7008']=webappMappings['7008-459']={
webappId:    '7008',
documentId:  '799',
internalId:  '459',
customField: 'language:pl;country:PL;'
};
webappMappings['7060']=webappMappings['7060-4d44010653c4a772900fe2da6c1eb692']={
webappId:    '7060',
documentId:  '21001',
internalId:  '4d44010653c4a772900fe2da6c1eb692',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21001',
internalId:  '',
customField: '20101110-145026'
};
webappMappings['7008']=webappMappings['7008-460']={
webappId:    '7008',
documentId:  '694',
internalId:  '460',
customField: 'language:pl;country:PL;'
};
webappMappings['7008']=webappMappings['7008-461']={
webappId:    '7008',
documentId:  '601',
internalId:  '461',
customField: 'language:pl;country:PL;'
};
webappMappings['7008']=webappMappings['7008-463']={
webappId:    '7008',
documentId:  '673',
internalId:  '463',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56801',
internalId:  '',
customField: '20101107-224842'
};
webappMappings['7008']=webappMappings['7008-464']={
webappId:    '7008',
documentId:  '820',
internalId:  '464',
customField: 'language:pl;country:PL;'
};
webappMappings['7008']=webappMappings['7008-465']={
webappId:    '7008',
documentId:  '56801',
internalId:  '465',
customField: 'language:pl;country:PL;'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '820',
internalId:  '1501',
customField: '1501'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10INEEPC';
var companyName   = 'PUP+I+PWI+%22SPECDAR%22+-+DARIUSZ+MUCHA';
var htmlTitle	  = 'SPECDAR+-+CZYSTO%C5%9A%C4%86+I+PORZ%C4%84DEK';
var metaKeywords  = '+sprz%C4%85tanie+sprzatanie+us%C5%82uga+porz%C4%85dek+gda%C5%84sk+biuro+budowa+remont+';
var metaContents  = 'sprz%C4%85tanie+sprzatanie+us%C5%82uga+porz%C4%85dek+gda%C5%84sk+biuro+budowa+remont+';
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();
};

