/* [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','1701',jdecode('About+Us+'),jdecode(''),'/1701/index.html','true',[ 
		['PAGE','16323',jdecode('Clients'),jdecode(''),'/1701/16323.html','true',[],'']
	],''],
	['PAGE','190023',jdecode('ERP+%2F+CRM+%2F+SCM'),jdecode(''),'/190023/index.html','true',[ 
		['PAGE','190044',jdecode('IT+Development'),jdecode(''),'/190023/190044.html','true',[],''],
		['PAGE','190065',jdecode('ASIC+Services'),jdecode(''),'/190023/190065.html','true',[],''],
		['PAGE','189644',jdecode('Staff+Augmentation'),jdecode(''),'/190023/189644.html','true',[],'']
	],''],
	['PAGE','190323',jdecode('Public+Services'),jdecode(''),'/190323.html','true',[],''],
	['PAGE','293756',jdecode('Products'),jdecode(''),'/293756.html','true',[],''],
	['PAGE','16344',jdecode('Contact+Us'),jdecode(''),'/16344/index.html','true',[ 
		['PAGE','189665',jdecode('Jobs'),jdecode(''),'/16344/189665.html','true',[],'']
	],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Diablo';
theSitetree.paletteFamily='1F53AB';
theSitetree.keyvisualId='8774';
theSitetree.keyvisualName='kv_8774.jpg';
theSitetree.fontsetId='17089';
theSitetree.graphicsetId='12467';
theSitetree.contentColor='59696F';
theSitetree.contentBGColor='E6E6E6';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Diablo',
				paletteFamily: 	'1F53AB',
				keyvisualId: 	'8774',
				keyvisualName: 	'kv_8774.jpg',
				fontsetId: 		'17089',
				graphicsetId: 	'12467',
				contentColor: 	'59696F',
				contentBGColor: 'E6E6E6',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20091223-163310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16323',
internalId:  '',
customField: '20091219-073023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16344',
internalId:  '',
customField: '20091219-073413'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1701',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '293756',
internalId:  '',
customField: '20091219-073316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189644',
internalId:  '',
customField: '20091219-073210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '189665',
internalId:  '',
customField: '20091219-073534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190065',
internalId:  '',
customField: '20091219-073140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190044',
internalId:  '',
customField: '20091219-073122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190023',
internalId:  '',
customField: '20091219-073048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '190323',
internalId:  '',
customField: '20091219-073249'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '16323',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '190023',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '190044',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '190065',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '189644',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '190323',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '293756',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '16344',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '189665',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'cm4all.netfirms.com';
var accountId     = 'ANFI10INX228';
var companyName   = '';
var htmlTitle	  = 'Niche+Consulting+Inc.';
var metaKeywords  = 'Niche+ERP+Oracle+Applications+SAP+Niche+Consulting+Oracle+ADF+SOA+BPEL+Mobile+Goverment+Public+Supplier+Consultant';
var metaContents  = 'Niche+Consulting+-++ERP+Experts+%21%21+Specialize+in+Oracle+Applications%2C+SAP..';
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();
};
