/* [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','10201',jdecode('Home'),jdecode(''), jdecode('%2F10201.html'), 'true',[],'',''],
	['ITEM','27001',jdecode('Online+Booking'),jdecode(''), jdecode('http%3A%2F%2Fwww.mysalononline.com%2Ftherazorsedge%2F'), 'true',[],'','_blank'],
	['ITEM','27002',jdecode('Like+us+on+Facebook%21'),jdecode(''), jdecode('http%3A%2F%2Fwww.facebook.com%2Fpages%2FThe-Razors-Edge%2F92242866316'), 'true',[],'','_blank'],
	['PAGE','10357',jdecode('About+us'),jdecode(''), jdecode('%2F10357%2Findex.html'), 'true',[ 
		['PAGE','10378',jdecode('Opening+Hours'),jdecode(''), jdecode('%2F10357%2F10378.html'), 'true',[],'',''],
		['PAGE','10399',jdecode('Our+Team'),jdecode(''), jdecode('%2F10357%2F10399.html'), 'true',[],'','']
	],'',''],
	['PAGE','10315',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F10315.html'), 'true',[],'',''],
	['PAGE','10336',jdecode('Contact'),jdecode(''), jdecode('%2F10336.html'), 'true',[],'',''],
	['PAGE','10294',jdecode('Tips+and+tricks'),jdecode(''), jdecode('%2F10294.html'), 'true',[],'',''],
	['PAGE','10420',jdecode('Jobs'),jdecode(''), jdecode('%2F10420.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Brush';
theSitetree.paletteFamily='8EBF7B';
theSitetree.keyvisualId='11942';
theSitetree.keyvisualName='kv_11942.jpg';
theSitetree.fontsetId='33222';
theSitetree.graphicsetId='14101';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Brush',
				paletteFamily: 	'8EBF7B',
				keyvisualId: 	'11942',
				keyvisualName: 	'kv_11942.jpg',
				fontsetId: 		'33222',
				graphicsetId: 	'14101',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Tahoma',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-10477']={
webappId:    '7008',
documentId:  '10336',
internalId:  '10477',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20110914-114838'
};
webappMappings['1501']=webappMappings['1501-15867686']={
webappId:    '1501',
documentId:  '10201',
internalId:  '15867686',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10294',
internalId:  '',
customField: '20090821-160936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10315',
internalId:  '',
customField: '20090820-190658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10336',
internalId:  '',
customField: '20110914-114712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10357',
internalId:  '',
customField: '20110208-194002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10378',
internalId:  '',
customField: '20110914-113209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10420',
internalId:  '',
customField: '20110208-195647'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10399',
internalId:  '',
customField: '20110914-114359'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHXKD';
var companyName   = 'The+Razor%27s+Edge+Salon';
var htmlTitle	  = 'The+Razor%27s+Edge+Salon';
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();
};

