/* [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','401',jdecode('Home'),jdecode(''),'/401/index.html','true',[ 
		['PAGE','7201',jdecode('Home+%28follow+up+page%29'),jdecode(''),'/401/7201.html','false',[],'']
	],''],
	['PAGE','2101',jdecode('Counseling'),jdecode(''),'/2101.html','true',[],''],
	['PAGE','2122',jdecode('Drug+or+Alcohol'),jdecode(''),'/2122.html','true',[],''],
	['PAGE','2143',jdecode('Anger+Issues'),jdecode(''),'/2143.html','true',[],''],
	['PAGE','2164',jdecode('Find+Help'),jdecode(''),'/2164/index.html','true',[ 
		['PAGE','10001',jdecode('Find+Help+%28follow+up+page%29'),jdecode(''),'/2164/10001.html','false',[],'']
	],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='cccccc';
theSitetree.contentBGColor='5e5e5e';
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10448',
				contentColor: 	'cccccc',
				contentBGColor: '5e5e5e',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'5E5E5E',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1001']=webappMappings['1001-ahw050inetfe83d36902c6705967']={
webappId:    '1001',
documentId:  '401',
internalId:  'ahw050inetfe83d36902c6705967',
customField: ''
};
webappMappings['1001']=webappMappings['1001-ahw050inetfe83d36902c6705967']={
webappId:    '1001',
documentId:  '7201',
internalId:  'ahw050inetfe83d36902c6705967',
customField: 'followUp'
};
webappMappings['1001']=webappMappings['1001-ahw050inetfe9b03b51a7419425e']={
webappId:    '1001',
documentId:  '2164',
internalId:  'ahw050inetfe9b03b51a7419425e',
customField: ''
};
webappMappings['1001']=webappMappings['1001-ahw050inetfe9b03b51a7419425e']={
webappId:    '1001',
documentId:  '10001',
internalId:  'ahw050inetfe9b03b51a7419425e',
customField: 'followUp'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20070821-183247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2122',
internalId:  '',
customField: '20070821-184936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2143',
internalId:  '',
customField: '20070821-191445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2164',
internalId:  '',
customField: '20070821-191742'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTCPXC']={
webappId:    '5003',
documentId:  '401',
internalId:  'tid:1;pid:WSCSYSSSSLYTCPXC',
customField: 'en:US::;language:en;country:US;'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INETFE';
var companyName   = 'Allied+Counseling+Services%2C+Inc.';
var htmlTitle	  = 'Allied+Counseling';
var metaKeywords  = 'Counseling%2C+Anger%2C+Anger+Management%2C+help%2C+family%2C+therapy%2C+therapist%2C+group+counseling%2C+children%2C+drugs%2C+drug+abuse%2C+drug+counseling%2C+chemical+dependency%2C+court+ordered%2C+domestic+violence%2C+domestic+counseling%2C+children%2C+adolescents%2C+counseling+services%2C+San+Juan+County%2C+Skagit%2C+Skagit+County%2C+Anger+Resolution%2C+Depression%2C+Anxiety%2C+Emotional%2C+Emotion%2C+Emotional+Healing%2C+Mental%2C+Mental+Health%2C+Family+Therapy%2C+Family+Counseling%2C+Same+Sex+Partnerships%2C+Abuse%2C+Angry%2C+Sex%2C+Sexual%2C+Same+Sex%2C+relationship%2C+WA%2C+Washington%2C+Friday+Harbor%2C+San+Juan%2C+couples%2C+groups%2C+alcohol%2C+drinking%2C+problem%2C+DUI%2C+treatment%2C+counselor%2C+private%2C+confidential%2C+Washington%2C+ADIS';
var metaContents  = 'Allied+Counseling%2C+Serving+the+West+Coast+area+of+Washington.++Our+Counselors+specialize+in+Family+Therapy%2C+Chemical+Dependency%2C+Childrens+Issues+and+Anger+Management.';
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();
};
