/* [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('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','49101',jdecode('UNSER+SCHMUCK'),jdecode(''),'/49101/index.html','true',[ 
		['PAGE','66601',jdecode('S%60NEUSCHT'),jdecode(''),'/49101/66601.html','true',[],'',''],
		['PAGE','72701',jdecode('GOLD'),jdecode(''),'/49101/72701.html','true',[],'',''],
		['PAGE','72722',jdecode('ENTW%C3%9CRFE'),jdecode(''),'/49101/72722.html','true',[],'',''],
		['PAGE','72743',jdecode('EDELSTAHL'),jdecode(''),'/49101/72743.html','true',[],'','']
	],'',''],
	['PAGE','123701',jdecode('Onlineshop'),jdecode(''),'/123701.html','false',[],'',''],
	['PAGE','3543',jdecode('KLICKMI'),jdecode(''),'/3543/index.html','true',[ 
		['PAGE','77101',jdecode('ALBUM1'),jdecode(''),'/3543/77101.html','true',[],'',''],
		['PAGE','3564',jdecode('BEISPIELE'),jdecode(''),'/3543/3564.html','true',[],'',''],
		['PAGE','6801',jdecode('JOPS'),jdecode(''),'/3543/6801.html','true',[],'',''],
		['PAGE','84001',jdecode('VORF%C3%9CRUNGEN'),jdecode(''),'/3543/84001.html','true',[],'',''],
		['PAGE','130701',jdecode('AUSSTELLUNG'),jdecode(''),'/3543/130701.html','true',[],'','']
	],'',''],
	['PAGE','142501',jdecode('FORMEN+UND+MUSTER'),jdecode(''),'/142501.html','true',[],'',''],
	['PAGE','75101',jdecode('ANL%C3%84SSE'),jdecode(''),'/75101.html','true',[],'',''],
	['PAGE','35001',jdecode('KONTAKT'),jdecode(''),'/35001.html','true',[],'',''],
	['PAGE','118701',jdecode('DEJAVU'),jdecode(''),'/118701.html','true',[],'',''],
	['PAGE','129101',jdecode('WO+SIND+WIR'),jdecode(''),'/129101.html','true',[],'',''],
	['PAGE','141601',jdecode('shop'),jdecode(''),'/141601.html','false',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='666666';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='49';
theSitetree.graphicsetId='55';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Easy',
				paletteFamily: 	'666666',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'49',
				graphicsetId: 	'55',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'666666',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100417-093043'
};
webappMappings['7060']=webappMappings['7060-fdd4e73564bc355befc973419022c5db']={
webappId:    '7060',
documentId:  '77101',
internalId:  'fdd4e73564bc355befc973419022c5db',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '141601',
internalId:  '',
customField: '20100531-171537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142501',
internalId:  '',
customField: '20100602-213836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72701',
internalId:  '',
customField: '20090922-135817'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72722',
internalId:  '',
customField: '20071230-203947'
};
webappMappings['7008']=webappMappings['7008-778']={
webappId:    '7008',
documentId:  '84001',
internalId:  '778',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49101',
internalId:  '',
customField: '20100602-213005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66601',
internalId:  '',
customField: '20100602-212930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72743',
internalId:  '',
customField: '20071230-204002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3543',
internalId:  '',
customField: '20100529-110957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '77101',
internalId:  '',
customField: '20080107-165543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3564',
internalId:  '',
customField: '20100601-104031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20071230-204237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84001',
internalId:  '',
customField: '20090922-081253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75101',
internalId:  '',
customField: '20100529-110829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35001',
internalId:  '',
customField: '20071230-204512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '130701',
internalId:  '',
customField: '20090922-082311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '118701',
internalId:  '',
customField: '20090405-174606'
};
webappMappings['4001']=webappMappings['4001-21770170']={
webappId:    '4001',
documentId:  '123701',
internalId:  '21770170',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '123701',
internalId:  '',
customField: '20090816-102659'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '129101',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '129101',
internalId:  '',
customField: '20090816-113619'
};
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHOPT0IN3AR9';
var companyName   = '';
var htmlTitle	  = 'Rene+Zellweger+Goldschmied+CH-6206+Neuenkirch';
var metaKeywords  = 'gold%2C+silber%2C+modeschmuck%2C+schmuck%2C+magnete%2C+magnetschmuck%2C+klickmee%2C+klicmi%2C+clicmi';
var metaContents  = 'klickmi+Magnetschmuck+schmuck+und+modeschmuck+der+firmen+zellweger+und+klickmi+zellweger+klickmi+magnetschmuck+einzelstuecke+extraanfertigung+';
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();
};
