/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','114215',jdecode('Search+the+site'),jdecode(''),'/114215.html','true',[],'',''],
	['PAGE','37901',jdecode('The+Society'),jdecode(''),'/37901/index.html','true',[ 
		['PAGE','62201',jdecode('Fees'),jdecode(''),'/37901/62201.html','true',[],'','']
	],'',''],
	['PAGE','352',jdecode('The+Breed'),jdecode(''),'/352/index.html','true',[ 
		['PAGE','42901',jdecode('Grading+System'),jdecode(''),'/352/42901.html','true',[],'',''],
		['PAGE','42922',jdecode('Tips+for+Buying'),jdecode(''),'/352/42922.html','true',[],'',''],
		['PAGE','114815',jdecode('Photo+Gallery'),jdecode(''),'/352/114815.html','true',[],'','']
	],'',''],
	['PAGE','373',jdecode('Highland+Folds'),jdecode(''),'/373/index.html','true',[ 
		['PAGE','2901',jdecode('Northland'),jdecode(''),'/373/2901.html','true',[],'',''],
		['PAGE','2922',jdecode('Auckland'),jdecode(''),'/373/2922.html','true',[],'',''],
		['PAGE','3027',jdecode('Bay+Of+Plenty'),jdecode(''),'/373/3027.html','true',[],'',''],
		['PAGE','37922',jdecode('Waikato'),jdecode(''),'/373/37922.html','true',[],'',''],
		['PAGE','3069',jdecode('Taranaki'),jdecode(''),'/373/3069.html','true',[],'',''],
		['PAGE','3048',jdecode('Hawkes+Bay'),jdecode(''),'/373/3048.html','true',[],'',''],
		['PAGE','2943',jdecode('Wairarapa'),jdecode(''),'/373/2943.html','true',[],'',''],
		['PAGE','37943',jdecode('Kapiti%2FHorowhenua'),jdecode(''),'/373/37943.html','true',[],'',''],
		['PAGE','2964',jdecode('Manawatu'),jdecode(''),'/373/2964.html','true',[],'',''],
		['PAGE','37964',jdecode('Wellington'),jdecode(''),'/373/37964.html','true',[],'',''],
		['PAGE','2985',jdecode('Marlborough'),jdecode(''),'/373/2985.html','true',[],'',''],
		['PAGE','37985',jdecode('West+Coast'),jdecode(''),'/373/37985.html','true',[],'',''],
		['PAGE','3111',jdecode('Canterbury'),jdecode(''),'/373/3111.html','true',[],'',''],
		['PAGE','3006',jdecode('Otago%2FSouthland'),jdecode(''),'/373/3006.html','true',[],'','']
	],'',''],
	['PAGE','415',jdecode('Cattle+for+Sale'),jdecode(''),'/415/index.html','true',[ 
		['PAGE','47801',jdecode('Heifers'),jdecode(''),'/415/47801.html','true',[],'',''],
		['PAGE','47822',jdecode('Cows'),jdecode(''),'/415/47822.html','true',[],'',''],
		['PAGE','47843',jdecode('Bulls'),jdecode(''),'/415/47843.html','true',[],'',''],
		['PAGE','47864',jdecode('Groups'),jdecode(''),'/415/47864.html','true',[],'',''],
		['PAGE','63301',jdecode('Embryos%2FSemen'),jdecode(''),'/415/63301.html','true',[],'','']
	],'',''],
	['PAGE','28401',jdecode('Herdbook+Online'),jdecode(''),'/28401.html','true',[],'',''],
	['PAGE','30501',jdecode('Resources'),jdecode(''),'/30501/index.html','true',[ 
		['PAGE','22901',jdecode('Links'),jdecode(''),'/30501/22901.html','true',[],'',''],
		['PAGE','30522',jdecode('Forms+and+Documents'),jdecode(''),'/30501/30522.html','true',[],'',''],
		['PAGE','45501',jdecode('Merchandise'),jdecode(''),'/30501/45501.html','true',[],'','']
	],'',''],
	['PAGE','91401',jdecode('Events'),jdecode(''),'/91401/index.html','true',[ 
		['PAGE','91422',jdecode('AGM'),jdecode(''),'/91401/91422.html','true',[],'',''],
		['PAGE','91464',jdecode('On+Farm+Auctions'),jdecode(''),'/91401/91464.html','true',[],'',''],
		['PAGE','142370',jdecode('National+Open+Fold+Day'),jdecode(''),'/91401/142370.html','true',[],'','']
	],'',''],
	['PAGE','36501',jdecode('Regional+Groups'),jdecode(''),'/36501/index.html','true',[ 
		['PAGE','79901',jdecode('Northland'),jdecode(''),'/36501/79901.html','true',[],'',''],
		['PAGE','71901',jdecode('Waikato+Bay+of+Plenty'),jdecode(''),'/36501/71901.html','true',[],'',''],
		['PAGE','126174',jdecode('Counties+Manukau'),jdecode(''),'/36501/126174.html','true',[],'',''],
		['PAGE','36522',jdecode('South+of+the+North'),jdecode(''),'/36501/36522.html','true',[],'',''],
		['PAGE','56501',jdecode('Canterbury+Westland'),jdecode(''),'/36501/56501.html','true',[],'',''],
		['PAGE','102801',jdecode('Southland'),jdecode(''),'/36501/102801.html','true',[],'','']
	],'',''],
	['PAGE','394',jdecode('Contact'),jdecode(''),'/394.html','true',[],'','']];
