/* [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','33',jdecode('Home+%2F+Contact+Info'),jdecode(''),'/33.html','true',[],''],
	['PAGE','1218',jdecode('Properties+%2F+Directions'),jdecode(''),'/1218.html','true',[],''],
	['PAGE','1149',jdecode('Available+dates+%2F+Prices'),jdecode(''),'/1149.html','true',[],''],
	['PAGE','2104',jdecode('Floor+Plans'),jdecode(''),'/2104/index.html','true',[ 
		['PAGE','2113',jdecode('1200+sq+ft+home+'),jdecode(''),'/2104/2113.html','true',[],''],
		['PAGE','2284',jdecode('1000+sq+ft+home'),jdecode(''),'/2104/2284.html','true',[],''],
		['PAGE','38382',jdecode('850+sq+ft+home'),jdecode(''),'/2104/38382.html','true',[],''],
		['PAGE','2441',jdecode('402+W.+Rigdon'),jdecode(''),'/2104/2441.html','true',[],'']
	],''],
	['PAGE','33682',jdecode('Pictures'),jdecode(''),'/33682/index.html','true',[ 
		['PAGE','34982',jdecode('Clayton+pistures'),jdecode(''),'/33682/34982.html','true',[],'']
	],'']];
var siteelementCount=10;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='006666';
theSitetree.keyvisualId='984';
theSitetree.keyvisualName='kommode_vase.jpg';
theSitetree.fontsetId='167';
theSitetree.graphicsetId='198';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'NewYork',
				paletteFamily: 	'006666',
				keyvisualId: 	'984',
				keyvisualName: 	'kommode_vase.jpg',
				fontsetId: 		'167',
				graphicsetId: 	'198',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003333',
				b_color: 		'006666',
				c_color: 		'000000',
				d_color: 		'009999',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33',
internalId:  '',
customField: '20100812-080529'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1149',
internalId:  '',
customField: '20100812-084957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1218',
internalId:  '',
customField: '20100812-081111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2104',
internalId:  '',
customField: '20070215-090226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2113',
internalId:  '',
customField: '20081216-115427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2284',
internalId:  '',
customField: '20081216-121432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2441',
internalId:  '',
customField: '20080612-081825'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '33',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38382',
internalId:  '',
customField: '20090806-123851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34982',
internalId:  '',
customField: '20090123-100453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33682',
internalId:  '',
customField: '20090123-091344'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH010IN2992';
var companyName   = 'Compton+Rentals';
var htmlTitle	  = 'Compton+Rentals%2C+SIU%2C+Carbondale%2C+Illinois';
var metaKeywords  = 'rental+housing+SIU+Southern+Illinois+University+Carbondale+Illinois+mobile+home+manufactured+home';
var metaContents  = '+rental+housing+in+Carbondale%2C+Illinois+at+Southern+Illinois+University%2C+SIU%2C+mobile+home%2C+manufactured+home';
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();
};
