/* [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','5001',jdecode('Home'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','5052',jdecode('GIADA+Mini+PC'),jdecode(''), jdecode('%2F5052.html'), 'true',[],'',''],
	['PAGE','5094',jdecode('Computer'),jdecode(''), jdecode('%2F5094.html'), 'true',[],'',''],
	['PAGE','64301',jdecode('Online-Shop'),jdecode(''), jdecode('%2F64301.html'), 'true',[],'',''],
	['PAGE','53201',jdecode('Netzwerkbau'),jdecode(''), jdecode('%2F53201.html'), 'true',[],'',''],
	['PAGE','5073',jdecode('Service+%26+Support'),jdecode(''), jdecode('%2F5073.html'), 'true',[],'',''],
	['PAGE','51101',jdecode('Reparaturen'),jdecode(''), jdecode('%2F51101.html'), 'true',[],'',''],
	['PAGE','5115',jdecode('Webdesign'),jdecode(''), jdecode('%2F5115.html'), 'true',[],'',''],
	['PAGE','51701',jdecode('Workshop'),jdecode(''), jdecode('%2F51701.html'), 'true',[],'',''],
	['PAGE','5136',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F5136.html'), 'true',[],'',''],
	['PAGE','51143',jdecode('AGB+%26+Datenschutz'),jdecode(''), jdecode('%2F51143.html'), 'true',[],'',''],
	['PAGE','5157',jdecode('Kontakt'),jdecode(''), jdecode('%2F5157.html'), 'true',[],'',''],
	['PAGE','51164',jdecode('Plan'),jdecode(''), jdecode('%2F51164.html'), 'true',[],'',''],
	['PAGE','5178',jdecode('Partner+online'),jdecode(''), jdecode('%2F5178.html'), 'true',[],'',''],
	['PAGE','51122',jdecode('WikiLeaks'),jdecode(''), jdecode('%2F51122.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Collage';
theSitetree.paletteFamily='F9C116';
theSitetree.keyvisualId='2446';
theSitetree.keyvisualName='business.jpg';
theSitetree.fontsetId='406';
theSitetree.graphicsetId='459';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Collage',
				paletteFamily: 	'F9C116',
				keyvisualId: 	'2446',
				keyvisualName: 	'business.jpg',
				fontsetId: 		'406',
				graphicsetId: 	'459',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'F9C116',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20111019-123939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5178',
internalId:  '',
customField: '20110820-212103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5157',
internalId:  '',
customField: '20110802-184327'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5115',
internalId:  '',
customField: '20110809-160202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5136',
internalId:  '',
customField: '20110516-144438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20110809-155743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20110516-145313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20110516-140346'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-6962']={
webappId:    '7008',
documentId:  '5157',
internalId:  '6962',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51122',
internalId:  '',
customField: '20110802-184125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51701',
internalId:  '',
customField: '20110516-144649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51101',
internalId:  '',
customField: '20110516-144551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51143',
internalId:  '',
customField: '20110802-183950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51164',
internalId:  '',
customField: '20110802-184518'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53201',
internalId:  '',
customField: '20110516-141138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64301',
internalId:  '',
customField: '20110516-141013'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEOKU';
var companyName   = 'hard+%26+web++-++rund+um+den+Computer++++';
var htmlTitle	  = 'hard+%26+web+++3800+Interlaken+++-+++rund+um+den+Computer';
var metaKeywords  = 'hardweb++hard++web+-++GIADA+Mini+PC+-+Computer+-+PC+-+Hardware+-+Webdesign+-+3800+Interlaken+-+Schweiz+-++PC-Reparaturen+-+PC-Hilfe+-+Systembau+-+Netzwerkbau+-+Schulung+und+Support+-+Webseiten-Optimierung+-+PC-Occasionen+-+Workshop%3A+PC+selber+bauen%21+Wunsch-PC+-Computer+made+in+Interlaken%21';
var metaContents  = 'hardweb++hardweb.ch++hard+%26+web+-+Computer+und+Webdesign+-+3800+Interlaken+-+Schweiz+++%0D%0AGIADA+Mini+PC%2C+Computer%2C+PC%2C+Hardware%2C+Webdesign%2C+System-+und+Netzwerkbau%2C+Reparaturen';
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();
};

