/* [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','3901',jdecode('Home'),jdecode(''),'/3901.html','true',[],'',''],
	['PAGE','3952',jdecode('About+us'),jdecode(''),'/3952.html','true',[],'',''],
	['PAGE','7201',jdecode('Services'),jdecode(''),'/7201/index.html','true',[ 
		['PAGE','7222',jdecode('Home+Additions'),jdecode(''),'/7201/7222.html','true',[],'',''],
		['PAGE','7243',jdecode('Custom+Homes'),jdecode(''),'/7201/7243.html','true',[],'',''],
		['PAGE','7264',jdecode('Decks'),jdecode(''),'/7201/7264.html','true',[],'',''],
		['PAGE','7285',jdecode('Sunrooms'),jdecode(''),'/7201/7285.html','true',[],'',''],
		['PAGE','7306',jdecode('Kitchens'),jdecode(''),'/7201/7306.html','true',[],'',''],
		['PAGE','7327',jdecode('Bathrooms'),jdecode(''),'/7201/7327.html','true',[],'',''],
		['PAGE','7348',jdecode('Basements'),jdecode(''),'/7201/7348.html','true',[],'',''],
		['PAGE','7369',jdecode('Home+Contractor'),jdecode(''),'/7201/7369.html','true',[],'',''],
		['PAGE','7390',jdecode('House+Framing'),jdecode(''),'/7201/7390.html','true',[],'',''],
		['PAGE','13701',jdecode('Custom+Built-Ins'),jdecode(''),'/7201/13701.html','true',[],'','']
	],'',''],
	['PAGE','4015',jdecode('Testimonials'),jdecode(''),'/4015.html','true',[],'',''],
	['PAGE','4225',jdecode('Contact+Us'),jdecode(''),'/4225.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Sportive';
theSitetree.paletteFamily='F6F6E6';
theSitetree.keyvisualId='2657';
theSitetree.keyvisualName='architekt.jpg';
theSitetree.fontsetId='220';
theSitetree.graphicsetId='260';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F6F6E6';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Sportive',
				paletteFamily: 	'F6F6E6',
				keyvisualId: 	'2657',
				keyvisualName: 	'architekt.jpg',
				fontsetId: 		'220',
				graphicsetId: 	'260',
				contentColor: 	'000000',
				contentBGColor: 'F6F6E6',
				a_color: 		'F6F6E6',
				b_color: 		'CCCCC0',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20110303-095352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20110209-083749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3952',
internalId:  '',
customField: '20110216-102022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4015',
internalId:  '',
customField: '20110217-103153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4225',
internalId:  '',
customField: '20110218-092734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7222',
internalId:  '',
customField: '20110302-105704'
};
webappMappings['7008']=webappMappings['7008-4370']={
webappId:    '7008',
documentId:  '4225',
internalId:  '4370',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7243',
internalId:  '',
customField: '20110208-105347'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7264',
internalId:  '',
customField: '20110218-091706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7285',
internalId:  '',
customField: '20110218-092043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7306',
internalId:  '',
customField: '20110210-104323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7327',
internalId:  '',
customField: '20110208-161558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7348',
internalId:  '',
customField: '20110208-161824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7369',
internalId:  '',
customField: '20110218-092407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7390',
internalId:  '',
customField: '20110208-163329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13701',
internalId:  '',
customField: '20110216-101403'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3901',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN340INPMI6';
var companyName   = 'Majestic+Improvements+';
var htmlTitle	  = 'Majestic+Improvements+Home+Improvement+Contractor+Anne+Arundel+and+Baltimore+Counties+Maryland+Room+Additions%2C+Custom+Homes%2C+Decks%2C+Sunrooms';
var metaKeywords  = 'Room+Additions%2C+Additions%2C+Custom+Homes%2C+Decks%2C+Deck+Contractor%2C+Contractor%2C+Sunrooms%2C+Kitchens%2C+Custom+Built-ins%2C+Builder%2C+Home+Improvements%2CAnne+Arundel+County+MD%2C+Baltimore+County+MD%2C+Pasadena+MD%2C+Glen+Burnie+MD%2C+Annapolis+MD%2C+Severn+MD%2C+Remodel%2C+Demolish%2C+Fire+Water+Damage%2C+Insurance+Claims%2C+deck+builders%2C+deck+construction%2C+sunroom+addition%2C+home+additions+builder%2C+home+improvement+addition%2C+deck+installers%2C+Hanover+MD%2C+sunroom+contractor%2C+Severna+Park+MD%2C+house+addition+builders%2C+custom+decks%2C+home+addition+contractors%2C+Arnold+MD%2C+deck+company%2C+Gambrills+MD%2C+home+renovation+addition%2C+sunroom+company%2C+Odenton+MD';
var metaContents  = 'Home+Improvement+Contractor%2FBuilder+Anne+Arundel+and+Baltimore+Counties+Maryland+Room+Additions%2C+Custom+Homes%2C+Decks%2C+Sunrooms+and+More%21+410-255-7483+';
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();
};

