/* [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','4001',jdecode('CYO+Home+Page'),jdecode(''),'/4001.html','true',[],''],
	['PAGE','4136',jdecode('CYO+Calendar'),jdecode(''),'/4136.html','true',[],''],
	['PAGE','4073',jdecode('Forms+Page'),jdecode(''),'/4073/index.html','true',[ 
		['PAGE','14612',jdecode('Players'),jdecode(''),'/4073/14612.html','true',[],''],
		['PAGE','14633',jdecode('Coaches%2FVolunteers'),jdecode(''),'/4073/14633.html','true',[],'']
	],''],
	['PAGE','4115',jdecode('Notice+Archives'),jdecode(''),'/4115.html','true',[],''],
	['PAGE','4157',jdecode('Related+Sites'),jdecode(''),'/4157.html','true',[],''],
	['PAGE','4052',jdecode('CYO+Board'),jdecode(''),'/4052.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Porthole';
theSitetree.paletteFamily='920707';
theSitetree.keyvisualId='6718';
theSitetree.keyvisualName='kv_6718.jpg';
theSitetree.fontsetId='11202';
theSitetree.graphicsetId='12017';
theSitetree.contentColor='8F2222';
theSitetree.contentBGColor='FAEEEE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Porthole',
				paletteFamily: 	'920707',
				keyvisualId: 	'6718',
				keyvisualName: 	'kv_6718.jpg',
				fontsetId: 		'11202',
				graphicsetId: 	'12017',
				contentColor: 	'8F2222',
				contentBGColor: 'FAEEEE',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20100514-155011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4052',
internalId:  '',
customField: '20100514-010830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4157',
internalId:  '',
customField: '20100118-161144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4073',
internalId:  '',
customField: '20100514-155757'
};
webappMappings['1501']=webappMappings['1501-29831558']={
webappId:    '1501',
documentId:  '4001',
internalId:  '29831558',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4115',
internalId:  '',
customField: '20100513-213302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4136',
internalId:  '',
customField: '20100514-163112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14612',
internalId:  '',
customField: '20100513-231546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14633',
internalId:  '',
customField: '20100310-190011'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INVS3X';
var companyName   = 'Holy+Spirit+CYO+++++++++++++++++++++++++++++++++++++++++++++++Fremont%2C+CA';
var htmlTitle	  = 'Holy+Spirit+CYO';
var metaKeywords  = 'Fremont%2C+sports%2C+athletic+program%2C+basketball%2C+volleyball%2C+softball%2C+track+and+field%2C+cheerleading%2C+alameda+county+sports%2C+Holy+Spirit+church%2C+Holy+spirit+cyo%2C+baseball+fremont+sports+facility%2C+sports+gym+fremont%2C+girls+basketball%2C+boys+basketball%2C+girls+volleyball%2C+boys+volleyball%2C+cross+country%2C+youth+sports+in+fremont%2C+sports+94536%2C+k-8+sports%2C+Catholic+sports%2C+alameda+sports%2C+catholic+sports%2C+cyo%2C+catholic+youth+organization%2C+sports+facility+fremont%2C+school+sports%2C+basketball+gym';
var metaContents  = 'Holy+Spirit+CYO+%28Catholic+Youth+Organization%29+in+Fremont%2C+CA+is+dedicated+to+encouraging+children+to+develop+and+share+their+unique+athletic+gifts%2C+to+play+together+as+teams%2C+and+to+honor+each+others+talents+through+sports.+The+program+is+part+of+the+Holy+Spirit+church%2C+located+at+37588+Fremont+Blvd.+Fremont%2C+CA+94536.+CYO+ph.510.456.4979';
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();
};
