/* [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','2901',jdecode('Home'),jdecode(''),'/2901.html','true',[],''],
	['PAGE','105201',jdecode('About+B%26B'),jdecode(''),'/105201.html','true',[],''],
	['PAGE','104801',jdecode('The+Suites'),jdecode(''),'/104801.html','true',[],''],
	['PAGE','104822',jdecode('The+New+York+Suite'),jdecode(''),'/104822.html','true',[],''],
	['PAGE','104843',jdecode('The+Paris+Suite'),jdecode(''),'/104843.html','true',[],''],
	['PAGE','104864',jdecode('The+San+Francisco+Suite'),jdecode(''),'/104864.html','true',[],''],
	['PAGE','104885',jdecode('The+London+Suite'),jdecode(''),'/104885.html','true',[],''],
	['PAGE','136601',jdecode('Breakfast'),jdecode(''),'/136601.html','true',[],''],
	['PAGE','105222',jdecode('Location'),jdecode(''),'/105222.html','true',[],''],
	['PAGE','104301',jdecode('Online+Reservation'),jdecode(''),'/104301.html','true',[],''],
	['PAGE','104001',jdecode('Photo+Gallery'),jdecode(''),'/104001.html','true',[],''],
	['PAGE','104427',jdecode('Contact'),jdecode(''),'/104427.html','true',[],''],
	['PAGE','140401',jdecode('Specials'),jdecode(''),'/140401.html','true',[],''],
	['PAGE','140322',jdecode('Stratford'),jdecode(''),'/140322.html','true',[],''],
	['PAGE','158601',jdecode('ECO+B%26B'),jdecode(''),'/158601.html','true',[],''],
	['PAGE','336823',jdecode('TripAdvisor'),jdecode(''),'/336823.html','true',[],''],
	['PAGE','343123',jdecode('Art'),jdecode(''),'/343123.html','true',[],''],
	['PAGE','140301',jdecode('Angel+Rivero+%28Andy%29'),jdecode(''),'/140301.html','true',[],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Card';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='427';
theSitetree.graphicsetId='479';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Card',
				paletteFamily: 	'990000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'427',
				graphicsetId: 	'479',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20091127-165946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105201',
internalId:  '',
customField: '20091127-103533'
};
webappMappings['7060']=webappMappings['7060-f51ff16025d5babf7b0e45dc68d3eb17']={
webappId:    '7060',
documentId:  '104001',
internalId:  'f51ff16025d5babf7b0e45dc68d3eb17',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104001',
internalId:  '',
customField: '20090406-213126'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104801',
internalId:  '',
customField: '20091127-102709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104301',
internalId:  '',
customField: '20091125-162901'
};
webappMappings['7008']=webappMappings['7008-2792']={
webappId:    '7008',
documentId:  '104427',
internalId:  '2792',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104427',
internalId:  '',
customField: '20091014-134150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '158601',
internalId:  '',
customField: '20091127-083258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105222',
internalId:  '',
customField: '20091127-103308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '136601',
internalId:  '',
customField: '20091127-103137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104822',
internalId:  '',
customField: '20091127-102813'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104843',
internalId:  '',
customField: '20091127-102841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104864',
internalId:  '',
customField: '20091127-102925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104885',
internalId:  '',
customField: '20091127-103010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140401',
internalId:  '',
customField: '20091127-084118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '336823',
internalId:  '',
customField: '20091127-173034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140301',
internalId:  '',
customField: '20091127-135342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140322',
internalId:  '',
customField: '20091127-103759'
};
webappMappings['7060']=webappMappings['7060-1b341bce034ffd2bf051e797a2da7ee7']={
webappId:    '7060',
documentId:  '140301',
internalId:  '1b341bce034ffd2bf051e797a2da7ee7',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '343123',
internalId:  '',
customField: '20091127-163931'
};
webappMappings['7060']=webappMappings['7060-980453620cb46499a8924db5198c6dec']={
webappId:    '7060',
documentId:  '343123',
internalId:  '980453620cb46499a8924db5198c6dec',
customField: 'language:en;country:US;'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INVL83';
var companyName   = 'The+QUEEN+and+ALBERT+B%26B+INN+Stratford+Ontario+Canada';
var htmlTitle	  = 'The+Queen+and+Albert+Bed+and+Breakfast+B%26B+INN+Stratford+Ontario+Canada';
var metaKeywords  = 'stratford%2C+ontario%2C+canada%2C+theatre%2C+BB%2C+B++B%2C+bed+and+breakfast%2C+theater%2C+festival+theatre%2C+festival+theater%2C+avon+theatre%2C+avon+theater%2C+stratford+information%2C+information%2C+accommodations%2C+restaurants%2C+info%2C+stratford+ontario%2C+shakespearean+theatre%2C+shakespearean+theater%2C+shakespeare%2C+bard%2C+william+shakespeare%2C+Stratford%2C+Festival%2C+Swan%2C+Hotel%2C+bed%2C+breakfast%2C+Inn%2C+tourism%2C+hospitality%2C+Antoni+Cimilino%2C+Des+McAnuff%2C+swan%2C+restaurants%2C+shopping%2C+musicals%2C+broadway%2C+Avon%2C+Colem+Feore%2C+chef+school%2C+reservations%2C+suites%2C+queen%2C+albert%2C+welcome%2C+hospitality%2C+SABBA';
var metaContents  = 'The+Queen+and+Albert+BB+is+a+bed+and+breakfast+located+up+the+street+from+the+Stratford+Shakespeare+Festival+Theatre+in+Stratford%2C+Ontario%2C+Canada.+We+have+four+large+well+appointed+guest+suites%2C+convenient+Stratford+location+and+superb+breakfasts.+The+BB+has+many+hotel+and+inn+like+features+yet+retains+the+intimate+feel+of+a+bed+and+breakfast.+A+great+home+base+for+all+of+your+arts+and+theater+adventures%2C+culinary+side+trips+and+simple+small+town+relaxation.+Where+accommodation+is+more+than+a+bed.';
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();
};
