/* [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','2801',jdecode('Home'),jdecode(''),'/2801.html','true',[],'',''],
	['PAGE','7101',jdecode('Who+We+Are'),jdecode(''),'/7101.html','true',[],'',''],
	['PAGE','21101',jdecode('New+Homes+For+Sale%21+'),jdecode(''),'/21101/index.html','true',[ 
		['PAGE','7164',jdecode('473+Shadowmoss+Pkwy'),jdecode(''),'/21101/7164.html','true',[],'',''],
		['PAGE','44501',jdecode('Map'),jdecode(''),'/21101/44501.html','true',[],'','']
	],'',''],
	['PAGE','24901',jdecode('Homes+We+Have+Built'),jdecode(''),'/24901.html','true',[],'',''],
	['PAGE','28501',jdecode('Customer+Comments'),jdecode(''),'/28501.html','true',[],'',''],
	['PAGE','7185',jdecode('Build+Your+Dream+Home'),jdecode(''),'/7185/index.html','true',[ 
		['PAGE','7206',jdecode('Find+Your+Lot%21'),jdecode(''),'/7185/7206.html','true',[],'',''],
		['PAGE','7227',jdecode('Select+Your+Plan%21'),jdecode(''),'/7185/7227.html','true',[],'',''],
		['PAGE','7248',jdecode('Tips+for+First+Time+Builders%21'),jdecode(''),'/7185/7248.html','true',[],'','']
	],'',''],
	['PAGE','7269',jdecode('About+Charleston'),jdecode(''),'/7269.html','true',[],'',''],
	['PAGE','7290',jdecode('Contact'),jdecode(''),'/7290.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Collage';
theSitetree.paletteFamily='D43A3A';
theSitetree.keyvisualId='2456';
theSitetree.keyvisualName='hausbau.jpg';
theSitetree.fontsetId='403';
theSitetree.graphicsetId='460';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Collage',
				paletteFamily: 	'D43A3A',
				keyvisualId: 	'2456',
				keyvisualName: 	'hausbau.jpg',
				fontsetId: 		'403',
				graphicsetId: 	'460',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'D43A3A',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '44501',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20090821-143449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21101',
internalId:  '',
customField: '20100701-090537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7164',
internalId:  '',
customField: '20090326-085920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44501',
internalId:  '',
customField: '20070904-145918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7101',
internalId:  '',
customField: '20100104-092800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24901',
internalId:  '',
customField: '20100701-091235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28501',
internalId:  '',
customField: '20070921-183952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7185',
internalId:  '',
customField: '20100317-101825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7206',
internalId:  '',
customField: '20100701-101109'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7227',
internalId:  '',
customField: '20100701-101424'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7248',
internalId:  '',
customField: '20100701-094709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7269',
internalId:  '',
customField: '20070831-161155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7290',
internalId:  '',
customField: '20090531-113448'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INEYCE';
var companyName   = 'Welcome+Home%21++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++';
var htmlTitle	  = 'Charleston+SC+Home+Builder';
var metaKeywords  = 'Custom+homes%2C+luxury+homes%2C+home+builders%2C+Charleston+sc+real+estate%2C+Contractor%2C+Bill+Douglas%2C+house+plans%2C+lots+for+sale%2C+west+ashley%2C+middleborough+estates%2C+highway+61%2C+st.+francis+hospital%2C+west+ashley+high+school%2C+golf+course+lots%2C+golf+course+homes%2C+shadowmoss%2C+family+homes%2C+remodeling%2C+additions%2C+home+improvements';
var metaContents  = 'Charleston+SC+Home+Builder%2C+Charleston+Custom+Builder%2C+Charleston+Home+Builder%2C+Home+Builder+in+Charleston%2C+Charleston+Builder%2C+Charleston+Home+Contractor+';
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();
};
