/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('About+us'),jdecode(''),'/452/index.html','true',[ 
		['PAGE','473',jdecode('Mission'),jdecode(''),'/452/473.html','true',[],''],
		['PAGE','6739',jdecode('Veterinarians'),jdecode(''),'/452/6739.html','true',[],''],
		['PAGE','494',jdecode('Staff'),jdecode(''),'/452/494.html','true',[],'']
	],''],
	['PAGE','6748',jdecode('Services'),jdecode(''),'/6748/index.html','true',[ 
		['PAGE','6757',jdecode('Preventative+Care'),jdecode(''),'/6748/6757.html','true',[],''],
		['PAGE','6766',jdecode('Reproduction'),jdecode(''),'/6748/6766.html','true',[],''],
		['PAGE','6775',jdecode('Foal+Care'),jdecode(''),'/6748/6775.html','true',[],''],
		['PAGE','6784',jdecode('Lameness+%26+Sports+Medicine'),jdecode(''),'/6748/6784.html','true',[],''],
		['PAGE','6793',jdecode('Internal+Medicine'),jdecode(''),'/6748/6793.html','true',[],''],
		['PAGE','6802',jdecode('Surgery'),jdecode(''),'/6748/6802.html','true',[],''],
		['PAGE','6820',jdecode('Nutrition'),jdecode(''),'/6748/6820.html','true',[],''],
		['PAGE','6829',jdecode('Emergencies'),jdecode(''),'/6748/6829.html','true',[],'']
	],''],
	['PAGE','6838',jdecode('Our+Facility'),jdecode(''),'/6838.html','true',[],''],
	['PAGE','515',jdecode('News'),jdecode(''),'/515/index.html','true',[ 
		['PAGE','536',jdecode('Newsletter'),jdecode(''),'/515/536.html','true',[],''],
		['PAGE','557',jdecode('Clinics+and+seminars'),jdecode(''),'/515/557.html','true',[],''],
		['PAGE','578',jdecode('Medical+news'),jdecode(''),'/515/578.html','true',[],''],
		['PAGE','599',jdecode('Client+news'),jdecode(''),'/515/599.html','true',[],'']
	],''],
	['PAGE','620',jdecode('F.A.Q.'),jdecode(''),'/620.html','true',[],''],
	['PAGE','641',jdecode('Contact+Us'),jdecode(''),'/641.html','true',[],''],
	['PAGE','683',jdecode('Directions'),jdecode(''),'/683.html','true',[],'']];
var siteelementCount=23;
theSitetree.topTemplateName='Easylife';
theSitetree.paletteFamily='41912E';
theSitetree.keyvisualId='5814';
theSitetree.keyvisualName='kv_5814.jpg';
theSitetree.fontsetId='11097';
theSitetree.graphicsetId='11872';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Easylife',
				paletteFamily: 	'41912E',
				keyvisualId: 	'5814',
				keyvisualName: 	'kv_5814.jpg',
				fontsetId: 		'11097',
				graphicsetId: 	'11872',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100219-130811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100204-132414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20090208-111450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20100216-121058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100210-113756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20100219-131858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20100216-120939'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20090208-123130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '599',
internalId:  '',
customField: '20090208-120508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20100216-114434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '641',
internalId:  '',
customField: '20100204-133619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6838',
internalId:  '',
customField: '20100216-132013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '683',
internalId:  '',
customField: '20100216-115428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6748',
internalId:  '',
customField: '20100216-095519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6739',
internalId:  '',
customField: '20100219-132114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6757',
internalId:  '',
customField: '20100216-132219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6766',
internalId:  '',
customField: '20100216-132615'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6775',
internalId:  '',
customField: '20100216-113730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6829',
internalId:  '',
customField: '20100216-103824'
};
webappMappings['1501']=webappMappings['1501-6428302']={
webappId:    '1501',
documentId:  '401',
internalId:  '6428302',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6784',
internalId:  '',
customField: '20100216-121619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6793',
internalId:  '',
customField: '20100216-133041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6802',
internalId:  '',
customField: '20100216-103530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6820',
internalId:  '',
customField: '20100216-100621'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INE36I';
var companyName   = 'Equine+Medical+Services';
var htmlTitle	  = '';
var metaKeywords  = 'equine%2C+veterinary%2C+horse%2C+veterinarian%2C+Virginia%2C+West+Virginia%2C+shenandoah%2C+winchester%2C+berryville%2C+Equine+Medical+Services%2C+northern+virginia%2C+virginia+veterinarian%2C+equine+reproduction%2C+equine+medicine%2C+horse+doctor%2C+foal%2C+lameness%2C+';
var metaContents  = 'Equine+veterinary+services+offered+in+Virginia+and+West+Virginia.';
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();
};
