/* [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','601',jdecode('Accueil'),jdecode(''), jdecode('%2F601.html'), 'true',[],'',''],
	['PAGE','12885',jdecode('IMAGE+DU+JOUR'),jdecode(''), jdecode('%2F12885.html'), 'true',[],'',''],
	['PAGE','199370',jdecode('Le+Bisse+de+Savi%C3%A8se'),jdecode(''), jdecode('%2F199370.html'), 'true',[],'',''],
	['PAGE','232681',jdecode('Les+glaciers+du+Valais'),jdecode(''), jdecode('%2F232681.html'), 'true',[],'',''],
	['PAGE','313869',jdecode('Carnet+de+route+1825'),jdecode(''), jdecode('%2F313869.html'), 'true',[],'',''],
	['PAGE','12801',jdecode('Gravures'),jdecode(''), jdecode('%2F12801.html'), 'true',[],'',''],
	['PAGE','12822',jdecode('Cartes+de+visite'),jdecode(''), jdecode('%2F12822.html'), 'true',[],'',''],
	['PAGE','12843',jdecode('St%C3%A9r%C3%A9oscopies'),jdecode(''), jdecode('%2F12843.html'), 'true',[],'',''],
	['PAGE','41901',jdecode('Lanternes+magiques'),jdecode(''), jdecode('%2F41901.html'), 'true',[],'',''],
	['PAGE','12864',jdecode('Cartes+postales%2Fphotos'),jdecode(''), jdecode('%2F12864.html'), 'true',[],'',''],
	['PAGE','206970',jdecode('William+ENGLAND'),jdecode(''), jdecode('%2F206970.html'), 'true',[],'',''],
	['PAGE','196070',jdecode('Adolphe+BRAUN'),jdecode(''), jdecode('%2F196070.html'), 'true',[],'',''],
	['PAGE','41922',jdecode('Expositions+%2F+Livres'),jdecode(''), jdecode('%2F41922.html'), 'true',[],'',''],
	['PAGE','228670',jdecode('Film+'),jdecode(''), jdecode('%2F228670.html'), 'true',[],'',''],
	['PAGE','195391',jdecode('Le+Livre+d%26%23x27%3Bor'),jdecode(''), jdecode('%2F195391.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Fotoalbum';
theSitetree.paletteFamily='EFE0BE';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='350';
theSitetree.graphicsetId='403';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='EFE0BE';
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: 			'Fotoalbum',
				paletteFamily: 	'EFE0BE',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'350',
				graphicsetId: 	'403',
				contentColor: 	'000000',
				contentBGColor: 'EFE0BE',
				a_color: 		'EFE0BE',
				b_color: 		'FFF9EA',
				c_color: 		'635F55',
				d_color: 		'736B59',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12822',
internalId:  '',
customField: '20100819-205354'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20120127-070704'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12885',
internalId:  '',
customField: '20120202-063924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12801',
internalId:  '',
customField: '20100821-111810'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12843',
internalId:  '',
customField: '20110809-132042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41901',
internalId:  '',
customField: '20100625-072954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12864',
internalId:  '',
customField: '20111031-084039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41922',
internalId:  '',
customField: '20111031-100655'
};
webappMappings['1002']=webappMappings['1002-195391abw1x0inewlq']={
webappId:    '1002',
documentId:  '195391',
internalId:  '195391abw1x0inewlq',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '313869',
internalId:  '-',
customField: '20120203-203659'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '195391',
internalId:  '',
customField: '20100208-142431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '196070',
internalId:  '',
customField: '20111202-063434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '199370',
internalId:  '',
customField: '20120202-063944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '206970',
internalId:  '',
customField: '20111223-071647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '228670',
internalId:  '',
customField: '20100607-065845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '232681',
internalId:  '',
customField: '20120203-102411'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW1X0INEWLQ';
var companyName   = 'Association+Valaisanne+Images+Anciennes';
var htmlTitle	  = 'Association+Valaisanne+d%27Images+Anciennes+-+La+sauvegarde+des+images+du+temps+pass%C3%A9+%21';
var metaKeywords  = 'Sion%2C+Savi%C3%A8se%2C+Ossona%2C+Ossone%2C+cartes+postales+de+Sion%2C+cartes+postales+de+Savi%C3%A8se%2C+Sitten%2C+Liddes%2C+Orsi%C3%A8res%2C+Valais%2C+Wallis%2C+Savi%C3%A8ze%2C+Sanetsch%2C+Veysonnaz%2C+Champlan%2C+cartes+postales%2C+gravures%2C+carte+de+visite%2C+st%C3%A9r%C3%A9oscopes%2C+lanterne+magique%2C+Conthey%2C+image%2C+vue%2C+ancienne%2C+dardel%2C+dolfuss-ausset%2C+Adolphe+Braun%2C+William+England%2C+Zermatt%2C+stereoviews%2C+Savi%C3%A8ze%2C+St-Martin%2C+Suen%2C+Maurice+Zermatten%2C+Bernab%C3%A9%2C+Ferrier-soulier%2C+Bloch';
var metaContents  = 'Il+sagit+dun+site+de+r%C3%A9f%C3%A9rence+principalement+ax%C3%A9+sur+les+images+anciennes+relatives+a+lensemble+du+canton+du+Valais+en+Suisse.+Il+traite+des+domaines+vari%C3%A9s+comme+les+gravures%2C+les+photographies+de+type+carte+de+visite+et+de+type+st%C3%A9r%C3%A9oscopiques.+Il+y+a+%C3%A9galement+des+verres+de+lanternes+magiques+et+bien+s%C3%BBr+des+cartes+postales.+On+trouve+aussi+des+articles+de+presse+nationale+ou+internationale.+Dautre+part%2C+ce+site+permet+denvoyer+des+cartes+postales+anciennes+virtuelles+%C3%A0+des+amis.+';
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();
};

