/* [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','6201',jdecode('Strona+g%C5%82%C3%B3wna'),jdecode(''),'/6201.html','true',[],'',''],
	['PAGE','6315',jdecode('Polecamy'),jdecode(''),'/6315.html','true',[],'',''],
	['PAGE','6357',jdecode('Specjalno%C5%9B%C4%87'),jdecode(''),'/6357.html','true',[],'',''],
	['PAGE','26129',jdecode('Nasze+propozycje'),jdecode(''),'/26129.html','true',[],'',''],
	['PAGE','8101',jdecode('Foto+Galeria'),jdecode(''),'/8101.html','true',[],'',''],
	['PAGE','6399',jdecode('Kontakt'),jdecode(''),'/6399.html','true',[],'',''],
	['PAGE','28129',jdecode('Napisz+do+nas'),jdecode(''),'/28129.html','true',[],'',''],
	['PAGE','30129',jdecode('Zobacz+...'),jdecode(''),'/30129.html','true',[],'',''],
	['PAGE','28150',jdecode('Ksi%C4%99ga+Go%C5%9Bci'),jdecode(''),'/28150.html','true',[],'',''],
	['PAGE','51982',jdecode('Wyszukaj+...'),jdecode(''),'/51982.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='BB9C60';
theSitetree.keyvisualId='2225';
theSitetree.keyvisualName='hochzeit1.jpg';
theSitetree.fontsetId='28974';
theSitetree.graphicsetId='417';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='BB9C60';
var localeDef={
  language: 'pl',
  country: 'PL'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Enjoy',
				paletteFamily: 	'BB9C60',
				keyvisualId: 	'2225',
				keyvisualName: 	'hochzeit1.jpg',
				fontsetId: 		'28974',
				graphicsetId: 	'417',
				contentColor: 	'FFFFFF',
				contentBGColor: 'BB9C60',
				a_color: 		'BB9C60',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				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:  '6201',
internalId:  '',
customField: '20101223-160907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6315',
internalId:  '',
customField: '20090611-192707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6357',
internalId:  '',
customField: '20090628-151855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20090611-201112'
};
webappMappings['7060']=webappMappings['7060-04087f398b70a96ac1490d7a3a141c9d']={
webappId:    '7060',
documentId:  '8101',
internalId:  '04087f398b70a96ac1490d7a3a141c9d',
customField: 'language:pl;country:PL;'
};
webappMappings['1501']=webappMappings['1501-10090708']={
webappId:    '1501',
documentId:  '6201',
internalId:  '10090708',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6399',
internalId:  '',
customField: '20090705-190039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26129',
internalId:  '',
customField: '20090611-193100'
};
webappMappings['7008']=webappMappings['7008-3443']={
webappId:    '7008',
documentId:  '28129',
internalId:  '3443',
customField: 'language:pl;country:PL;'
};
webappMappings['1002']=webappMappings['1002-28150ahpl10infmaa']={
webappId:    '1002',
documentId:  '28150',
internalId:  '28150ahpl10infmaa',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28129',
internalId:  '',
customField: '20090530-172815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28150',
internalId:  '',
customField: '20090530-172729'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '51982',
internalId:  'search',
customField: 'language:pl;country:PL;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30129',
internalId:  '',
customField: '20101127-214850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51982',
internalId:  '',
customField: '20090628-153853'
};
var canonHostname = 'wsc0.home.net.pl';
var accountId     = 'AHPL10INFMAA';
var companyName   = 'Restauracja+%22Cafe+Wiede%C5%84ska%22+J.+W.+Mi%C5%9B+';
var htmlTitle	  = 'Restauracja+%22Cafe+Wiede%C5%84ska%22+J.+W.+Mi%C5%9B+-+%C5%81%C3%B3d%C5%BC%2C+Plac+Wolno%C5%9Bci+6';
var metaKeywords  = 'restauracja%2C+cafe%2C+wiede%C5%84ska+%2C+kawiarnia%2C+posi%C5%82ki%2C+napoje%2C+wesela%2C+uroczysto%C5%9Bci+rodzinne+i+okazjonalne%2C+bankiety%2C+przyj%C4%99cia+komunijne%2C+zestawy+obiadowe%2C+catering%2C+restauracja+braci+Mi%C5%9B%2C+specja%C5%82y+kuchni+mi%C4%99dzynarodowej%2C+wspania%C5%82e+ciasta%2C+drinki%2C+kawa%2C+napoje+alkoholowe';
var metaContents  = 'Strona+internetowa+Restauracji+Cafe+Wiede%C5%84ska+J.+W.+Mi%C5%9B++-+%C5%81%C3%B3d%C5%BC%2C+Plac+Wolno%C5%9Bci+6.+Oferujemy%3A+smaczna+dania+i+napoje%2C+bankiety%2C+wesela%2C+studni%C3%B3wki%2C+przyj%C4%99cia+komunijne%2C+imprezy+rodzinne+i+okoliczno%C5%9Bciowe%2C+us%C5%82ugi+dostawczo-cateringowe.+U+nas+zawsze+smacznie%2C+mi%C5%82o+i+sympatycznie...';
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();
};

