/* [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','401',jdecode('strona+g%C5%82owna'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','18464',jdecode('przegrody+samochodowe'),jdecode(''),'/18464.html','true',[],'',''],
	['PAGE','29301',jdecode('zabudowy+nadwozi'),jdecode(''),'/29301.html','true',[],'',''],
	['PAGE','18401',jdecode('wyroby+metalowe'),jdecode(''),'/18401.html','true',[],'',''],
	['PAGE','18422',jdecode('artyku%C5%82y+reklamowe'),jdecode(''),'/18422.html','true',[],'',''],
	['PAGE','18485',jdecode('lakierowanie+proszkowe'),jdecode(''),'/18485.html','true',[],'',''],
	['PAGE','18506',jdecode('nasi+klienci'),jdecode(''),'/18506.html','true',[],'',''],
	['PAGE','26001',jdecode('galeria+wyrob%C3%B3w'),jdecode(''),'/26001.html','true',[],'',''],
	['PAGE','536',jdecode('kontakt'),jdecode(''),'/536.html','true',[],'',''],
	['PAGE','18527',jdecode('jak+do+nas+trafi%C4%87'),jdecode(''),'/18527.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='F8F2E6';
theSitetree.keyvisualId='2168';
theSitetree.keyvisualName='industrie.jpg';
theSitetree.fontsetId='26960';
theSitetree.graphicsetId='410';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F8F2E6';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'F8F2E6',
				keyvisualId: 	'2168',
				keyvisualName: 	'industrie.jpg',
				fontsetId: 		'26960',
				graphicsetId: 	'410',
				contentColor: 	'000000',
				contentBGColor: 'F8F2E6',
				a_color: 		'F8F2E6',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				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:  '401',
internalId:  '',
customField: '20081230-141937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20090714-213808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18422',
internalId:  '',
customField: '20081230-151700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20090714-213524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29301',
internalId:  '',
customField: '20081231-124620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18464',
internalId:  '',
customField: '20081231-125412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18485',
internalId:  '',
customField: '20090714-213734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18506',
internalId:  '',
customField: '20081230-151203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18527',
internalId:  '',
customField: '20090714-225324'
};
webappMappings['7008']=webappMappings['7008-1885']={
webappId:    '7008',
documentId:  '536',
internalId:  '1885',
customField: 'language:pl;country:PL;'
};
webappMappings['7060']=webappMappings['7060-619f11a656e16303167e2902f1132503']={
webappId:    '7060',
documentId:  '26001',
internalId:  '619f11a656e16303167e2902f1132503',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20080112-175321'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10INV0FZ';
var companyName   = '++++++++++++++artyku%C5%82y+metalowe+++++++lakierowanie+proszkowe';
var htmlTitle	  = '';
var metaKeywords  = 'wyroby+z+drutu%2C+lakierowanie+proszkowe%2C+produkcja+artyku%C5%82%C3%B3w+metalowych%2C+p%C3%B3%C5%82ki%2C+rega%C5%82y%2C+artyku%C5%82y+reklamowe%2C+przegrody+baga%C5%BCowe%2C+kratki+baga%C5%BCowe%2C+kratki+do+samochod%C3%B3w%2C+przegrody+do+samochod%C3%B3w';
var metaContents  = '';
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();
};

