/* [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('Accueil%2C+restaurant'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','536',jdecode('Vos+commentaires'),jdecode(''), jdecode('%2F536.html'), 'true',[],'',''],
	['PAGE','452',jdecode('O%C3%B9+nous+trouver%2C+St+Martin'),jdecode(''), jdecode('%2F452.html'), 'true',[],'',''],
	['PAGE','473',jdecode('Horaires+d%26%23x27%3Bouverture%2C+aussi+le+dimanche+soir'),jdecode(''), jdecode('%2F473.html'), 'true',[],'',''],
	['PAGE','494',jdecode('Carte+produits+de+saison'),jdecode(''), jdecode('%2F494.html'), 'true',[],'',''],
	['PAGE','9901',jdecode('Menus+banquets'),jdecode(''), jdecode('%2F9901.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Assiette+du+jour+%2F+Carte+des+vins'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','7301',jdecode('R%C3%A9servations+-+Liens'),jdecode(''), jdecode('%2F7301.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='FFD375';
theSitetree.keyvisualId='1983';
theSitetree.keyvisualName='milch.jpg';
theSitetree.fontsetId='330';
theSitetree.graphicsetId='385';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stylus',
				paletteFamily: 	'FFD375',
				keyvisualId: 	'1983',
				keyvisualName: 	'milch.jpg',
				fontsetId: 		'330',
				graphicsetId: 	'385',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFD375',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120111-090848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20120121-140125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100911-183630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20120111-090923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20111201-194203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20120127-205716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20101028-195849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20110706-092911'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW1X0INEAZQ';
var companyName   = 'Auberge+de+la+Croix+F%C3%A9d%C3%A9rale%2C+St+Martin';
var htmlTitle	  = 'Auberge+de+la+Croix+f%C3%A9d%C3%A9rale';
var metaKeywords  = 'restaurant%3B+veveyse%3B+fribourg%3B+moleson%3B+jambon+%C3%A0+los%3B+produits+du+terroir%3B+vin+de+vully%3B+terrasse%3B+parking%3B+humagne%2C+syrah%2C+cornalin%2C+chevreuil%2C+cerf%2C+entrec%C3%B4te+caf%C3%A9+de+Paris%2C+filets+de+perches%2C+selle+de+chevreuil%2C+banquet%2C+cocktail%2C+fondue%2C+cro%C3%BBte+au+fromage%2C+vacherin%2C+cr%C3%A8me+br%C3%BBl%C3%A9e%2C+coupe+nesselrod%2C+vermicelles%2C+meringue+glac%C3%A9e%2C+caf%C3%A9%2C+menu+d%C3%A9gustation%2C+poisson+du+march%C3%A9%2C+assiette+du+jour';
var metaContents  = 'restaurant%3B+caf%C3%A9%3B+terrine%3B+b%C3%A9nichon%3B+carte+des+mets%2C+carte+des+vins%2C+saint-martin%3B+veveyse%3B+chasse%3B+filet+de+cerf%2C+m%C3%A9daillons+de+chevreuil%2C+selle+de+chevreuil%2C+filets+de+perches%2C+entrec%C3%B4te+caf%C3%A9+de+Paris%2C+jambon+%C3%A0+los%2C+galantine+de+faisan%2C+velout%C3%A9+de+potimarron%2C++salade+d%27automne%2C+filets+de+perche%2C+poisson+du+march%C3%A9%2C+cr%C3%A8me+de+panais%2C+terrine+maison%2C+rillettes+de+lapin%2C+escalopine+de+filet+de+porc+sauce+aux+morilles%2C+menu+d%C3%A9gustations%2Ccaf%C3%A9+glac%C3%A9%2C+colonel%2C+meringue+glac%C3%A9e%2C+cornettes%2C+cro%C3%BBte+au+fromage%2C+fondue+moiti%C3%A9-moiti%C3%A9%2C+saucisson+vaudois+aux+lentilles%2C+cr%C3%A8me+br%C3%BBl%C3%A9e';
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();
};

