/* [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 theSitetree=[ 
	['PAGE','4607',jdecode('HOME'),jdecode(''),'/4607/index.html','true',[ 
		['PAGE','100883',jdecode('Home+%28Folgeseite%29'),jdecode(''),'/4607/100883.html','false',[],'']
	],''],
	['PAGE','170748',jdecode('NEWS'),jdecode(''),'/170748.html','true',[],''],
	['PAGE','139547',jdecode('Multimedia+BKS'),jdecode(''),'/139547.html','true',[],''],
	['PAGE','170812',jdecode('Satellite+-+TNT'),jdecode(''),'/170812.html','true',[],''],
	['PAGE','172936',jdecode('LCD+-+PLASMA+TV'),jdecode(''),'/172936.html','true',[],''],
	['PAGE','4718',jdecode('Home+Cin%C3%A9ma'),jdecode(''),'/4718.html','true',[],''],
	['PAGE','173074',jdecode('Blu-Ray+-+DVD+-+HDD'),jdecode(''),'/173074.html','true',[],''],
	['PAGE','122726',jdecode('Support+LCD+et+Plasma'),jdecode(''),'/122726.html','true',[],''],
	['PAGE','110279',jdecode('DAB'),jdecode(''),'/110279.html','true',[],''],
	['PAGE','172198',jdecode('Occasions'),jdecode(''),'/172198.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Lounge';
theSitetree.paletteFamily='4DB1CB';
theSitetree.keyvisualId='11714';
theSitetree.keyvisualName='kv_11714.jpg';
theSitetree.fontsetId='32984';
theSitetree.graphicsetId='14004';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				name: 			'Lounge',
				paletteFamily: 	'4DB1CB',
				keyvisualId: 	'11714',
				keyvisualName: 	'kv_11714.jpg',
				fontsetId: 		'32984',
				graphicsetId: 	'14004',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'B9B19D',
				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:  '4607',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4607',
internalId:  '',
customField: '20090427-134644'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '170748',
internalId:  '',
customField: '20090626-191747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100883',
internalId:  '',
customField: '20041207-125006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '139547',
internalId:  '',
customField: '20051007-225553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '170812',
internalId:  '',
customField: '20071204-210900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172936',
internalId:  '',
customField: '20081022-172815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4718',
internalId:  '',
customField: '20080518-145835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '173074',
internalId:  '',
customField: '20080518-151428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '122726',
internalId:  '',
customField: '20080518-144633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '110279',
internalId:  '',
customField: '20090626-192307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '172198',
internalId:  '',
customField: '20090427-135145'
};
webappMappings['7008']=webappMappings['7008-5088']={
webappId:    '7008',
documentId:  '4607',
internalId:  '5088',
customField: 'language:fr;country:FR;'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXSYZ';
var companyName   = 'Multim%C3%A9dia+-+TV+-+Satellite++Alain+Mermod';
var htmlTitle	  = 'www.mermodrtvsat.ch';
var metaKeywords  = 'Finlux+Metz+Panasonic+Orion+Lenco+TPS+Canal%2B+mermod+gryon+villars+bex+lesposses+astra+eutelsat+atlanticbird+sharp+satellite+orion+Hyundai+Metz+BKS+HomeNet+Homenet+Bis-TV+Bis+';
var metaContents  = 'TV+DVD+Satellite+Plasma+LCD+mermod+Gryon+Villars+antenne+Bis+canal%2B+astra+eutelsat+atlanticbird+sharp+satellite+Orion+Hyundai+Metz+BKS+Homenet+';
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();
};

