/* [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','8801',jdecode('Home'),jdecode(''),'/8801.html','true',[],'',''],
	['PAGE','33301',jdecode('Boat+Names'),jdecode(''),'/33301.html','true',[],'',''],
	['PAGE','45422',jdecode('Yacht+Clubs'),jdecode(''),'/45422.html','true',[],'',''],
	['PAGE','45401',jdecode('Style+%26+Effects'),jdecode(''),'/45401.html','true',[],'',''],
	['PAGE','52901',jdecode('Reg.+Numbers'),jdecode(''),'/52901.html','true',[],'',''],
	['PAGE','52101',jdecode('Testimonials'),jdecode(''),'/52101.html','true',[],'',''],
	['PAGE','54801',jdecode('Dealer+service'),jdecode(''),'/54801.html','true',[],'',''],
	['PAGE','32401',jdecode('Contact+Us'),jdecode(''),'/32401.html','true',[],'',''],
	['PAGE','59201',jdecode('YYC+Hospice+'),jdecode(''),'/59201.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Guest';
theSitetree.paletteFamily='B1C6D8';
theSitetree.keyvisualId='11762';
theSitetree.keyvisualName='kv_11762.jpg';
theSitetree.fontsetId='33049';
theSitetree.graphicsetId='14028';
theSitetree.contentColor='003366';
theSitetree.contentBGColor='E4E9F1';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Guest',
				paletteFamily: 	'B1C6D8',
				keyvisualId: 	'11762',
				keyvisualName: 	'kv_11762.jpg',
				fontsetId: 		'33049',
				graphicsetId: 	'14028',
				contentColor: 	'003366',
				contentBGColor: 'E4E9F1',
				a_color: 		'000000',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20110710-100941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32401',
internalId:  '',
customField: '20090929-065835'
};
webappMappings['7008']=webappMappings['7008-3697']={
webappId:    '7008',
documentId:  '32401',
internalId:  '3697',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33301',
internalId:  '',
customField: '20090929-064942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45422',
internalId:  '',
customField: '20091020-231236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52901',
internalId:  '',
customField: '20090929-065526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52101',
internalId:  '',
customField: '20090929-070800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59201',
internalId:  '',
customField: '20110710-101118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54801',
internalId:  '',
customField: '20091020-140040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45401',
internalId:  '',
customField: '20090929-065306'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN2IWE';
var companyName   = 'Niagara+Graphic';
var htmlTitle	  = 'Niagara+Graphic';
var metaKeywords  = 'buffalo%2C+vinyl+%2C+graphics%2C+boat%2C+yachts%2C+lettering%2C+sailboats%2C+yacht+club%2C+niagara+graphic%2C+registration%2C+numbers%2C+youngstown%2C+lake+erie%2C+lake+ontario%2C+power+boats%2C+sail+%2C+metalflake%2C+engine+turn';
var metaContents  = 'Quality++affordable+custom+vinyl+boat+names%2F+graphics+to+the+Western+New+York+area%2C+in+the+water+application+available.+Focus+on+customer+service.+';
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();
};

