/* [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','4597',jdecode('Page+d%26%23x27%3Baccueil'),jdecode(''),'/4597.html','true',[],'',''],
	['PAGE','164364',jdecode('NOS+SERVICES'),jdecode(''),'/164364.html','true',[],'',''],
	['PAGE','174447',jdecode('A+VENDRE+en+SUISSE'),jdecode(''),'/174447.html','true',[],'',''],
	['PAGE','176256',jdecode('A+vendre+en+Espagne'),jdecode(''),'/176256.html','true',[],'',''],
	['PAGE','174201',jdecode('Sp%C3%A9cial+couleur%21'),jdecode(''),'/174201.html','true',[],'',''],
	['PAGE','165840',jdecode('Juments-poulains'),jdecode(''),'/165840.html','true',[],'',''],
	['PAGE','145542',jdecode('Chevaux+vendus'),jdecode(''),'/145542.html','true',[],'',''],
	['PAGE','172719',jdecode('Les+niouzes%21'),jdecode(''),'/172719.html','true',[],'',''],
	['PAGE','169981',jdecode('STAGES+de+DRESSAGE'),jdecode(''),'/169981.html','true',[],'',''],
	['PAGE','4654',jdecode('NOTRE+ELEVAGE'),jdecode(''),'/4654.html','true',[],'',''],
	['PAGE','5926',jdecode('CONTACT'),jdecode(''),'/5926.html','true',[],'',''],
	['PAGE','139708',jdecode('Selles+ZALDI'),jdecode(''),'/139708.html','true',[],'',''],
	['PAGE','173500',jdecode('Livre+d%26%23x27%3Bor'),jdecode(''),'/173500/index.html','true',[ 
		['PAGE','173499',jdecode('Entr%C3%A9es'),jdecode(''),'/173500/173499.html','true',[],'','']
	],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Delta';
theSitetree.paletteFamily='080245';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10440';
theSitetree.graphicsetId='10811';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='080245';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Delta',
				paletteFamily: 	'080245',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10440',
				graphicsetId: 	'10811',
				contentColor: 	'FFFFFF',
				contentBGColor: '080245',
				a_color: 		'221785',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4597',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '176256',
internalId:  '',
customField: '20100602-074728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4597',
internalId:  '',
customField: '20100704-203552'
};
webappMappings['1501']=webappMappings['1501-139422']={
webappId:    '1501',
documentId:  '4597',
internalId:  '139422',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '164364',
internalId:  '',
customField: '20100602-080252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '174447',
internalId:  '',
customField: '20100704-200203'
};
webappMappings['1002']=webappMappings['1002-173500abw0x0inxsiy']={
webappId:    '1002',
documentId:  '173500',
internalId:  '173500abw0x0inxsiy',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '174201',
internalId:  '',
customField: '20100501-074249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '165840',
internalId:  '',
customField: '20080410-083954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '145542',
internalId:  '',
customField: '20091203-213055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172719',
internalId:  '',
customField: '20100704-203405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '169981',
internalId:  '',
customField: '20100704-200325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4654',
internalId:  '',
customField: '20090503-152118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5926',
internalId:  '',
customField: '20100409-093747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '139708',
internalId:  '',
customField: '20100704-200457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '173500',
internalId:  '',
customField: '20080111-090246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '173499',
internalId:  '',
customField: '20080111-090246'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXSIY';
var companyName   = '...le+bonheur+est+dans+le+PRE+...';
var htmlTitle	  = 'Chevaux+de+pure+race+espagnole+PRE%2C+chevaux+andalous%2C+Spanish+horses%2C+Andalusier+Pferde%2C+Spanishe+Pferde';
var metaKeywords  = 'Chevaux+de+pure+race+espagnole+PRE+andalusian+horses++horse+andalusier+Pferd+andalou+dressage+haute+%C3%A9cole++vente+de+chevaux+PRE+andalous+stages+de+dressage+%C3%A9levage+de+chevaux+espagnols+PRE%2C+haute+%C3%A9cole+dressage+classique+';
var metaContents  = 'Chevaux+pure+race+espagnole+PRE+andalusian+horse+andalusier+pferd+%C3%A9levage+z%C3%BCchtung+breeding+vente+sale+verkauf+';
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();
};
