/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','18901',jdecode('Aktuelles+%2F+Actualit%C3%A9'),jdecode(''), jdecode('%2F18901.html'), 'true',[],'',''],
	['PAGE','473',jdecode('Neu+%2F+Nouveau'),jdecode(''), jdecode('%2F473.html'), 'true',[],'',''],
	['PAGE','536',jdecode('Keramik+%2F+C%C3%A9ramique'),jdecode(''), jdecode('%2F536.html'), 'true',[],'',''],
	['PAGE','222501',jdecode('Glas+%2F+Verres'),jdecode(''), jdecode('%2F222501.html'), 'true',[],'',''],
	['PAGE','557',jdecode('Holz+%2F+Bois'),jdecode(''), jdecode('%2F557.html'), 'true',[],'',''],
	['PAGE','153801',jdecode('Metall+%2F+M%C3%A9tal'),jdecode(''), jdecode('%2F153801.html'), 'true',[],'',''],
	['PAGE','578',jdecode('B%C3%BCcher+%2F+Livres'),jdecode(''), jdecode('%2F578.html'), 'true',[],'',''],
	['PAGE','18101',jdecode('Karten+%2F+Cartes'),jdecode(''), jdecode('%2F18101.html'), 'true',[],'',''],
	['PAGE','620',jdecode('B%C3%BCro+%2F+Bureau'),jdecode(''), jdecode('%2F620.html'), 'true',[],'',''],
	['PAGE','662',jdecode('Taschen+%2F+Sacs'),jdecode(''), jdecode('%2F662.html'), 'true',[],'',''],
	['PAGE','683',jdecode('Textilien+%2F+Textiles'),jdecode(''), jdecode('%2F683.html'), 'true',[],'',''],
	['PAGE','599',jdecode('Diverses+%2F+Divers'),jdecode(''), jdecode('%2F599.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Weihnachten+%2F+No%C3%ABl'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','725',jdecode('Kontakt+deutsch'),jdecode(''), jdecode('%2F725.html'), 'true',[],'',''],
	['PAGE','116401',jdecode('Contact+fran%C3%A7ais'),jdecode(''), jdecode('%2F116401.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='6971B1';
theSitetree.keyvisualId='6306';
theSitetree.keyvisualName='kv_6306.jpg';
theSitetree.fontsetId='11151';
theSitetree.graphicsetId='11956';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D6DAF6';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Livinginamerica',
				paletteFamily: 	'6971B1',
				keyvisualId: 	'6306',
				keyvisualName: 	'kv_6306.jpg',
				fontsetId: 		'11151',
				graphicsetId: 	'11956',
				contentColor: 	'000000',
				contentBGColor: 'D6DAF6',
				a_color: 		'000000',
				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:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1672']={
webappId:    '7008',
documentId:  '725',
internalId:  '1672',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-1673']={
webappId:    '7008',
documentId:  '116401',
internalId:  '1673',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120215-125519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18901',
internalId:  '',
customField: '20120212-140345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20120212-143336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20120219-131811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20120219-133601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20120219-132759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18101',
internalId:  '',
customField: '20120219-132846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20120219-132934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '662',
internalId:  '',
customField: '20120219-134126'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '683',
internalId:  '',
customField: '20120219-135009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '599',
internalId:  '',
customField: '20120215-132419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20120205-161545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '725',
internalId:  '',
customField: '20120219-134151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '116401',
internalId:  '',
customField: '20120219-134231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '153801',
internalId:  '',
customField: '20120219-132713'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '222501',
internalId:  '-',
customField: '20120219-132008'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0IN2LNK';
var companyName   = 'www.neufi-ecke.ch';
var htmlTitle	  = 'www.neufi-ecke.ch';
var metaKeywords  = '';
var metaContents  = '';
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();
};

