/* [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','601',jdecode('Home'),jdecode(''), jdecode('%2F601.html'), 'true',[],'',''],
	['PAGE','652',jdecode('About+Kingscastle'),jdecode(''), jdecode('%2F652%2Findex.html'), 'true',[ 
		['PAGE','673',jdecode('The+King+Family'),jdecode(''), jdecode('%2F652%2F673.html'), 'true',[],'','']
	],'',''],
	['PAGE','778',jdecode('Mini+Australian+Shepherd'),jdecode(''), jdecode('%2F778.html'), 'true',[],'',''],
	['PAGE','799',jdecode('PUPPIES'),jdecode(''), jdecode('%2F799.html'), 'true',[],'',''],
	['PAGE','757',jdecode('HORSES+FORSALE'),jdecode(''), jdecode('%2F757.html'), 'true',[],'',''],
	['PAGE','694',jdecode('STALLIONS'),jdecode(''), jdecode('%2F694.html'), 'true',[],'',''],
	['PAGE','715',jdecode('MARES'),jdecode(''), jdecode('%2F715.html'), 'true',[],'',''],
	['PAGE','49483',jdecode('FOALS'),jdecode(''), jdecode('%2F49483%2Findex.html'), 'true',[ 
		['PAGE','85523',jdecode('FOALS+2011'),jdecode(''), jdecode('%2F49483%2F85523.html'), 'true',[],'',''],
		['PAGE','60523',jdecode('FOALS+2010'),jdecode(''), jdecode('%2F49483%2F60523.html'), 'true',[],'',''],
		['PAGE','49931',jdecode('FOALS+2009'),jdecode(''), jdecode('%2F49483%2F49931.html'), 'true',[],'',''],
		['PAGE','46101',jdecode('FOALS+2008'),jdecode(''), jdecode('%2F49483%2F46101.html'), 'true',[],'',''],
		['PAGE','12964',jdecode('FOALS+2007'),jdecode(''), jdecode('%2F49483%2F12964.html'), 'true',[],'',''],
		['PAGE','12943',jdecode('FOALS+2006'),jdecode(''), jdecode('%2F49483%2F12943.html'), 'true',[],'',''],
		['PAGE','12922',jdecode('FOALS+2005'),jdecode(''), jdecode('%2F49483%2F12922.html'), 'true',[],'',''],
		['PAGE','12901',jdecode('FOALS+2004'),jdecode(''), jdecode('%2F49483%2F12901.html'), 'true',[],'',''],
		['PAGE','736',jdecode('FOALS+2003'),jdecode(''), jdecode('%2F49483%2F736.html'), 'true',[],'','']
	],'',''],
	['PAGE','988',jdecode('FRIEND+HORSES+4SALE'),jdecode(''), jdecode('%2F988.html'), 'true',[],'',''],
	['PAGE','820',jdecode('BARN+BUDDIES'),jdecode(''), jdecode('%2F820.html'), 'true',[],'',''],
	['PAGE','17601',jdecode('Trainers'),jdecode(''), jdecode('%2F17601.html'), 'true',[],'',''],
	['PAGE','17622',jdecode('Antiques+%26+Collectables'),jdecode(''), jdecode('%2F17622.html'), 'true',[],'',''],
	['PAGE','883',jdecode('Blacksmith%26%23x27%3Bs+Nail'),jdecode(''), jdecode('%2F883%2Findex.html'), 'true',[ 
		['PAGE','862',jdecode('Horse+Tack'),jdecode(''), jdecode('%2F883%2F862.html'), 'true',[],'','']
	],'',''],
	['PAGE','904',jdecode('TREES'),jdecode(''), jdecode('%2F904.html'), 'true',[],'',''],
	['PAGE','925',jdecode('VINEYARD'),jdecode(''), jdecode('%2F925%2Findex.html'), 'true',[ 
		['PAGE','946',jdecode('Vineyard+Supplies'),jdecode(''), jdecode('%2F925%2F946.html'), 'true',[],'',''],
		['PAGE','967',jdecode('Vines+forsale'),jdecode(''), jdecode('%2F925%2F967.html'), 'true',[],'','']
	],'',''],
	['PAGE','1030',jdecode('Tips+Tricks+%26+Rib+Ticklers'),jdecode(''), jdecode('%2F1030.html'), 'true',[],'',''],
	['PAGE','49537',jdecode('POETRY'),jdecode(''), jdecode('%2F49537.html'), 'true',[],'',''],
	['PAGE','1051',jdecode('Interesting+links'),jdecode(''), jdecode('%2F1051.html'), 'true',[],'',''],
	['PAGE','1072',jdecode('Contact'),jdecode(''), jdecode('%2F1072%2Findex.html'), 'true',[ 
		['PAGE','1093',jdecode('Address'),jdecode(''), jdecode('%2F1072%2F1093.html'), 'true',[],'',''],
		['PAGE','1114',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F1072%2F1114.html'), 'true',[],'','']
	],'','']];
var siteelementCount=34;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='2155';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='-1';
theSitetree.graphicsetId='408';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'valueweb',
  product: 'WSCSYSSSSLYTCR7V'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'000000',
				keyvisualId: 	'2155',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'-1',
				graphicsetId: 	'408',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'',
				contentFontSize:'-1',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20110630-015141'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '799',
internalId:  '',
customField: '20120130-144353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20111006-232849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20090217-221054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20111006-223911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '694',
internalId:  '',
customField: '20111006-220214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '715',
internalId:  '',
customField: '20111006-235011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12964',
internalId:  '',
customField: '20090511-230821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46101',
internalId:  '',
customField: '20090619-151106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '988',
internalId:  '',
customField: '20091118-231224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '820',
internalId:  '',
customField: '20111006-235145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17601',
internalId:  '',
customField: '20111006-223535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '778',
internalId:  '',
customField: '20111006-234754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17622',
internalId:  '',
customField: '20111006-235237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60523',
internalId:  '',
customField: '20111006-223243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '862',
internalId:  '',
customField: '20070824-192502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1030',
internalId:  '',
customField: '20091102-150452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1051',
internalId:  '',
customField: '20070928-002731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1072',
internalId:  '',
customField: '20081210-003518'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1093',
internalId:  '',
customField: '20071118-015534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1114',
internalId:  '',
customField: '20070926-013007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '736',
internalId:  '',
customField: '20080606-171157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20090217-222459'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12922',
internalId:  '',
customField: '20080128-015022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12943',
internalId:  '',
customField: '20090511-100105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '883',
internalId:  '',
customField: '20091102-001143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '904',
internalId:  '',
customField: '20071022-004048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '925',
internalId:  '',
customField: '20070928-002529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '946',
internalId:  '',
customField: '20070824-192502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '967',
internalId:  '',
customField: '20070824-192502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85523',
internalId:  '',
customField: '20120130-143944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49483',
internalId:  '',
customField: '20110203-183956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49537',
internalId:  '',
customField: '20091104-004932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49931',
internalId:  '',
customField: '20090619-150840'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX2XE';
var companyName   = 'KINGSCASTLE+RANCH+%26+VINEYARD';
var htmlTitle	  = 'KINGSCASTLE+RANCH++VINEYARD';
var metaKeywords  = 'kingscastleranch.com+Kingscastle+Ranch++Vineyard+Kingscastle+Smokin+Belle+Starr+Smokes+Bell+Mister+Dual+Pep+Mr+Dual+Smoke+Sanduskie+Blue+Lenas+Lucky+Star+Shiloh+Dream+Dancer+Kings+Sweet+Approval++Royal+Chrome+Doll+Cita+Savanna+Dollys+Rose+Vineyard+Miniture+Australian+Shepherds+Horses+Forsale+AQHA+APHA+Barn+Sale+Windmills+foals+Equine+Twins+Northern+California+Fall+River+Valley+McArthur+Mt.+Shasta+Mt.+Lassen+King+family+horses+homemade+treasures+blacksmith+quality+livestock+agriculture+vinaculture+grape+vines+tack+trees+cowboy+cookie+dough+ricochet+mini+aussies+blacksmith+puppies+puppy';
var metaContents  = '';
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();
};

