/* [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','1001',jdecode('V%C3%A4lkommen'),jdecode(''),'/1001.html','true',[],''],
	['PAGE','16101',jdecode('V%C3%A5r+mottagning'),jdecode(''),'/16101.html','true',[],''],
	['PAGE','16269',jdecode('Homeopati'),jdecode(''),'/16269.html','true',[],''],
	['PAGE','16248',jdecode('Laserbehandling'),jdecode(''),'/16248.html','true',[],''],
	['PAGE','16206',jdecode('Zonterapi'),jdecode(''),'/16206.html','true',[],''],
	['PAGE','16227',jdecode('Samtalet'),jdecode(''),'/16227.html','true',[],''],
	['PAGE','16122',jdecode('Irisdiagnostik'),jdecode(''),'/16122.html','true',[],''],
	['PAGE','16164',jdecode('Kontakta'),jdecode(''),'/16164.html','true',[],''],
	['PAGE','16185',jdecode('Priser+och+Tj%C3%A4nster'),jdecode(''),'/16185.html','true',[],''],
	['PAGE','21401',jdecode('L%C3%A4nkar'),jdecode(''),'/21401.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Nature';
theSitetree.paletteFamily='1503FF';
theSitetree.keyvisualId='3657';
theSitetree.keyvisualName='kv_3657.jpg';
theSitetree.fontsetId='10717';
theSitetree.graphicsetId='10879';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Nature',
				paletteFamily: 	'1503FF',
				keyvisualId: 	'3657',
				keyvisualName: 	'kv_3657.jpg',
				fontsetId: 		'10717',
				graphicsetId: 	'10879',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'1503FF',
				e_color: 		'1503FF',
				f_color: 		'1503FF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20091024-202939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20080530-083557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16269',
internalId:  '',
customField: '20080316-115713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16248',
internalId:  '',
customField: '20100215-114112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16206',
internalId:  '',
customField: '20080315-083528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16227',
internalId:  '',
customField: '20080315-100931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16122',
internalId:  '',
customField: '20080315-084544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16164',
internalId:  '',
customField: '20080903-091221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16185',
internalId:  '',
customField: '20080903-090940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21401',
internalId:  '',
customField: '20080920-105541'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INXHOQ';
var companyName   = 'Silve-kliniken+S%C3%B6dra+Lundav%C3%A4gen+10%2C+Staffanstorp';
var htmlTitle	  = 'Silvekliniken+-+center+f%C3%B6r+homeopati%2C+zonterapi+och+laserbehandling';
var metaKeywords  = 'Laserterapi%2CIrisdiagnos%2CIrisanalys%2CLaserbehandling%2Csk%C3%A5ne%2Cterapi%2Chomeopat%2Chomeopater%2Chomeopati%2Csamtalsterapi%2Czonterapi%2CHomopat';
var metaContents  = 'Homeopati%2Chomeopat%2CZonterapi%2CLaserbehandling%2Chomeopatisk%2Cbehandling%2Cirisdiagnos%2Claser%2Calternativmedicin%2Cirisdiagnos%2Chomeopat%2Cirisanalys%2Csk%C3%A5ne%2Clund%2Cmalm%C3%B6%2Cdigital%2Cirisanalys%2Chomopat%2Chomepat+';
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();
};
