/* [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','4477',jdecode('Home'),jdecode(''),'/4477.html','true',[],'',''],
	['PAGE','4534',jdecode('Nos+%2F+Our+Services'),jdecode(''),'/4534.html','true',[],'',''],
	['PAGE','4561',jdecode('Realisations'),jdecode(''),'/4561.html','true',[],'',''],
	['PAGE','4588',jdecode('A+VENDRE++%2F++FOR+SALE++%3E%3E'),jdecode(''),'/4588.html','true',[],'',''],
	['PAGE','4642',jdecode('Anzere++-++Mayens+d%26%23x27%3BArbaz'),jdecode(''),'/4642.html','true',[],'',''],
	['PAGE','32884',jdecode('Champ%C3%A9ry'),jdecode(''),'/32884.html','true',[],'',''],
	['PAGE','172401',jdecode('Ch%C3%A2teau+d%26%23x27%3BOex+-+Gstaad'),jdecode(''),'/172401.html','true',[],'',''],
	['PAGE','4669',jdecode('Crans-Montana+'),jdecode(''),'/4669.html','true',[],'',''],
	['PAGE','414823',jdecode('Grimisuat'),jdecode(''),'/414823.html','true',[],'',''],
	['PAGE','4777',jdecode('La+Tzoumaz+'),jdecode(''),'/4777.html','true',[],'',''],
	['PAGE','4750',jdecode('Les+Collons+++'),jdecode(''),'/4750.html','true',[],'',''],
	['PAGE','166601',jdecode('Les+Diablerets'),jdecode(''),'/166601.html','true',[],'',''],
	['PAGE','221401',jdecode('Leysin'),jdecode(''),'/221401.html','true',[],'',''],
	['PAGE','85759',jdecode('Morgins'),jdecode(''),'/85759.html','true',[],'',''],
	['PAGE','32830',jdecode('Nax+-+Mase+-+St.-Martin'),jdecode(''),'/32830.html','true',[],'',''],
	['PAGE','4723',jdecode('Nendaz+'),jdecode(''),'/4723.html','true',[],'',''],
	['PAGE','32857',jdecode('Ovronnaz+-+Mayens%2FChamoson'),jdecode(''),'/32857.html','true',[],'',''],
	['PAGE','385223',jdecode('Savi%C3%A8se+-+Binii'),jdecode(''),'/385223.html','true',[],'',''],
	['PAGE','55045',jdecode('Sion+et+environs'),jdecode(''),'/55045.html','true',[],'',''],
	['PAGE','73609',jdecode('Vercorin'),jdecode(''),'/73609.html','true',[],'',''],
	['PAGE','4696',jdecode('Veysonnaz+'),jdecode(''),'/4696.html','true',[],'',''],
	['PAGE','32911',jdecode('Villars+-+Gryon'),jdecode(''),'/32911.html','true',[],'',''],
	['PAGE','158101',jdecode('Zermatt+'),jdecode(''),'/158101.html','true',[],'',''],
	['PAGE','57885',jdecode('Zermatt+-+Visp+region'),jdecode(''),'/57885.html','true',[],'',''],
	['PAGE','457423',jdecode('VOUS+SOUHAITEZ+VENDRE+%3F'),jdecode(''),'/457423.html','true',[],'',''],
	['PAGE','4858',jdecode('CONTACT'),jdecode(''),'/4858.html','true',[],'','']];
var siteelementCount=26;
theSitetree.topTemplateName='Gaudy';
theSitetree.paletteFamily='878481';
theSitetree.keyvisualId='5977';
theSitetree.keyvisualName='kv_5977.jpg';
theSitetree.fontsetId='11113';
theSitetree.graphicsetId='11909';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='B4B4B4';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Gaudy',
				paletteFamily: 	'878481',
				keyvisualId: 	'5977',
				keyvisualName: 	'kv_5977.jpg',
				fontsetId: 		'11113',
				graphicsetId: 	'11909',
				contentColor: 	'FFFFFF',
				contentBGColor: 'B4B4B4',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4750',
internalId:  '',
customField: '20100823-102324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4588',
internalId:  '',
customField: '20100830-104347'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4477',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4477',
internalId:  '',
customField: '20100828-112401'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4534',
internalId:  '',
customField: '20100110-212759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4561',
internalId:  '',
customField: '20100410-115725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4642',
internalId:  '',
customField: '20100830-104654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '414823',
internalId:  '',
customField: '20091226-221615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32884',
internalId:  '',
customField: '20091226-221429'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172401',
internalId:  '',
customField: '20091226-221456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4669',
internalId:  '',
customField: '20100410-121439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4777',
internalId:  '',
customField: '20100827-111854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '166601',
internalId:  '',
customField: '20100602-090136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '221401',
internalId:  '',
customField: '20100414-110918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85759',
internalId:  '',
customField: '20100306-111123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32830',
internalId:  '',
customField: '20100626-181951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4723',
internalId:  '',
customField: '20100825-095738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32857',
internalId:  '',
customField: '20100326-110512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '385223',
internalId:  '',
customField: '20100701-160416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55045',
internalId:  '',
customField: '20091226-222325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73609',
internalId:  '',
customField: '20100415-093915'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4696',
internalId:  '',
customField: '20100829-103201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32911',
internalId:  '',
customField: '20091226-222539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '158101',
internalId:  '',
customField: '20091226-222615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57885',
internalId:  '',
customField: '20091226-222649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4858',
internalId:  '',
customField: '20100110-210601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '457423',
internalId:  '',
customField: '20100110-210954'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'AHOPT0IN3OOS';
var companyName   = 'Agence+Immobili%C3%A8re++-+vente+%26+construction++++++++++++Real+Estate+-+sales+%26+construction++';
var htmlTitle	  = 'ALPINE+IMMOBILIER+switzerland+-+chalets+switzerland+-+swiss+chalets+-+crans+montana+-+veysonnaz+-+nendaz+-+anzere+-+ovronnaz+-+champery+-+villars';
var metaKeywords  = 'crans+montana%2Canzere%2Carbaz%2Covronnaz%2Czermatt%2Cles+collons%2Cveysonnaz%2Cnendaz%2Cverbier%2Cchampery%2Cvillars%2Cmorgins%2Cleysin%2Cles+diablerets%2Cagence+immobili%C3%A8re%2Cchalets%2Cchalets+switzerland%2Cswiss+chalets%2Cswiss+properties%2Cswiss+property%2Cswiss+apartements%2Cswiss+chalets%2Cski-in%2Cski-out%2Cski+apartments%2Cski';
var metaContents  = 'Agence+immobiliere+Crans+Montana+Anzere+Arbaz+Ovronnaz+Zermatt+Nax+Les+Collons+Veysonnaz+Nendaz+Verbier+Champery+Morgins+Leysin+Les+Diablerets+Villars.+Vente+et+construction+de+chalets+et+appartements.';
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();
};
