/* [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','4601',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/4601.html','true',[],''],
	['PAGE','4652',jdecode('O+nas'),jdecode(''),'/4652.html','true',[],''],
	['PAGE','4673',jdecode('Transport+samochodowy'),jdecode(''),'/4673.html','true',[],''],
	['PAGE','4694',jdecode('Transport+kolejowy'),jdecode(''),'/4694.html','true',[],''],
	['PAGE','4736',jdecode('Formularz+kontaktowy'),jdecode(''),'/4736.html','true',[],''],
	['PAGE','4715',jdecode('Kontakt'),jdecode(''),'/4715.html','true',[],''],
	['PAGE','7701',jdecode('Imprint'),jdecode(''),'/7701.html','false',[],''],
	['PAGE','8101',jdecode('Lista+link%C3%B3w'),jdecode(''),'/8101.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Straight';
theSitetree.paletteFamily='330066';
theSitetree.keyvisualId='1534';
theSitetree.keyvisualName='transport.jpg';
theSitetree.fontsetId='26853';
theSitetree.graphicsetId='301';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Straight',
				paletteFamily: 	'330066',
				keyvisualId: 	'1534',
				keyvisualName: 	'transport.jpg',
				fontsetId: 		'26853',
				graphicsetId: 	'301',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003366',
				b_color: 		'D7D7D7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				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:  '4601',
internalId:  '',
customField: '20100112-111609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4652',
internalId:  '',
customField: '20100107-133408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4673',
internalId:  '',
customField: '20100107-175208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4694',
internalId:  '',
customField: '20100110-152622'
};
webappMappings['7008']=webappMappings['7008-4943']={
webappId:    '7008',
documentId:  '4736',
internalId:  '4943',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4736',
internalId:  '',
customField: '20100107-142724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4715',
internalId:  '',
customField: '20100112-111702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7701',
internalId:  '',
customField: '20100108-102254'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4601',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4652',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4673',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4694',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4736',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4715',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7701',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20100108-184922'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8101',
internalId:  '',
customField: 'language:pl;country:PL;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4601',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN3QYK';
var companyName   = '';
var htmlTitle	  = 'Manage+Log+s.r.o.';
var metaKeywords  = 'spedycja+samochodowa%2C+spedycja%2C+spedycja+kolejowa%2C+transport%2C+transport+samochodowy%2C+ca%C5%82opojazdowy%2C+ca%C5%82opoci%C4%85gowy%2C+mi%C4%99dzynarodowy%2C+transport+mi%C4%99dzynarodowy%2C+mi%C4%99dzynarodowy+transport++samochodowy%2C+drobnicowy%2C+specjalny%2C+drogowy%2C+przew%C3%B3z%2C+Europa%2C+kraje+WNP%2C+Polska%2C+Niemcy%2C+S%C5%82owacja%2C+Czechy';
var metaContents  = 'spedycja+samochodowa%2C+spedycja%2C+spedycja+kolejowa%2C+transport%2C+transport+samochodowy%2C+ca%C5%82opojazdowy%2C+ca%C5%82opoci%C4%85gowy%2C+mi%C4%99dzynarodowy%2C+transport+mi%C4%99dzynarodowy%2C+mi%C4%99dzynarodowy+transport++samochodowy%2C+drobnicowy%2C+specjalny%2C+drogowy%2C+przew%C3%B3z%2C+Europa%2C+kraje+WNP%2C+Polska%2C+Niemcy%2C+S%C5%82owacja%2C+Czechy';
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();
};

