/* [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','4901',jdecode('Home'),jdecode(''), jdecode('%2F4901.html'), 'true',[],'',''],
	['PAGE','4952',jdecode('The+house'),jdecode(''), jdecode('%2F4952.html'), 'true',[],'',''],
	['PAGE','11401',jdecode('Pictures+of+Rosie%26%23x27%3Bs+House'),jdecode(''), jdecode('%2F11401.html'), 'true',[],'',''],
	['PAGE','4978',jdecode('Directions+and+parking'),jdecode(''), jdecode('%2F4978%2Findex.html'), 'true',[ 
		['PAGE','18601',jdecode('Map'),jdecode(''), jdecode('%2F4978%2F18601.html'), 'true',[],'','']
	],'',''],
	['PAGE','5004',jdecode('Local+amenities'),jdecode(''), jdecode('%2F5004.html'), 'true',[],'',''],
	['PAGE','5030',jdecode('Bridlington+and+the+area'),jdecode(''), jdecode('%2F5030.html'), 'true',[],'',''],
	['PAGE','22301',jdecode('Guest+comments'),jdecode(''), jdecode('%2F22301.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Prices+and+availability'),jdecode(''), jdecode('%2F5301.html'), 'true',[],'',''],
	['PAGE','17701',jdecode('Join+our+mailing+list'),jdecode(''), jdecode('%2F17701.html'), 'true',[],'',''],
	['PAGE','5056',jdecode('Contact+us'),jdecode(''), jdecode('%2F5056%2Findex.html'), 'true',[ 
		['PAGE','5082',jdecode('Enquiry+form'),jdecode(''), jdecode('%2F5056%2F5082.html'), 'true',[],'','']
	],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Linedup';
theSitetree.paletteFamily='4270B8';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10359';
theSitetree.graphicsetId='10505';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4270B8';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Linedup',
				paletteFamily: 	'4270B8',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10359',
				graphicsetId: 	'10505',
				contentColor: 	'FFFFFF',
				contentBGColor: '4270B8',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-7478']={
webappId:    '7008',
documentId:  '5082',
internalId:  '7478',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20100926-132355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4952',
internalId:  '',
customField: '20100927-212345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5030',
internalId:  '',
customField: '20100801-092609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4978',
internalId:  '',
customField: '20100724-140014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5004',
internalId:  '',
customField: '20100623-073122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20120216-110713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5056',
internalId:  '',
customField: '20100724-134617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5082',
internalId:  '',
customField: '20100620-204524'
};
webappMappings['7060']=webappMappings['7060-2ff85f63f9e1f1cc2573e49b7dce9c16']={
webappId:    '7060',
documentId:  '11401',
internalId:  '2ff85f63f9e1f1cc2573e49b7dce9c16',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22301',
internalId:  '',
customField: '20110622-094416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11401',
internalId:  '',
customField: '20100628-214647'
};
webappMappings['7008']=webappMappings['7008-7627']={
webappId:    '7008',
documentId:  '17701',
internalId:  '7627',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20100726-122501'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '18601',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20100724-135828'
};
webappMappings['1501']=webappMappings['1501-11682750']={
webappId:    '1501',
documentId:  '4901',
internalId:  '11682750',
customField: '1501'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3YXH';
var companyName   = 'Rosie%27s+House+at+Bridlington';
var htmlTitle	  = 'Rosie%27s+House+-+4+bedroom+holiday+let+in+Bridlington';
var metaKeywords  = 'Rosie%27s+House%2C+Bridlington%2C+Four+bedroom%2C+Holiday+let%2C+Self-catering%2C+East+Yorkshire%2C+Yorkshire+Coast%2C+Family%2C+Scarborough%2C+Filey%2C+Flamborough';
var metaContents  = 'Rosie%27s+House+is+a+four+bedroom%2C+self-catering+holiday+let+in+Bridlington';
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();
};

