/* [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','3222',jdecode('BAYVIEWWOODS+ANIMAL+HOSPITAL'),jdecode(''), jdecode('%2F3222.html'), 'true',[],'',''],
	['PAGE','22801',jdecode('Service'),jdecode(''), jdecode('%2F22801.html'), 'true',[],'',''],
	['PAGE','22822',jdecode('Contact'),jdecode(''), jdecode('%2F22822.html'), 'true',[],'',''],
	['PAGE','22843',jdecode('About+us'),jdecode(''), jdecode('%2F22843%2Findex.html'), 'true',[ 
		['PAGE','22864',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F22843%2F22864.html'), 'true',[],'',''],
		['PAGE','22885',jdecode('Our+team'),jdecode(''), jdecode('%2F22843%2F22885.html'), 'true',[],'','']
	],'',''],
	['PAGE','66301',jdecode('Hospital+tour'),jdecode(''), jdecode('%2F66301.html'), 'true',[],'',''],
	['PAGE','22927',jdecode('Opening+hours'),jdecode(''), jdecode('%2F22927.html'), 'true',[],'',''],
	['PAGE','22948',jdecode('Interesting+links'),jdecode(''), jdecode('%2F22948.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Ragtime';
theSitetree.paletteFamily='9BA8DA';
theSitetree.keyvisualId='3575';
theSitetree.keyvisualName='kv_3575.jpg';
theSitetree.fontsetId='10452';
theSitetree.graphicsetId='10850';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRNC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Ragtime',
				paletteFamily: 	'9BA8DA',
				keyvisualId: 	'3575',
				keyvisualName: 	'kv_3575.jpg',
				fontsetId: 		'10452',
				graphicsetId: 	'10850',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'9BA8DA',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'8D8C8C',
				e_color: 		'7D87B0',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3222',
internalId:  '',
customField: '20110821-133730'
};
webappMappings['1501']=webappMappings['1501-23757798']={
webappId:    '1501',
documentId:  '3222',
internalId:  '23757798',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22822',
internalId:  '',
customField: '20110621-130916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22801',
internalId:  '',
customField: '20111012-173455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22843',
internalId:  '',
customField: '20100411-203111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22864',
internalId:  '',
customField: '20100411-203224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22885',
internalId:  '',
customField: '20100411-230143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66301',
internalId:  '',
customField: '20100411-210744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22927',
internalId:  '',
customField: '20101105-220834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22948',
internalId:  '',
customField: '20100220-105602'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3222',
internalId:  '1006',
customField: '1006'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INVQZ6';
var companyName   = 'Bayview+Woods+Animal+Hospital%2C+Richmond+Hill';
var htmlTitle	  = 'Bayviewwoods+Animal+Hospital%2C+Veterinarian%2CRichmond+Hill%2CMarkham%2CThornhill%2C9052375844';
var metaKeywords  = 'animal+hospital+richmond+hill%2C+pet+pospital+richmond+hill%2C+veterinarian+richmond+hill+%2C+veterinary+hospital+richmond+hill%2C+veterinary+clinic+richmond+hill%2C+animal+clinic+richmond+hill%2C+richmond+hill%2C+markham%2C+vaughan%2C+thornhill%2C+maple%2C+aurora%2C+toronto%2C++animah+hospital+thornhill%2C+animal+clinic+Thornhill%2C+pet+hospital+Thornhill%2C+vet+hospital+Thornhill%2C+veterinary+hospitalThornhill%2C+veterinary+clinic+Thornhill%2C+veterinarians%2C+vet+clinic+richmond+hill%2C+animal+hospital+markham%2C+veterinary+hospital+markham%2C+vet+clinic+markham';
var metaContents  = 'Bayviewwoods+animal+hospital%2C+Veterinarian%2C++Richmond+hill%2C+Markham%2CThornhill%2C+905+237+5844';
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();
};

