/* [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','501',jdecode('home'),jdecode(''),'/501.html','true',[],''],
	['PAGE','552',jdecode('Angebot'),jdecode(''),'/552.html','true',[],''],
	['PAGE','594',jdecode('Studioausstattung'),jdecode(''),'/594.html','true',[],''],
	['PAGE','16401',jdecode('Referenzen'),jdecode(''),'/16401.html','true',[],''],
	['PAGE','12501',jdecode('Pers%C3%B6nlich+%26+Kontakt'),jdecode(''),'/12501.html','true',[],'']];
var siteelementCount=5;
theSitetree.topTemplateName='Pixelprofi';
theSitetree.paletteFamily='2E3836';
theSitetree.keyvisualId='1152';
theSitetree.keyvisualName='panfloete.jpg';
theSitetree.fontsetId='184';
theSitetree.graphicsetId='223';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2E3836';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				name: 			'Pixelprofi',
				paletteFamily: 	'2E3836',
				keyvisualId: 	'1152',
				keyvisualName: 	'panfloete.jpg',
				fontsetId: 		'184',
				graphicsetId: 	'223',
				contentColor: 	'FFFFFF',
				contentBGColor: '2E3836',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'2E3836',
				b_color: 		'5E726E',
				c_color: 		'000000',
				d_color: 		'455350',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20070101-181540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20070101-173857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20070920-170417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20070920-170542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16401',
internalId:  '',
customField: '20070101-174845'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXLF5';
var companyName   = 'www.audiomusic.ch';
var htmlTitle	  = 'audiomusic%3A+Produktion%2C+Recording%2C+Mix+und+Master';
var metaKeywords  = 'audio-recording%2C+mix%2C+mastering%2C+Musikproduktion%2C+musicproduction%2C+Support%2C+Beratung%2C+Support%2C+Musiker%2C+musician%2C+Produzent%2C+producer%2C+Nuendo%2C+Cubase%2C+Wavelab%2C+Logic+pro%2C+Powercore%2C+Sony+Oxford+Plugins%2C+TC+VSS3%2C+Schoeps+Mikrofone%2C+Schoeps+microfones%2C+Groove+Tube%2C+Massenburg+Pre-Amp%2C+Meitner+Wandler%2C+emm-labs+ADC8+MK4%2C+Strauss+Monitore%2C+Strauss+Elektroakustik+Mastering+Monitor%2C+SENF-3%2C+mLan%2C+Yamaha+01x%2C+Yamaha+i88x%2C+Yamaha+mLan%2C+Recording+Studio%2C+Mastering+Studio.';
var metaContents  = 'G%C3%BCnstiges+Tonstudio%2C++Musikproduktion%2C+Demo-CD+Produktion%2C+CD-Produktion%2C+Live-Recording%2C+Studiorecording%2C+mobiles+Studioequipment%2C+professionelle+Ausstattung%2C+Support+und+Beratung.+';
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();
};

