/* [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','4607',jdecode('HOME'),jdecode(''), jdecode('%2F4607.html'), 'true',[],'',''],
	['PAGE','4901',jdecode('CONTACT'),jdecode(''), jdecode('%2F4901.html'), 'true',[],'',''],
	['PAGE','6579',jdecode('+++++++++++++++LA+FAMILLE+%21'),jdecode(''), jdecode('%2F6579%2Findex.html'), 'true',[ 
		['PAGE','6606',jdecode('M%C3%82LES'),jdecode(''), jdecode('%2F6579%2F6606.html'), 'true',[],'',''],
		['PAGE','6633',jdecode('FEMELLES'),jdecode(''), jdecode('%2F6579%2F6633.html'), 'true',[],'',''],
		['PAGE','6660',jdecode('CHATONS'),jdecode(''), jdecode('%2F6579%2F6660.html'), 'true',[],'','']
	],'',''],
	['PAGE','7376',jdecode('GALERIE'),jdecode(''), jdecode('%2F7376%2Findex.html'), 'true',[ 
		['PAGE','7403',jdecode('NEUTRE'),jdecode(''), jdecode('%2F7376%2F7403.html'), 'true',[],'',''],
		['PAGE','13126',jdecode('MEMORY'),jdecode(''), jdecode('%2F7376%2F13126.html'), 'true',[],'',''],
		['PAGE','7430',jdecode('SORTIE+EXTERIEUR'),jdecode(''), jdecode('%2F7376%2F7430.html'), 'true',[],'','']
	],'',''],
	['PAGE','5090',jdecode('LIENS'),jdecode(''), jdecode('%2F5090.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='2FAF66';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10587';
theSitetree.graphicsetId='10565';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'2FAF66',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10587',
				graphicsetId: 	'10565',
				contentColor: 	'DDDDDD',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				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:  '4607',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4607',
internalId:  '',
customField: '20120102-160507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6579',
internalId:  '',
customField: '20111224-154019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6660',
internalId:  '',
customField: '20111224-154741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20110821-141726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6606',
internalId:  '',
customField: '20101227-162258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6633',
internalId:  '',
customField: '20110725-155937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7376',
internalId:  '',
customField: '20101227-162431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7403',
internalId:  '',
customField: '20090417-140156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13126',
internalId:  '',
customField: '20090308-145554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7430',
internalId:  '',
customField: '20060602-140724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5090',
internalId:  '',
customField: '20111220-150727'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN21XO';
var companyName   = 'ROCKWOOD%27S+MAINE+COON';
var htmlTitle	  = 'ROCKWOODS+MAINE+COON';
var metaKeywords  = 'MAINE+COON+ROCKWOODS+GEISER+RAYNALD+ELVIRA';
var metaContents  = 'MAINE+COON++ROCKWOODS+-+FREECLIMBER+-+EL+DORADO';
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();
};

