/* [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','801',jdecode('Home'),jdecode(''), jdecode('%2F801.html'), 'true',[],'',''],
	['PAGE','7501',jdecode('AMHA%2F+AMHR+STUDS'),jdecode(''), jdecode('%2F7501%2Findex.html'), 'true',[ 
		['PAGE','126449',jdecode('Elvis%2FBlack+Overo'),jdecode(''), jdecode('%2F7501%2F126449.html'), 'true',[],'',''],
		['PAGE','126458',jdecode('Duffy%2FPalomino'),jdecode(''), jdecode('%2F7501%2F126458.html'), 'true',[],'','']
	],'',''],
	['PAGE','7669',jdecode('AMHA%2FAMHR+MARES'),jdecode(''), jdecode('%2F7669%2Findex.html'), 'true',[ 
		['PAGE','7900',jdecode('Fancy+Pants%2F+Homozygous+Sorrel+pinto'),jdecode(''), jdecode('%2F7669%2F7900.html'), 'true',[],'',''],
		['PAGE','126467',jdecode('Mia%2FBlack+pinto'),jdecode(''), jdecode('%2F7669%2F126467.html'), 'true',[],'','']
	],'',''],
	['PAGE','128087',jdecode('2011+foal'),jdecode(''), jdecode('%2F128087.html'), 'true',[],'',''],
	['PAGE','74101',jdecode('2008+FOALS'),jdecode(''), jdecode('%2F74101.html'), 'true',[],'',''],
	['PAGE','8501',jdecode('2006+%26+2007++FOALS'),jdecode(''), jdecode('%2F8501.html'), 'true',[],'',''],
	['PAGE','8543',jdecode('For+sale+Mares%2FFillies'),jdecode(''), jdecode('%2F8543.html'), 'true',[],'',''],
	['PAGE','79501',jdecode('For+sale+Studs%2FColts'),jdecode(''), jdecode('%2F79501.html'), 'true',[],'',''],
	['PAGE','43301',jdecode('Sold'),jdecode(''), jdecode('%2F43301.html'), 'true',[],'',''],
	['PAGE','126674',jdecode('Sold+page+2'),jdecode(''), jdecode('%2F126674.html'), 'true',[],'',''],
	['PAGE','8564',jdecode('+References+Bloodlines'),jdecode(''), jdecode('%2F8564.html'), 'true',[],'',''],
	['PAGE','2501',jdecode('Contact'),jdecode(''), jdecode('%2F2501.html'), 'true',[],'',''],
	['PAGE','5306',jdecode('Guestbook'),jdecode(''), jdecode('%2F5306%2Findex.html'), 'true',[ 
		['PAGE','5301',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F5306%2F5301.html'), 'false',[],'','']
	],'',''],
	['PAGE','33401',jdecode('Links'),jdecode(''), jdecode('%2F33401.html'), 'true',[],'',''],
	['PAGE','52401',jdecode('Gallery'),jdecode(''), jdecode('%2F52401.html'), 'true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Antigua';
theSitetree.paletteFamily='617F92';
theSitetree.keyvisualId='6905';
theSitetree.keyvisualName='kv_6905.jpg';
theSitetree.fontsetId='11214';
theSitetree.graphicsetId='12036';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='809DAF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'gate',
  product: 'WSCSYSSSSLYTCPCD'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Antigua',
				paletteFamily: 	'617F92',
				keyvisualId: 	'6905',
				keyvisualName: 	'kv_6905.jpg',
				fontsetId: 		'11214',
				graphicsetId: 	'12036',
				contentColor: 	'FFFFFF',
				contentBGColor: '809DAF',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20100704-184245'
};
webappMappings['1002']=webappMappings['1002-5306AHW050INXE8H']={
webappId:    '1002',
documentId:  '5306',
internalId:  '5306AHW050INXE8H',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20100124-213444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126449',
internalId:  '',
customField: '20111208-192927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126458',
internalId:  '',
customField: '20100704-185334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7669',
internalId:  '',
customField: '20111202-194409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7900',
internalId:  '',
customField: '20111208-193207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126467',
internalId:  '',
customField: '20100704-185938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5306',
internalId:  '',
customField: '20070531-120701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74101',
internalId:  '',
customField: '20100118-203106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8543',
internalId:  '',
customField: '20100109-180942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79501',
internalId:  '',
customField: '20100109-181140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43301',
internalId:  '',
customField: '20100113-204947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126674',
internalId:  '',
customField: '20100118-203346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128087',
internalId:  '',
customField: '20111208-193038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8501',
internalId:  '',
customField: '20100118-202931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8564',
internalId:  '',
customField: '20100109-184011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20100109-202244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20070529-221443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33401',
internalId:  '',
customField: '20100113-204619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52401',
internalId:  '',
customField: '20100118-203614'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INXE8H';
var companyName   = 'Paint+By+Numbers+Ranch';
var htmlTitle	  = 'Paint+By+Numbers+Ranch+Home+Page';
var metaKeywords  = '';
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();
};

