/* [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','6901',jdecode('Home'),jdecode(''),'/6901.html','true',[],''],
	['PAGE','6952',jdecode('Properties'),jdecode(''),'/6952.html','true',[],''],
	['PAGE','6973',jdecode('Our+Community'),jdecode(''),'/6973/index.html','true',[ 
		['PAGE','6994',jdecode('Businesses'),jdecode(''),'/6973/6994.html','true',[],''],
		['PAGE','7036',jdecode('Churches'),jdecode(''),'/6973/7036.html','true',[],''],
		['PAGE','61801',jdecode('Photos'),jdecode(''),'/6973/61801.html','true',[],''],
		['PAGE','29001',jdecode('Recreation'),jdecode(''),'/6973/29001.html','true',[],''],
		['PAGE','7015',jdecode('Schools'),jdecode(''),'/6973/7015.html','true',[],''],
		['PAGE','28901',jdecode('Services'),jdecode(''),'/6973/28901.html','true',[],'']
	],''],
	['PAGE','7057',jdecode('Contact+Us'),jdecode(''),'/7057.html','true',[],''],
	['PAGE','29022',jdecode('About+us'),jdecode(''),'/29022.html','true',[],''],
	['PAGE','31501',jdecode('Links'),jdecode(''),'/31501.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1752';
theSitetree.keyvisualName='handwerkszeug.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1752',
				keyvisualName: 	'handwerkszeug.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				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:  '6901',
internalId:  '',
customField: '20090413-105918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6973',
internalId:  '',
customField: '20100309-114533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7015',
internalId:  '',
customField: '20100309-114815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6994',
internalId:  '',
customField: '20090414-104627'
};
webappMappings['7008']=webappMappings['7008-2878']={
webappId:    '7008',
documentId:  '7057',
internalId:  '2878',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7057',
internalId:  '',
customField: '20090413-110629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6952',
internalId:  '',
customField: '20100309-114426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7036',
internalId:  '',
customField: '20090414-100130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28901',
internalId:  '',
customField: '20100309-114909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29001',
internalId:  '',
customField: '20090615-152628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29022',
internalId:  '',
customField: '20090430-121654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31501',
internalId:  '',
customField: '20090414-111221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61801',
internalId:  '',
customField: '20090430-114946'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INL52E';
var companyName   = 'Powers+Lake+Housing%2C+Inc';
var htmlTitle	  = 'Powers+Lake+Housing%2C+Inc.';
var metaKeywords  = 'power%2C+powers%2C+lake%2C+north%2C+dakota%2C+burke%2C+mountrail%2C+house%2C+housing%2C+home%2C+invest%2C+country+store%2C+grocery%2C+country%2C+prairie%2C+smishek%2C+battleview%2C+horse%2C+cenex%2C+food%2C+barn%2C+tractor%2C+business%2C+water%2C+school%2C+rural%2C+construction%2C+carpet%2C+furniture%2C+country+fresh+foods%2C+bank%2C+finance%2C+mortgage%2C+city%2C+senior%2C+ambulance%2C+fire%2C+church%2C+ambulance%2C+golf%2C+hunt%2C+fish%2C+recreation%2C+livestock%2C+centennial%2C+country%2C+living%2C+oil%2C+well%2C+bakken%2C+rockin+the+bakken%2C+three+forks%2C+liberty+state+bank%2C+city+hall%2C+police%2C+senior%2C+';
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();
};
