/* [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','52',jdecode('Home'),jdecode(''), jdecode('%2F52.html'), 'true',[],'',''],
	['PAGE','860',jdecode('About+us'),jdecode(''), jdecode('%2F860%2Findex.html'), 'true',[ 
		['PAGE','869',jdecode('Dick+Morgan+CMC%2C+FIMC'),jdecode(''), jdecode('%2F860%2F869.html'), 'true',[],'','']
	],'',''],
	['PAGE','923',jdecode('What+Clients+Say'),jdecode(''), jdecode('%2F923.html'), 'true',[],'',''],
	['PAGE','878',jdecode('Services+'),jdecode(''), jdecode('%2F878.html'), 'true',[],'',''],
	['PAGE','887',jdecode('Marketing+Tips'),jdecode(''), jdecode('%2F887.html'), 'true',[],'',''],
	['PAGE','896',jdecode('Insights+%26+Joy+e-Letters'),jdecode(''), jdecode('%2F896.html'), 'true',[],'',''],
	['PAGE','905',jdecode('Article+Library'),jdecode(''), jdecode('%2F905.html'), 'true',[],'',''],
	['PAGE','932',jdecode('Engagements'),jdecode(''), jdecode('%2F932.html'), 'true',[],'',''],
	['PAGE','950',jdecode('Events'),jdecode(''), jdecode('%2F950.html'), 'true',[],'',''],
	['PAGE','914',jdecode('Marketing+Facets+Book'),jdecode(''), jdecode('%2F914.html'), 'true',[],'',''],
	['PAGE','7106',jdecode('Guestbook'),jdecode(''), jdecode('%2F7106%2Findex.html'), 'true',[ 
		['PAGE','7101',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F7106%2F7101.html'), 'false',[],'','']
	],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='FFCC33';
theSitetree.keyvisualId='1007';
theSitetree.keyvisualName='strasse.jpg';
theSitetree.fontsetId='169';
theSitetree.graphicsetId='199';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTCPXC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'FFCC33',
				keyvisualId: 	'1007',
				keyvisualName: 	'strasse.jpg',
				fontsetId: 		'169',
				graphicsetId: 	'199',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				a_color: 		'000066',
				b_color: 		'FFCC33',
				c_color: 		'000000',
				d_color: 		'406BC0',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '52',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-7106ahw050inxx41']={
webappId:    '1002',
documentId:  '7106',
internalId:  '7106ahw050inxx41',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52',
internalId:  '',
customField: '20111206-200011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '860',
internalId:  '',
customField: '20100824-113218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '869',
internalId:  '',
customField: '20111206-195539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '878',
internalId:  '',
customField: '20111206-195743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '914',
internalId:  '',
customField: '20080404-143241'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '887',
internalId:  '',
customField: '20110907-165058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '896',
internalId:  '',
customField: '20110916-122309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '905',
internalId:  '',
customField: '20111102-154722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '923',
internalId:  '',
customField: '20110907-164942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '932',
internalId:  '',
customField: '20110907-170306'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '950',
internalId:  '',
customField: '20110907-170900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7106',
internalId:  '',
customField: '20110907-171053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20080814-143228'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXX41';
var companyName   = 'Morgan+Marketing+Solutions%2C+Inc.';
var htmlTitle	  = 'Morgan+Marketing+Solutions%2C+Inc.';
var metaKeywords  = 'Business+planning%2C+marketing+planning%2C+implementation+assistance%2C+marketing+services%2C+customer+survey%2C+company+survey%2C+sales%2C+sales+management%2C+profit+improvement%2C+profitability%2C+selling+a+business%2C+buying+a+business%2C+sales+presentation%2C+executive+mentoring%2C+coaching%2C+collateral+sales+materials%2C+company+profile%2C+market+positioning%2C+mission%2C+planning+retreat%2C+operational+planning%2C+marketing+audit%2C+sales+audit%2C+company+review';
var metaContents  = 'Morgan+Marketing+Solutions%2C+Inc.+We+help+leaders+tackle+major+issues+and+become+better+marketers%2C+using+a+holistic+business+approach%21';
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();
};

