/* [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','32',jdecode('Home'),jdecode(''), jdecode('%2F32%2Findex.html'), 'true',[ 
		['PAGE','1084',jdecode('Hours+of+opening'),jdecode(''), jdecode('%2F32%2F1084.html'), 'true',[],'','']
	],'',''],
	['PAGE','71',jdecode('Menu'),jdecode(''), jdecode('%2F71%2Findex.html'), 'true',[ 
		['PAGE','1093',jdecode('Offers'),jdecode(''), jdecode('%2F71%2F1093.html'), 'true',[],'','']
	],'',''],
	['PAGE','62',jdecode('Bed+and+Breakfast'),jdecode(''), jdecode('%2F62.html'), 'true',[],'',''],
	['PAGE','80',jdecode('Events%2FBeers+Coming+Up'),jdecode(''), jdecode('%2F80.html'), 'true',[],'',''],
	['PAGE','89',jdecode('About+Us'),jdecode(''), jdecode('%2F89%2Findex.html'), 'true',[ 
		['PAGE','107',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F89%2F107.html'), 'true',[],'','']
	],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C5A858';
theSitetree.keyvisualId='6855';
theSitetree.keyvisualName='kv_6855.jpg';
theSitetree.fontsetId='11212';
theSitetree.graphicsetId='12034';
theSitetree.contentColor='64511A';
theSitetree.contentBGColor='DABB67';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hostway',
  product: 'WSCSYSSSSLYTC241'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'C5A858',
				keyvisualId: 	'6855',
				keyvisualName: 	'kv_6855.jpg',
				fontsetId: 		'11212',
				graphicsetId: 	'12034',
				contentColor: 	'64511A',
				contentBGColor: 'DABB67',
				a_color: 		'DABB67',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC241']={
webappId:    '5003',
documentId:  '32',
internalId:  'tid:1;pid:WSCSYSSSSLYTC241',
customField: 'en:US:'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20120103-075552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1084',
internalId:  '',
customField: '20110521-075711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71',
internalId:  '',
customField: '20110920-174604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1093',
internalId:  '',
customField: '20110622-164731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20080613-004932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80',
internalId:  '',
customField: '20120103-080556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89',
internalId:  '',
customField: '20110920-175532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107',
internalId:  '',
customField: '20100913-123536'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3HOH';
var companyName   = 'The+Stan+Laurel+Inn';
var htmlTitle	  = 'The+Stan+Laurel';
var metaKeywords  = '%2FStan+Laurel+Inn%2C+bed+and+breakfast%2C+cumbria%2C+lake+district%2C+laurel+and+hardy%2C+accommodation%2C+stans+birthplace%2C+cask+ale%2C+good+food%2C+ulverston%2C+stan+laurel%2C+stan%2C+paul+dewar%2C+trudi+dewar.+ulverston+places+to+eat.+places+to+eat+in+cumbria.+cask+ale+in+ulverston.+real+ale+ulverston.+bed+and+breakfast+in+the+lake+district.+bed+and+breakfast+in+cumbria.+friendly+atmosphere.+friendly+service.+excellent+service.+camra.+good+beer+guide.+camra+good+beer+guide%2Fstan+laurel%2F+the+stan+laurel%2Fthe+stan+laurel+inn%2C+chunky+chips';
var metaContents  = '+%2FThe+Stan+Laurel+Inn+providing+good+food%2C+accommodation%2C+cask+ales%2C+beers+and+a+friendly+atmosphere.good+food+in+cumbria.+good+food+in+ulverston.+ulverston+real+ales.+cask+ale+ulverston.+places+to+eat+in+ulverston.++places+to+eat+in+cumbria.++stan+laurel.+real+ale+in.+cask+ale+inn.+cask+ale+pub.+real+ale+pub.+ulverston+brewing+company.+bed+and+breakfast+in+cumbria.+bed+and+breakfast.+bed+and+breakfast+in+the+lake+district.+real+ale+in+the+lake+district.+good+food+and+ale.+good+ale+and+good+food.+friendly+atmosphere.+friendly+service.+excellent+service.+stringers+ale.+camra.+good+beer+guide.+camra+ood+beer+guide.+stan+laurel%2C+the+stan+laurel%2Fthe+stan+laurel+inn+chunky+chips';
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();
};

