/* [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','4677',jdecode('Home'),jdecode(''),'/4677.html','true',[],'',''],
	['PAGE','4761',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/4761.html','true',[],'',''],
	['PAGE','6001',jdecode('Marken'),jdecode(''),'/6001.html','true',[],'',''],
	['PAGE','6749',jdecode('Ger%C3%A4te%C3%BCbersicht'),jdecode(''),'/6749.html','true',[],'',''],
	['PAGE','4842',jdecode('Sonderangebote'),jdecode(''),'/4842.html','true',[],'',''],
	['PAGE','26899',jdecode('Aktivit%C3%A4ten%2C+NEWS'),jdecode(''),'/26899.html','true',[],'',''],
	['PAGE','4869',jdecode('Kontakt'),jdecode(''),'/4869.html','true',[],'',''],
	['PAGE','4896',jdecode('Service+%26+Zubeh%C3%B6r'),jdecode(''),'/4896.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Puzzle';
theSitetree.paletteFamily='7683DB';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10366';
theSitetree.graphicsetId='10511';
theSitetree.contentColor='293379';
theSitetree.contentBGColor='CDD1F0';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Puzzle',
				paletteFamily: 	'7683DB',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10366',
				graphicsetId: 	'10511',
				contentColor: 	'293379',
				contentBGColor: 'CDD1F0',
				a_color: 		'CDD1F0',
				b_color: 		'7683DB',
				c_color: 		'000000',
				d_color: 		'7A83C4',
				e_color: 		'0D1346',
				f_color: 		'02051D',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'5',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4677',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4677',
internalId:  '',
customField: '20100423-172843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4761',
internalId:  '',
customField: '20100714-173329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20100527-113152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4869',
internalId:  '',
customField: '20100708-171041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6749',
internalId:  '',
customField: '20100708-160200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26899',
internalId:  '',
customField: '20100708-171459'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4896',
internalId:  '',
customField: '20100708-165452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4842',
internalId:  '',
customField: '20100715-151829'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXZ4E';
var companyName   = '..Ihr+HiFi+und+Homecinema+Spezialist';
var htmlTitle	  = 'HiFi+und+High+End+Studio+in+Z%C3%BCrich';
var metaKeywords  = 'Atoll%2C+Audio+Physics%2C+Final%2C+Lexicon%2C+McIntosh%2C+NEC%2C+Philips%2C+NAD%2C+Burmester%2C+HiFi%2C+High+End%2C+Stereo%2C+Dolby+Digital%2C+Homecinema%2C+Heimkino%2C+Verst%C3%A4rker%2C+Tuner%2C+CD%2C+DVD%2C+Waterfall%2C+Panasonic%2C+Fujitsu%2C+Nakamichi%2C+Arcus%2C+Oktave%2C+Vorf%C3%BChrger%C3%A4te%2C+Occasionen%2C+Gerbrauchtes%2C+nec%2C+Fujitsu%2C+Musical+Fidelity%2C+Quad%2C+Zubeh%C3%B6r+Hifi+TV+Video++';
var metaContents  = 'HiFi%2C+High+End+und+Homecinema+Spezialist';
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();
};
