/* [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','4901',jdecode('Home'),jdecode(''),'/4901.html','true',[],'','']];
var siteelementCount=1;
theSitetree.topTemplateName='Amaze';
theSitetree.paletteFamily='0A2447';
theSitetree.keyvisualId='2416';
theSitetree.keyvisualName='digital.jpg';
theSitetree.fontsetId='394';
theSitetree.graphicsetId='444';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='0A2447';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Amaze',
				paletteFamily: 	'0A2447',
				keyvisualId: 	'2416',
				keyvisualName: 	'digital.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: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20110728-231032'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTCPH5']={
webappId:    '5003',
documentId:  '4901',
internalId:  'tid:1;pid:WSCSYSSSSLYTCPH5',
customField: 'en:US::;language:en;country:US;'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INFNBY';
var companyName   = 'TeleConsult+Group';
var htmlTitle	  = 'TeleConsult+Group+-+Ottawa%2C+ON%27s+Leading+Provider+of+TeleCommunications+and+Information+Technology+Solutions';
var metaKeywords  = 'Design%2C+implementation+expertise+VoIP%2C+PBX+upgrades%2C+voicemail%2C+unified+messaging%2C+storage%2C+security%2C+IP+video+surveillance%2C+firewalls%2C+routing%2C+switching%2C+servers%2C+email%2C+database%2C+software+applications%2C+virtualization%2C+storage%2C+I.T.+planning%2C+design%2C+sales%2C+implementation%2C+support%2C+Cisco+partner%2C+Callmanager%2C+unified+communications%2C+IP+PBX%2C+SIP+H.323%2C+MGCP%2C+skinny%2C+consulting%2C+sales%2C+service%2C+network%2C+leading%2C+top%2C+best%2C+budget%2C+select+SMB+small+business+telephones+telecommunications+project+management+phones+windows+server+sbcs+sbs+microsoft+hp+d-link+compaq+intel+ccnp+ccvp+ccna+ccnp-v+ccnp-voice+certified+certification+ottawa+ontario+canada+national+capital+nc+on+award+winning+gatineau+alymer+hull+quebec+orleans+nepean+gloucester+kanata+glebe+byward+market+centretown+vanier';
var metaContents  = 'TeleConsult+Group+is+Ottawa%27s+leading+provider+of+voice%2C+data+and+Internet-based+solutions+for+small+and+medium-sized+businesses.+Established+in+2003%2C+we+have+consistently+met+or+exceeded+the+needs+of+our+clients+through+our+well-respected+customer+service+and+technical+design+expertise.++As+a+Cisco+registered+company%2C+our+CCNP-Voice+and+CCNA+level+engineers+are+able+to+analyze+your+business+requirements+and+develop+field-tested+solutions+that+meet+your+long-term+goals+and+budget.++We+have+extensive+VoIP+and+I.T.+planning%2C+design%2C+sales%2C+implementation+and+support+experience+having+worked+on+systems+ranging+from+less+than+a+handful+of+users%2C+up+to+those+with+tens%2C+hundreds+and+even+thousands+of+devices.++All+our+systems+use+Cisco+approved+designs+that+allow+for+the+future+growth+and+ongoing+expansion+of+your+business.++Our+design+and+implementation+expertise+includes+VoIP%2C+PBX+upgrades%2C+voicemail%2C+unified+messaging%2C+storage%2C+security%2C+IP+video+surveillance%2C+firewalls%2C+routing%2C+switching%2C+servers%2C+email%2C+database%2C+software+applications%2C+virtualization+and+storage.';
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();
};

