/* [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','4519',jdecode('Page+d%26%23x27%3Baccueil+%E9%A6%96%E9%A1%B5'),jdecode(''),'/4519.html','true',[],'',''],
	['PAGE','4576',jdecode('Produits+%E4%BA%A7%E5%93%81'),jdecode(''),'/4576/index.html','true',[ 
		['PAGE','18101',jdecode('suite+%E4%BA%A7%E5%93%81%E7%BB%AD'),jdecode(''),'/4576/18101.html','true',[],'','']
	],'',''],
	['PAGE','4603',jdecode('Autres+produits+%E5%85%B6%E5%AE%83'),jdecode(''),'/4603/index.html','true',[ 
		['PAGE','4630',jdecode('m%C3%A9thode+d%26%23x27%3Bapprentissage+'),jdecode(''),'/4603/4630.html','true',[],'','']
	],'',''],
	['PAGE','4684',jdecode('Nouvelle+%E6%9C%80%E6%96%B0%E6%B6%88%E6%81%AF'),jdecode(''),'/4684.html','true',[],'',''],
	['PAGE','4657',jdecode('Contact+%E8%81%94%E7%BB%9C%E6%88%91%E4%BB%AC'),jdecode(''),'/4657.html','true',[],'',''],
	['PAGE','4711',jdecode('Liens+%E6%9C%89%E7%94%A8%E5%9C%B0%E5%9D%80'),jdecode(''),'/4711.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Atmosphere';
theSitetree.paletteFamily='FF6600';
theSitetree.keyvisualId='76';
theSitetree.keyvisualName='briefumschlaege.jpg';
theSitetree.fontsetId='7';
theSitetree.graphicsetId='8';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Atmosphere',
				paletteFamily: 	'FF6600',
				keyvisualId: 	'76',
				keyvisualName: 	'briefumschlaege.jpg',
				fontsetId: 		'7',
				graphicsetId: 	'8',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FF6600',
				b_color: 		'FF9900',
				c_color: 		'000000',
				d_color: 		'',
				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:  '4519',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4519',
internalId:  '',
customField: '20100129-132211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4657',
internalId:  '',
customField: '20100902-154142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4576',
internalId:  '',
customField: '20100902-154552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18101',
internalId:  '',
customField: '20100128-150718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4603',
internalId:  '',
customField: '20100304-181329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4630',
internalId:  '',
customField: '20100304-182513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4684',
internalId:  '',
customField: '20100902-154114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4711',
internalId:  '',
customField: '20100413-152306'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INX2JV';
var companyName   = 'Librairie++Lettres+de+Chine';
var htmlTitle	  = 'Librairie+Lettres+de+Chine';
var metaKeywords  = 'lettres+de+chine%2Clibrairie%2Clivre+chinois%2C+lecture+bilingue%2C+musique+chinoise%2C+film+chinois%2Cdictionnaire%2C+calligraphie%2Carts+martiaux%2C+m%EF%BF%BDthode%2C+logiciel%2C+jeux+de+cartes%2C+pinceaux%2C+encre%2C+BD%2C+Chine%2Ctaiji%2C+qigong%2CDVD%2Clitt%EF%BF%BDrature+chinoise%2C+carte%2C';
var metaContents  = 'pr%EF%BF%BDsentation+de+la+librairie+et+de+ses+produits%3A+livres+chinois+traduits%2Cdictionnaire%2Cmusique+chinoise%2Carts+martiaux%2C+calligraphie%2C+m%EF%BF%BDthodes+de+langue%2Cbilingue%2Clecture+enfant%2C+bande+dessin%EF%BF%BDe%2Csant%EF%BF%BD%2Cfilm+chinois%2C+litt%EF%BF%BDrature+chinoise%2C+jeux+de+cartes%2C+%EF%BF%BDchec+chinois';
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();
};
