/* [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','10101',jdecode('Home'),jdecode(''),'/10101.html','true',[],''],
	['PAGE','10152',jdecode('About+us'),jdecode(''),'/10152.html','true',[],''],
	['PAGE','10173',jdecode('Services'),jdecode(''),'/10173/index.html','true',[ 
		['PAGE','12701',jdecode('PC%2FLaptop+Repair%2C+Upgrade'),jdecode(''),'/10173/12701.html','true',[],''],
		['PAGE','12722',jdecode('Virus%2FSpyware+Removal+'),jdecode(''),'/10173/12722.html','true',[],''],
		['PAGE','12743',jdecode('Data+Backup+%26+Recovery'),jdecode(''),'/10173/12743.html','true',[],''],
		['PAGE','12101',jdecode('Website+Design'),jdecode(''),'/10173/12101.html','true',[],'']
	],''],
	['PAGE','10194',jdecode('Products'),jdecode(''),'/10194.html','true',[],''],
	['PAGE','10215',jdecode('Contact+Us'),jdecode(''),'/10215.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Amaze';
theSitetree.paletteFamily='0A2447';
theSitetree.keyvisualId='2415';
theSitetree.keyvisualName='computer.jpg';
theSitetree.fontsetId='397';
theSitetree.graphicsetId='444';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='0A2447';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Amaze',
				paletteFamily: 	'0A2447',
				keyvisualId: 	'2415',
				keyvisualName: 	'computer.jpg',
				fontsetId: 		'397',
				graphicsetId: 	'444',
				contentColor: 	'FFFFFF',
				contentBGColor: '0A2447',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:  '10101',
internalId:  '',
customField: '20090412-030144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10152',
internalId:  '',
customField: '20090411-133924'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10173',
internalId:  '',
customField: '20090411-160304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10194',
internalId:  '',
customField: '20090412-030952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10215',
internalId:  '',
customField: '20090405-200138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20090411-181635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12743',
internalId:  '',
customField: '20090411-194436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12722',
internalId:  '',
customField: '20090411-180714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12701',
internalId:  '',
customField: '20090411-172250'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10101',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-16791104']={
webappId:    '1501',
documentId:  '10101',
internalId:  '16791104',
customField: '1501'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN31Z7';
var companyName   = 'Tristate+Computer+Services';
var htmlTitle	  = 'Tristate+Computer+Services+-+PC%2FLaptop+Repair%2C+Network+Support%2C+NJ%2FNY+Metro+Area';
var metaKeywords  = 'PC+Repair%2C+Laptop+Repair%2C+Web+Hosting%2C+Website+Design%2C+Data+Backup+and+Recovery%2C+Virus+Removal%2C+Spyware+Removal%2C+Malware+Removal%2C+New+Jersey+Area%2C+New+York+Area%2C+Hardware+Upgrade%2C+Memory+Upgrade%2C+Printer+Repair%2C+Scanner%2FCopier+Repair%2C+Network%2C+Configuration%2C+Wireless+Setup%2C+Wireless+Configuration.';
var metaContents  = 'This+website+offers+Computer+Repair+Services+to+the+New+Jerseyand+New+York+Metro+area....';
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();
};

