/* [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','23855',jdecode('Willkommen'),jdecode(''), jdecode('%2F23855.html'), 'true',[],'',''],
	['PAGE','36397',jdecode('%C3%9Cber+mich'),jdecode(''), jdecode('%2F36397.html'), 'true',[],'',''],
	['PAGE','46387',jdecode('Ausbildung'),jdecode(''), jdecode('%2F46387.html'), 'true',[],'',''],
	['PAGE','3771',jdecode('Preisliste'),jdecode(''), jdecode('%2F3771.html'), 'true',[],'',''],
	['PAGE','1420',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F1420.html'), 'true',[],'',''],
	['PAGE','64808',jdecode('Galerie+Nail+Art'),jdecode(''), jdecode('%2F64808.html'), 'true',[],'',''],
	['PAGE','64829',jdecode('Galerie+Fussn%C3%A4gel'),jdecode(''), jdecode('%2F64829.html'), 'true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Handout';
theSitetree.paletteFamily='8AAB35';
theSitetree.keyvisualId='11660';
theSitetree.keyvisualName='kv_11660.jpg';
theSitetree.fontsetId='32956';
theSitetree.graphicsetId='13990';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='8AAB35';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'webland',
  product: 'WSCSYSSSSLY0XFFS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Handout',
				paletteFamily: 	'8AAB35',
				keyvisualId: 	'11660',
				keyvisualName: 	'kv_11660.jpg',
				fontsetId: 		'32956',
				graphicsetId: 	'13990',
				contentColor: 	'FFFFFF',
				contentBGColor: '8AAB35',
				a_color: 		'FFFFFF',
				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['7060']=webappMappings['7060-d8c85f4d5a662d558102e7d5040ee409']={
webappId:    '7060',
documentId:  '46387',
internalId:  'd8c85f4d5a662d558102e7d5040ee409',
customField: 'language:de;country:CH;'
};
webappMappings['7002']=webappMappings['7002-3280']={
webappId:    '7002',
documentId:  '1420',
internalId:  '3280',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36397',
internalId:  '',
customField: '20120121-200831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64808',
internalId:  '',
customField: '20120124-104136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64829',
internalId:  '',
customField: '20120124-104213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46387',
internalId:  '',
customField: '20120121-201125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3771',
internalId:  '',
customField: '20120124-104253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1420',
internalId:  '',
customField: '20090924-141606'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '23855',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23855',
internalId:  '',
customField: '20120124-104528'
};
webappMappings['7060']=webappMappings['7060-e58077d98ea08e33d69ab476e9221034']={
webappId:    '7060',
documentId:  '64808',
internalId:  'e58077d98ea08e33d69ab476e9221034',
customField: 'language:de;country:CH;'
};
webappMappings['7060']=webappMappings['7060-04cdb4db55dfd14f9c3755152bfa89cd']={
webappId:    '7060',
documentId:  '64829',
internalId:  '04cdb4db55dfd14f9c3755152bfa89cd',
customField: 'language:de;country:CH;'
};
var webAppHostname = 'wsc-app.webland.ch:80';
var canonHostname = 'wsc02.webland.ch';
var accountId     = 'AWB010IN216Q';
var companyName   = 'Patricia+Nail%27s';
var htmlTitle	  = 'Patricia+Nail%27s+';
var metaKeywords  = '';
var metaContents  = 'Nagelstudio%2C+NailArt%2C+Stamping%2C+Geln%C3%A4gel%2C+Thurgau%2C+Tobel%2C+Ostschweiz%2C+Naildesingn%2C+Nails%2C+N%C3%A4gel';
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();
};

