/* [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','201',jdecode('Home'),jdecode(''),'/201.html','true',[],''],
	['PAGE','8001',jdecode('Saponi+History'),jdecode(''),'/8001.html','true',[],''],
	['PAGE','8022',jdecode('Saponi+Drum+Newsletter'),jdecode(''),'/8022.html','true',[],''],
	['PAGE','8901',jdecode('Member%26%23x27%3Bs+Page'),jdecode(''),'/8901.html','true',[],''],
	['PAGE','11601',jdecode('Upcoming+Events'),jdecode(''),'/11601.html','true',[],''],
	['PAGE','6343',jdecode('Nation+Blog'),jdecode(''),'/6343.html','true',[],''],
	['PAGE','6301',jdecode('Contact+Us'),jdecode(''),'/6301.html','true',[],''],
	['PAGE','6322',jdecode('Links'),jdecode(''),'/6322.html','true',[],''],
	['PAGE','9601',jdecode('Native+American+Crafts'),jdecode(''),'/9601.html','false',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '201',
internalId:  '',
customField: '20100626-085224'
};
webappMappings['7050']=webappMappings['7050-1304']={
webappId:    '7050',
documentId:  '6343',
internalId:  '1304',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20080410-191628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20100704-100833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6343',
internalId:  '',
customField: '20080714-013239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8022',
internalId:  '',
customField: '20100627-165731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6322',
internalId:  '',
customField: '20100623-013347'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20080410-213436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20100624-225530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20100624-220934'
};
webappMappings['7008']=webappMappings['7008-2331']={
webappId:    '7008',
documentId:  '6301',
internalId:  '2331',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-2332']={
webappId:    '7008',
documentId:  '9601',
internalId:  '2332',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN204Y';
var companyName   = 'SAPONI+NATION+OF+OHIO';
var htmlTitle	  = 'Saponi+Nation+of+Ohio';
var metaKeywords  = 'Native+American%2C+Indian%2C+native%2C+Saponi%2C+Ohio%2C+Dakota%2C+Sioux%2C+Siouan%2C+Occaneechi-Saponi%2C++non-profit%2C+Blackfoot%2C+Five+Civilized+Tribes%2C+Six+Nations%2C+Brunswick+County%2C+Virginia%2C+North+Carolina%2C+Iroquoi%2C+Fort+Christanna%2C+Brunswick+County+Virginia%2C+Sapony+Creek%2C+Dinwiddie%2C+County%2C+Cayuga%2C+Person+County+Indians%2C+Haliwa-Saponi%2C+Ned+Bearskin%2C++William+Byrd%2C+Halifax+County%2C+North+Carolina%2C+Sappony%2C+Bacons+Rebellion%2C+Mecklenberg+County+Virginia%2C+Sussex+County+Virginia%2C+Ross+County+Ohio%2C+Ohio%2C+Lt+GovernorAlexander+Sotswood%2C+Occaneechi%2C+Tutelo%2C+Keyauwee%2C+Meipontski%2C+Stuckenock%2C+Stegarski%2C+Shakori%2C+Cheraw%2C+Monacan%2C+Catawba%2C+Ohio+River+Valley%2C+Gallia+County+Ohio%2C+Meigs+County+Ohio%2C+Vinton+County+Ohio%2C+Lawrence+County+Ohio%2C+Jackson+Pike+county+Ohio%2C+Highland+County+Ohio%2C+Jackson+Ohio%2C+Allegheny+Mountains%2C+Mohawks%2C++Grand+River+Ontario%2C+Mingoes%2C+Chillicothe+Ohio%2C+Oak+Hill+Ohio%2C+Black+Fork+Ohio%2C+Missouri+Indian+Territory%2C+Saponies%2C+Mount+Airy+North+Carolina.+Core+Families%3A+Burnett%2C+Chavis%2C+Chavers%2C+Shavers%2C+Coker%2C+Craddolph%2C+Dungey%2C+Harris%2C+Howell%2C+Long%2C+Marsh%2CMcKeel%2C+Keel%2C+Keels%2C+Scott%2C+Stewart.+Extended+families%3A+Bass%2C+Bolling%2C+Brown%2C+Branham%2C+Byrd%2C+Collins%2C+Corn%2C+Cousins%2C+Dempsey%2C+Dixon%2C+Garland%2C+Gibson%2C+Goings%2C+Goins%2C+Griffin%2C+Guy%2C+Haithcock%2C+Hart%2C+Haskins%2C+Hawk%2C+Hawkins%2C+Henson%2C+Holly%2C+Hughes%2C+James%2C+Jeffries%2C+Jeffreys%2C+Johnson%2C+Jones%2C+Keeton%2C+Liggins%2C+Martin%2C+mason%2C+Matthews%2C+McDaniel%2C+McKinney%2C+Moss%2C+Newman%2C+Nichols%2C+Parker%2C+Pettiford%2C+Ragland%2C+Rickman%2C+Richardson%2C+Robbins%2C+Robinson%2C+Saunders%2C+Sanders%2C+Shumake%2C+Simmons%2C+Spears%2C+Stills%2C+Valentine%2C+Vaughn%2C+Viney%2C+Watkins%2C+Watson%2C+Whitt%2C+Winborn.';
var metaContents  = 'Saponi+Nation+of+Ohio%2C+a+non-profit%2C+tribal+organization+of+descendents+and+heirs+of+the+Historic+Saponi+Nation.+A+sub-group+of+the+Dakota+living+in+the+Ohio+River+Valley.+A+Souian+people.';
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();
};
