/* [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','2801',jdecode('O+nas'),jdecode(''),'/2801/index.html','true',[ 
		['PAGE','2852',jdecode('Rolety'),jdecode(''),'/2801/2852.html','true',[],''],
		['PAGE','4001',jdecode('%C5%BBaluzje'),jdecode(''),'/2801/4001.html','true',[],''],
		['PAGE','4022',jdecode('Markizy'),jdecode(''),'/2801/4022.html','true',[],''],
		['PAGE','4043',jdecode('Moskitiery'),jdecode(''),'/2801/4043.html','true',[],''],
		['PAGE','7101',jdecode('Plisy'),jdecode(''),'/2801/7101.html','true',[],'']
	],''],
	['PAGE','2901',jdecode('Kontakt'),jdecode(''),'/2901.html','true',[],''],
	['PAGE','2922',jdecode('Formularz'),jdecode(''),'/2922.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Vienna';
theSitetree.paletteFamily='D6D2C5';
theSitetree.keyvisualId='11891';
theSitetree.keyvisualName='kv_11891.jpg';
theSitetree.fontsetId='35995';
theSitetree.graphicsetId='14088';
theSitetree.contentColor='696146';
theSitetree.contentBGColor='ebe8df';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				name: 			'Vienna',
				paletteFamily: 	'D6D2C5',
				keyvisualId: 	'11891',
				keyvisualName: 	'kv_11891.jpg',
				fontsetId: 		'35995',
				graphicsetId: 	'14088',
				contentColor: 	'696146',
				contentBGColor: 'ebe8df',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'EBE8DF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20100310-115426'
};
webappMappings['7008']=webappMappings['7008-5346']={
webappId:    '7008',
documentId:  '2922',
internalId:  '5346',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20100312-125451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2922',
internalId:  '',
customField: '20100204-101120'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20100310-111258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2852',
internalId:  '',
customField: '20100312-130845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4022',
internalId:  '',
customField: '20100310-113829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4043',
internalId:  '',
customField: '20100310-113456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20100312-130337'
};
var canonHostname = 'cm4all.az.pl';
var accountId     = 'AAZ010IN3GI2';
var companyName   = 'Tempo+Robert+Kuwa%C5%82ek';
var htmlTitle	  = 'Tempo+Robert+Kuwa%C5%82ek+-+rolety%2C+%C5%BCaluzje%2C+moskitiery%2C+verticale%2C+markizy';
var metaKeywords  = 'rolety%2C+%C5%BCaluzje%2C+rolety+wewn%C4%99trzne%2C+rolety+zewn%C4%99trzne%2C+rolety+materia%C5%82owe%2C+rolety+na+prowadnicach%2C+rolety+wewn%C4%99trzne+materia%C5%82owe+w+kasetach+z+prowadnicami%2C+rolety+austriackie%2C+rolety+rzymskie%2C+%C5%BCaluzje+poziome%2C+%C5%BCaluzje+pionowe%2C+%C5%BCaluzje+drewniane%2C+verticale%2C+markizy%2C+moskitiery%2C+Wa%C5%82brzych%2C+dolno%C5%9Bl%C4%85skie';
var metaContents  = 'Firma+TEMPO+istnieje+na+rynku+od+25+lat.+Zajmujemy+si%C4%99+produkcj%C4%85+rolet+materia%C5%82owych+w+kasetach+z+prowadnicami+oraz+produkcj%C4%85+%C5%BCaluzji+pionowych.+Dodatkowo+oferujemy+sprzeda%C5%BC+oraz+monta%C5%BC+rolet+wewn%C4%99trznych%2C+zewn%C4%99trznych%2C+%C5%BCaluzji%2C+markiz%2C+veticali%2C+moskitier+oraz+czyszczenie+%C5%BCaluzji.';
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();
};

