/* [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','4201',jdecode('Home'),jdecode(''), jdecode('%2F4201.html'), 'true',[],'',''],
	['PAGE','67301',jdecode('Success+Stories'),jdecode(''), jdecode('%2F67301.html'), 'true',[],'',''],
	['PAGE','4315',jdecode('Training+%26+Support'),jdecode(''), jdecode('%2F4315.html'), 'true',[],'',''],
	['PAGE','4357',jdecode('About+Us'),jdecode(''), jdecode('%2F4357.html'), 'true',[],'','']];
var siteelementCount=4;
theSitetree.topTemplateName='Amaze';
theSitetree.paletteFamily='0A2447';
theSitetree.keyvisualId='2431';
theSitetree.keyvisualName='termin.jpg';
theSitetree.fontsetId='394';
theSitetree.graphicsetId='444';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='0A2447';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'valueweb',
  product: 'WSCSYSSSSLYTCR7V'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Amaze',
				paletteFamily: 	'0A2447',
				keyvisualId: 	'2431',
				keyvisualName: 	'termin.jpg',
				fontsetId: 		'394',
				graphicsetId: 	'444',
				contentColor: 	'FFFFFF',
				contentBGColor: '0A2447',
				a_color: 		'0A2447',
				b_color: 		'081B35',
				c_color: 		'3268E2',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20120127-030202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4315',
internalId:  '',
customField: '20111031-145249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67301',
internalId:  '',
customField: '20111031-145444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4357',
internalId:  '',
customField: '20111031-151934'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INXXRM';
var companyName   = 'Monthend+Solutions%2C+Inc.+-+Sage+Partner';
var htmlTitle	  = 'Sage+MAS+90+200+Ebusiness+Authorized+Partner+Trainer+Los+Angeles+Southern+California+';
var metaKeywords  = 'Monthend+Solutions%2C+Inc.%3A+Los+Angeles+Sage+MAS90+Sage+MAS200+accounting+software+accountant+software+computer+consultant+sage+ma90+support+sage+mas200+support+Los+Angeles+based+Computer+Consulting+and+Home+Page+MAS90+MAS+90+computer+support++accounting+software+mas90+mas+90+MAS200+MAS+200+FRx+FRX+Crystal+reporting+reports+mas200+mas+200+mas90+accpac+Accpac+Advantage+advantage+series+support+technical+support+Best+Sage+Accpac+complete+system++management+site+management+business+computers+office+information+systems+system++configuration+installation+training+implementation+consulting+firm+San+Diego+Las+Vegas+Vancouver+Canada+S8Yc3pigTNbJHtFCx7vYbMB9kZnk87Wu5uUBTa1nzaAmeta+name%3Dverify-v1+content%3DI37UmnOsO45BRe9JGcEFhRj8yESJ9xpbKmiEsC7YhaU%3D+%0D%0A%0D%0A';
var metaContents  = 'Monthend+Solutions%2C+Inc.%3A+Los+Angeles+Sage+Accounting+Consultant++sage++mas+90+mas90+training+mas200+training+mas90+consultant+mas200+consultant+MAS90+MAS+90+FRx+Crystal+e-business+consultant+computer+support++accounting+software+mas90+mas+90+MAS200+MAS+200+mas200+mas+200+mas90+accpac+advantage+series+support+technical+support+Best+Sage+Accpac+complete+system+accounting+information+systems+consulting+firm++management+site+management+business+computers+office+information+systems+system+configuration+installation+training+implementation+Los+Angeles+California+CA+San+Diego+Vancouver+Canada+Las+Vegas+S8Yc3pigTNbJHtFCx7vYbMB9kZnk87Wu5uUBTa1nzaAmeta+name%3Dverify-v1+content%3DI37UmnOsO45BRe9JGcEFhRj8yESJ9xpbKmiEsC7YhaU%3D+%0D%0A%0D%0A';
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();
};

