/* [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','3001',jdecode('Home'),jdecode(''),'/3001.html','true',[],'',''],
	['PAGE','3052',jdecode('About+Teach+Cruach%C3%A1n'),jdecode(''),'/3052.html','true',[],'',''],
	['PAGE','3073',jdecode('Home+from+Home'),jdecode(''),'/3073.html','true',[],'',''],
	['PAGE','6201',jdecode('Rates'),jdecode(''),'/6201.html','true',[],'',''],
	['PAGE','15301',jdecode('Rooms'),jdecode(''),'/15301.html','true',[],'',''],
	['PAGE','25701',jdecode('Achill+Bikes'),jdecode(''),'/25701.html','true',[],'',''],
	['PAGE','3094',jdecode('Achill+Tours+%26+Transport'),jdecode(''),'/3094.html','true',[],'',''],
	['PAGE','3115',jdecode('Achill+News'),jdecode(''),'/3115.html','true',[],'',''],
	['PAGE','6222',jdecode('Location'),jdecode(''),'/6222.html','true',[],'',''],
	['PAGE','3136',jdecode('Contact'),jdecode(''),'/3136.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C5A858';
theSitetree.keyvisualId='6860';
theSitetree.keyvisualName='kv_6860.jpg';
theSitetree.fontsetId='11212';
theSitetree.graphicsetId='12034';
theSitetree.contentColor='64511A';
theSitetree.contentBGColor='DABB67';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'C5A858',
				keyvisualId: 	'6860',
				keyvisualName: 	'kv_6860.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: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3001',
internalId:  '',
customField: '20110124-142811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3052',
internalId:  '',
customField: '20110518-093758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3073',
internalId:  '',
customField: '20110518-093350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3094',
internalId:  '',
customField: '20110518-095321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3115',
internalId:  '',
customField: '20110518-095705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3136',
internalId:  '',
customField: '20110409-153236'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20110408-165836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6222',
internalId:  '',
customField: '20110518-095231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25701',
internalId:  '',
customField: '20110621-171529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20110518-094826'
};
webappMappings['1501']=webappMappings['1501-2530468']={
webappId:    '1501',
documentId:  '3001',
internalId:  '2530468',
customField: '1501'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH030IN2OM7';
var companyName   = 'Teach+Cruach%C3%A1n+Bed+%26+Breakfast';
var htmlTitle	  = 'Teach+Cruachan+Bed+and+Breakfast%2C+Bicycle+Hire+and+Minibus+Transport%2C+Achill+Island%2C+Co.+Mayo';
var metaKeywords  = 'Bed%2C+Breakfast%2C+B%26B%2C+Achill%2C+Island%2C+Westport%2C+Mayo%2C+Ireland%2C+Keel+West%2C+Dooagh%2C+bicycle%2C+bike+hire%2C+taxi%2C+minibus%2C+accommodation%2C+passenger%2C+ensuite%2C+sea+view%2C+Atlantic+Ocean%2C+scenery%2C+non-smoking%2C+smoke-free%2C+Scoil+Acla%2C+Keem+Bay%2C+F%C3%A9ile+Bia+na+Mara%2C+Achill+Half+Marathon%2C+highest+sea+cliffs+in+Europe%2C+double%2C+twin%2C+king%2C+Michael+Lavelle%2C+Roisin+Lavelle%2C+Michael+Flix+Lavelle%2C+Ciara+Lavelle+';
var metaContents  = 'Teach+Cruachan+Bed+and+Breakfast+offers+comfortable+accommodation+in+Keel+West%2C+Dooagh%2C+Achill+Island%2C+Co+Mayo.++Proprietors+Michael+Anthony+and+Roisin+Lavelle+also+provide+bicycle+hire+and+a+personalised+passenger+transport+service+using+their+own+licensed+minibus+to+bring+visitors+on+guided+tours%2C+to+and+from+airports+and+bus+stations%2C+and+as+a+taxi+service+for+pub+crawls+and+local+trips.+Secure+bicycle+store+and+drying+room+for+sports+enthusiasts+on+site.';
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();
};

