/* [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','3301',jdecode('Home'),jdecode(''),'/3301.html','true',[],'',''],
	['PAGE','5101',jdecode('Commercial+Properties'),jdecode(''),'/5101.html','true',[],'',''],
	['PAGE','6101',jdecode('10+W.+Huron'),jdecode(''),'/6101.html','false',[],'',''],
	['PAGE','10612',jdecode('47-63+W.+Huron'),jdecode(''),'/10612.html','false',[],'',''],
	['PAGE','11312',jdecode('16-20+W.+Huron'),jdecode(''),'/11312.html','false',[],'',''],
	['PAGE','12112',jdecode('75+W.+Huron'),jdecode(''),'/12112.html','false',[],'',''],
	['PAGE','16512',jdecode('Request+Information'),jdecode(''),'/16512.html','true',[],'',''],
	['PAGE','5501',jdecode('Property+Photo%26%23x27%3Bs'),jdecode(''),'/5501.html','true',[],'',''],
	['PAGE','23112',jdecode('Residental+Properties'),jdecode(''),'/23112.html','true',[],'',''],
	['PAGE','25012',jdecode('132+W.+Lawrence'),jdecode(''),'/25012.html','true',[],'',''],
	['PAGE','25033',jdecode('51+Spokane'),jdecode(''),'/25033.html','true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Bigcity_Space';
theSitetree.paletteFamily='418980';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='21077';
theSitetree.graphicsetId='13167';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='418980';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Bigcity_Space',
				paletteFamily: 	'418980',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'21077',
				graphicsetId: 	'13167',
				contentColor: 	'FFFFFF',
				contentBGColor: '418980',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3301',
internalId:  '',
customField: '20100110-063853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20091231-181904'
};
webappMappings['7060']=webappMappings['7060-36663d31a45f682574d230e615506eb0']={
webappId:    '7060',
documentId:  '5501',
internalId:  '36663d31a45f682574d230e615506eb0',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20090408-140610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20091229-222115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10612',
internalId:  '',
customField: '20091229-222729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11312',
internalId:  '',
customField: '20091230-143551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12112',
internalId:  '',
customField: '20091230-141120'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3301',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-13063']={
webappId:    '7008',
documentId:  '16512',
internalId:  '13063',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16512',
internalId:  '',
customField: '20091229-220546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25033',
internalId:  '',
customField: '20100621-151506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25012',
internalId:  '',
customField: '20100622-101403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23112',
internalId:  '',
customField: '20100622-101718'
};
var canonHostname = 'diywk00.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHW1F';
var companyName   = 'Monarch+Investments';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};
