/* [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','578',jdecode('%3EAPPOINTMENTS%3C'),jdecode(''),'/578.html','true',[],''],
	['PAGE','20401',jdecode('Welcome+%26+News'),jdecode(''),'/20401.html','true',[],''],
	['PAGE','401',jdecode('About+Us'),jdecode(''),'/401.html','true',[],''],
	['PAGE','473',jdecode('FAQ'),jdecode(''),'/473.html','true',[],''],
	['PAGE','494',jdecode('Our+Salon+Offers+.+.+.'),jdecode(''),'/494.html','true',[],''],
	['PAGE','557',jdecode('Links'),jdecode(''),'/557.html','true',[],''],
	['PAGE','452',jdecode('Expert+Edge+Sharpening'),jdecode(''),'/452.html','true',[],''],
	['PAGE','14501',jdecode('Contact+Us'),jdecode(''),'/14501/index.html','true',[ 
		['PAGE','16101',jdecode('Contact+Us+%28follow+up+page%29'),jdecode(''),'/14501/16101.html','false',[],'']
	],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Fields';
theSitetree.paletteFamily='0D0D0D';
theSitetree.keyvisualId='11295';
theSitetree.keyvisualName='kv_11295.jpg';
theSitetree.fontsetId='31968';
theSitetree.graphicsetId='13806';
theSitetree.contentColor='BCBE91';
theSitetree.contentBGColor='0D0D0D';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Fields',
				paletteFamily: 	'0D0D0D',
				keyvisualId: 	'11295',
				keyvisualName: 	'kv_11295.jpg',
				fontsetId: 		'31968',
				graphicsetId: 	'13806',
				contentColor: 	'BCBE91',
				contentBGColor: '0D0D0D',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '20401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20090728-134856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20090728-134956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090728-134815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20090728-135203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20090728-133942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20090728-134142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090301-114432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20090728-134308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16101',
internalId:  '',
customField: '20071101-091753'
};
webappMappings['7008']=webappMappings['7008-59']={
webappId:    '7008',
documentId:  '14501',
internalId:  '59',
customField: 'language:en;country:US;'
};
var canonHostname = 'cm1b.dca2.superb.net';
var accountId     = 'ASB030IN2M9N';
var companyName   = 'Studio+915+Salon';
var htmlTitle	  = 'Studio+915+Hair+Salon+Winchester+VA';
var metaKeywords  = 'hair%2C+salon%2C+winchester%2C+VA%2C+22601%2C+beauty%2C+cut%2C+haircut%2C+color%2C+highlights%2C+hilite%2C+hilight%2C+perm%2C+style%2C+Aquage%2C+shampoo%2C+conditioner%2C+hair+spray%2C+style%2C+wedding%2C+prom%2C+day+spa%2C+hairdresser%2C+hair+stylist%2C+cosmetologist%2C+best+hairdresser%2C+best+salon%2C+Scott+Wadley%2C+scissor+sharpening%2C+Goldwell%2C+Nioxin%2C+corrective+color';
var metaContents  = 'Studio+915+Salon+in+Winchester%2C+VA+focuses+on+healthy+hair+as+the+basis+for+beautiful+styles.';
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();
};
