/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','552',jdecode('Kontakt'),jdecode(''),'/552.html','true',[],'',''],
	['PAGE','2106',jdecode('Knjiga+gostiju'),jdecode(''),'/2106/index.html','true',[ 
		['PAGE','2101',jdecode('upisi'),jdecode(''),'/2106/2101.html','false',[],'','']
	],'',''],
	['PAGE','14001',jdecode('Forum'),jdecode(''),'/14001.html','true',[],'',''],
	['PAGE','22901',jdecode('Album'),jdecode(''),'/22901.html','true',[],'',''],
	['PAGE','24901',jdecode('Linkovi'),jdecode(''),'/24901/index.html','true',[ 
		['PAGE','24922',jdecode('link+formular'),jdecode(''),'/24901/24922.html','true',[],'','']
	],'',''],
	['PAGE','29701',jdecode('Adresar'),jdecode(''),'/29701/index.html','true',[ 
		['PAGE','29101',jdecode('adresar+formular'),jdecode(''),'/29701/29101.html','true',[],'','']
	],'',''],
	['PAGE','59201',jdecode('Turnir+formular'),jdecode(''),'/59201.html','true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Delta';
theSitetree.paletteFamily='080245';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10440';
theSitetree.graphicsetId='10811';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='080245';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Delta',
				paletteFamily: 	'080245',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10440',
				graphicsetId: 	'10811',
				contentColor: 	'FFFFFF',
				contentBGColor: '080245',
				a_color: 		'221785',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-2106ahopt0in3x6z']={
webappId:    '1002',
documentId:  '2106',
internalId:  '2106ahopt0in3x6z',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-991']={
webappId:    '7008',
documentId:  '24922',
internalId:  '991',
customField: 'language:de;country:CH;'
};
webappMappings['1501']=webappMappings['1501-15812571']={
webappId:    '1501',
documentId:  '501',
internalId:  '15812571',
customField: '1501'
};
webappMappings['1003']=webappMappings['1003-ahopt0in3x6z11923e98af0']={
webappId:    '1003',
documentId:  '14001',
internalId:  'ahopt0in3x6z11923e98af0',
customField: 'de:CH:'
};
webappMappings['7060']=webappMappings['7060-95b58e45e4384d43d736768bab9c2773']={
webappId:    '7060',
documentId:  '22901',
internalId:  '95b58e45e4384d43d736768bab9c2773',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20091117-002412'
};
webappMappings['7008']=webappMappings['7008-990']={
webappId:    '7008',
documentId:  '29101',
internalId:  '990',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29701',
internalId:  '',
customField: '20091115-134631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20081016-152356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2106',
internalId:  '',
customField: '20080515-163243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20080402-164741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14001',
internalId:  '',
customField: '20080416-110420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20091117-002717'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24901',
internalId:  '',
customField: '20091031-100224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24922',
internalId:  '',
customField: '20080406-005935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29101',
internalId:  '',
customField: '20080417-153638'
};
webappMappings['7008']=webappMappings['7008-1360']={
webappId:    '7008',
documentId:  '59201',
internalId:  '1360',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59201',
internalId:  '',
customField: '20090923-145935'
};
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHOPT0IN3X6Z';
var companyName   = 'bugojanci.ch';
var htmlTitle	  = 'Bugojanski+Hrvati+u+Svicarskoj';
var metaKeywords  = 'bugojno+bugojanci+hrvati+u+bugojnu+bugojanci+u+ch+nk+bugojno+zug+';
var metaContents  = 'bugojno%2Cbugojanci%2CHRVATI+U+CH';
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();
};