var siteelementCount=46;
theSitetree.topTemplateName='Deepcolor';
theSitetree.paletteFamily='5583CB';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10349';
theSitetree.graphicsetId='10469';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='154186';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Deepcolor',
				paletteFamily: 	'5583CB',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10349',
				graphicsetId: 	'10469',
				contentColor: 	'DDDDDD',
				contentBGColor: '154186',
				a_color: 		'5583CB',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100224-152600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '415',
internalId:  '',
customField: '20100215-195832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47822',
internalId:  '',
customField: '20100214-182217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47843',
internalId:  '',
customField: '20100214-185607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47801',
internalId:  '',
customField: '20100224-145713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20090930-152929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3006',
internalId:  '',
customField: '20091029-154716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20091110-184813'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37901',
internalId:  '',
customField: '20090930-144856'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20090930-145552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42901',
internalId:  '',
customField: '20090930-150207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42922',
internalId:  '',
customField: '20090930-152040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2922',
internalId:  '',
customField: '20091115-222639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3027',
internalId:  '',
customField: '20091029-160740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37922',
internalId:  '',
customField: '20091115-223215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3069',
internalId:  '',
customField: '20090501-202123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3048',
internalId:  '',
customField: '20081029-175014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2943',
internalId:  '',
customField: '20090501-202701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37943',
internalId:  '',
customField: '20091110-200140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2964',
internalId:  '',
customField: '20090811-024831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37964',
internalId:  '',
customField: '20091029-161333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2985',
internalId:  '',
customField: '20091029-155854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37985',
internalId:  '',
customField: '20091029-154253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3111',
internalId:  '',
customField: '20091212-153419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47864',
internalId:  '',
customField: '20100215-200159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28401',
internalId:  '',
customField: '20090930-160405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20090930-160114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20091007-042345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30522',
internalId:  '',
customField: '20091014-024325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45501',
internalId:  '',
customField: '20100125-005504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36501',
internalId:  '',
customField: '20091110-182335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36522',
internalId:  '',
customField: '20091110-183710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56501',
internalId:  '',
customField: '20091110-184345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '394',
internalId:  '',
customField: '20091110-190542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62201',
internalId:  '',
customField: '20090930-145413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63301',
internalId:  '',
customField: '20090824-035859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71901',
internalId:  '',
customField: '20091110-184004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79901',
internalId:  '',
customField: '20091007-043123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '91401',
internalId:  '',
customField: '20090930-155936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '91464',
internalId:  '',
customField: '20090525-014445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '91422',
internalId:  '',
customField: '20100224-152434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142370',
internalId:  '',
customField: '20100305-191543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102801',
internalId:  '',
customField: '20091221-170424'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '114215',
internalId:  'search',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114215',
internalId:  '',
customField: '20090902-042416'
};
webappMappings['7060']=webappMappings['7060-31973a8b9eca9c79137fa7548268b0cf']={
webappId:    '7060',
documentId:  '114815',
internalId:  '31973a8b9eca9c79137fa7548268b0cf',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114815',
internalId:  '',
customField: '20091116-012638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '126174',
internalId:  '',
customField: '20091110-182844'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10INFU0G';
var companyName   = 'New+Zealand+Highland+Cattle+Society';
var htmlTitle	  = 'New+Zealand+Highland+Cattle+Society';
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();
};
