/* [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','4478',jdecode('page+pricipale'),jdecode(''),'/4478/index.html','true',[ 
		['PAGE','34646',jdecode('page+pricipale+%28Folgeseite%29'),jdecode(''),'/4478/34646.html','false',[],'',''],
		['PAGE','23344',jdecode('actualit%C3%A9s%3A+d%C3%A9gustation+et+contact'),jdecode(''),'/4478/23344.html','true',[],'',''],
		['PAGE','10198',jdecode('f+Montsevelier'),jdecode(''),'/4478/10198.html','true',[],'',''],
		['PAGE','10225',jdecode('f+Zwingen'),jdecode(''),'/4478/10225.html','true',[],'',''],
		['PAGE','10144',jdecode('f+%C3%96tlingen%3A+viticulture+du+temps+du+prince-%C3%A9v%C3%AAque'),jdecode(''),'/4478/10144.html','true',[],'',''],
		['PAGE','10306',jdecode('f+Liesberg'),jdecode(''),'/4478/10306.html','true',[],'',''],
		['PAGE','10252',jdecode('f+Buix+et+Soyhi%C3%A8res'),jdecode(''),'/4478/10252.html','true',[],'',''],
		['PAGE','10171',jdecode('archives+et+histoire'),jdecode(''),'/4478/10171.html','true',[],'','']
	],'',''],
	['PAGE','43573',jdecode('Hauptseite'),jdecode(''),'/43573/index.html','true',[ 
		['PAGE','43600',jdecode('Aktuelles%3A+Degustation'),jdecode(''),'/43573/43600.html','true',[],'',''],
		['PAGE','43627',jdecode('d+Montsevelier'),jdecode(''),'/43573/43627.html','true',[],'',''],
		['PAGE','43654',jdecode('d+Zwingen'),jdecode(''),'/43573/43654.html','true',[],'',''],
		['PAGE','43681',jdecode('d+Liesberg'),jdecode(''),'/43573/43681.html','true',[],'',''],
		['PAGE','43708',jdecode('d+%C3%96tlingen%3A+Geschichte+des+Rebbaus'),jdecode(''),'/43573/43708.html','true',[],'',''],
		['PAGE','43546',jdecode('Archiv+und+Geschichte'),jdecode(''),'/43573/43546.html','true',[],'','']
	],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='660000';
theSitetree.keyvisualId='945';
theSitetree.keyvisualName='rotwein.jpg';
theSitetree.fontsetId='166';
theSitetree.graphicsetId='197';
theSitetree.contentColor='A00000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'660000',
				keyvisualId: 	'945',
				keyvisualName: 	'rotwein.jpg',
				fontsetId: 		'166',
				graphicsetId: 	'197',
				contentColor: 	'A00000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'660000',
				c_color: 		'000000',
				d_color: 		'990000',
				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:  '4478',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4478',
internalId:  '',
customField: '20100827-095748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43573',
internalId:  '',
customField: '20100816-100812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34646',
internalId:  '',
customField: '20050729-083911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23344',
internalId:  '',
customField: '20091209-131808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10198',
internalId:  '',
customField: '20090525-132100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10225',
internalId:  '',
customField: '20061207-075340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10252',
internalId:  '',
customField: '20090902-222817'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10306',
internalId:  '',
customField: '20090525-141435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10144',
internalId:  '',
customField: '20090525-144837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10171',
internalId:  '',
customField: '20091208-101228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43600',
internalId:  '',
customField: '20091209-132048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43627',
internalId:  '',
customField: '20090525-114613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43654',
internalId:  '',
customField: '20061207-080020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43681',
internalId:  '',
customField: '20090525-141157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43708',
internalId:  '',
customField: '20090525-144151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43546',
internalId:  '',
customField: '20091208-143852'
};
webappMappings['7008']=webappMappings['7008-3497']={
webappId:    '7008',
documentId:  '4478',
internalId:  '3497',
customField: 'language:de;country:CH;'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXSXV';
var companyName   = 'vin+du+Jura';
var htmlTitle	  = 'vin+du+Jura';
var metaKeywords  = 'Montsevelier-Liesberg-Zwingen-vin-jura-c%C3%A9pages-r%C3%A9sistant-cryptogamique-cabernet-sauvignon-saint-martin-cuv%C3%A9e-soyhi%C3%A8res-clos-cantons-';
var metaContents  = 'Vin-jura-Suisse-vin+du+jura';
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();
};
