/* [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','2212',jdecode('Home'),jdecode(''), jdecode('%2F2212.html'), 'true',[],'',''],
	['PAGE','17812',jdecode('Programs+%26+Services'),jdecode(''), jdecode('%2F17812.html'), 'true',[],'',''],
	['PAGE','17833',jdecode('Contact'),jdecode(''), jdecode('%2F17833.html'), 'true',[],'',''],
	['PAGE','25112',jdecode('Depression+%26+Suicide'),jdecode(''), jdecode('%2F25112.html'), 'true',[],'',''],
	['PAGE','25133',jdecode('Donations'),jdecode(''), jdecode('%2F25133.html'), 'true',[],'',''],
	['PAGE','25612',jdecode('Volunteer'),jdecode(''), jdecode('%2F25612.html'), 'true',[],'',''],
	['PAGE','17854',jdecode('Crisis+Line+Updates'),jdecode(''), jdecode('%2F17854.html'), 'true',[],'',''],
	['PAGE','27212',jdecode('Social+Service+Directoy'),jdecode(''), jdecode('%2F27212.html'), 'true',[],'',''],
	['PAGE','27233',jdecode('Disclaimer'),jdecode(''), jdecode('%2F27233.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Clearline';
theSitetree.paletteFamily='C7C6C5';
theSitetree.keyvisualId='3300';
theSitetree.keyvisualName='kv_3300.jpg';
theSitetree.fontsetId='10590';
theSitetree.graphicsetId='10718';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp13-cbeyon',
  product: 'WSCSYSSSSLYTC2ZA'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Clearline',
				paletteFamily: 	'C7C6C5',
				keyvisualId: 	'3300',
				keyvisualName: 	'kv_3300.jpg',
				fontsetId: 		'10590',
				graphicsetId: 	'10718',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'C7C6C5',
				e_color: 		'989696',
				f_color: 		'989696',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2212',
internalId:  '',
customField: '20110330-121255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17812',
internalId:  '',
customField: '20110330-121314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25133',
internalId:  '',
customField: '20110330-120903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17833',
internalId:  '',
customField: '20110505-171934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17854',
internalId:  '',
customField: '20110510-160042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25112',
internalId:  '',
customField: '20110329-121043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27233',
internalId:  '',
customField: '20110330-103415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27212',
internalId:  '',
customField: '20110329-155918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25612',
internalId:  '',
customField: '20110505-172051'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I71LWU';
var companyName   = 'Crisis+Line+of+Will+%26+Grundy+Counties+';
var htmlTitle	  = '';
var metaKeywords  = 'crisis+hotline%0D%0Acrisis%0D%0Ahotline%0D%0Asuicide%0D%0Ainformation+and+referral%0D%0Aphone+counseling%0D%0Aillinois+hotline%0D%0Awill+county+hotline%0D%0Agrundy+county+hotline%0D%0Asuicide+hotline%0D%0Ainformation+%0D%0Areferrals%0D%0Areassurance+calls%0D%0Asuicide+prevention+%0D%0Acrisis+line+of+will+county%0D%0Acrisis+line+of+grundy+county';
var metaContents  = 'crisis+hotline%0D%0Acrisis%0D%0Ahotline%0D%0Asuicide%0D%0Ainformation+and+referral%0D%0Aphone+counseling%0D%0Aillinois+hotline%0D%0Awill+county+hotline%0D%0Agrundy+county+hotline%0D%0Asuicide+hotline%0D%0Ainformation+%0D%0Areferrals%0D%0Areassurance+calls%0D%0Asuicide+prevention+%0D%0Acrisis+line+of+will+county%0D%0Acrisis+line+of+grundy+county';
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();
};

