/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],''],
	['PAGE','652',jdecode('About+us'),jdecode(''),'/652.html','true',[],''],
	['PAGE','673',jdecode('Contact'),jdecode(''),'/673.html','true',[],'']];
var siteelementCount=3;
theSitetree.topTemplateName='Mondrian';
theSitetree.paletteFamily='7281CC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10711';
theSitetree.graphicsetId='10887';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3E51B5';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Mondrian',
				paletteFamily: 	'7281CC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10711',
				graphicsetId: 	'10887',
				contentColor: 	'FFFFFF',
				contentBGColor: '3E51B5',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D3D3D3',
				e_color: 		'D3D3D3',
				f_color: 		'D3D3D3',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20090527-173807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20081119-131558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20081020-095932'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN010INVV5W';
var companyName   = 'UTS+-+CHICAGO%2C++WAREHOUSE+LEASE+%26+STORAGE+SERVICE';
var htmlTitle	  = 'Chicago+Warehouse+%26+Storage+%28BuildingSvc.com%29+WAREHOUSE+LEASE+%26+STORAGE+SERVICE-+UTS+Chicago';
var metaKeywords  = '+BUILDING+STORAGE+SERVICE-+UTS+Chicago+Warehouse++Storage+Chicago+%ED%95%9C%EA%B5%AD%ED%83%9D%EB%B0%B0+UTS+Chicago+Warehouse++Storage+%28BuildingSvc.com%29+WAREHOUSE+LEASE++STORAGE+SERVICE-+UTS+Chicago.++Warehouse..near+Chicago+Ohare+Airport%2C%28ChicagoWarehouse.net%29+Storage+Chicago-120%2C000+s.f.+CHICAGO+BUILDING+SERVICE-+UTS+CHICAGO+WAREHOUSE.%EC%8B%9C%EC%B9%B4%EA%B3%A0+%EC%B0%BD%EA%B3%A0%EB%B3%B4%EA%B4%80+%EC%82%AC%EB%AC%B4%EC%8B%A4+%EC%9E%84%EB%8C%80++%EC%8B%9C%EC%B9%B4%EA%B3%A0+%EA%B3%B5%ED%95%AD+%EC%A7%80%EC%97%AD+%EC%A4%91++%EC%B5%9C%EA%B3%A0%EC%9D%98+%EC%95%88%EC%A0%84%EC%A7%80%EB%8C%80%EC%9D%B4%EB%A9%B0+%EC%A3%BC%EC%9C%84%EC%9D%98+%EC%82%B0%EC%97%85%EB%B0%8F+%EB%8C%80%ED%98%95%EC%83%81%EA%B0%80+%EC%9D%B8%ED%94%84%EB%9D%BC+%EA%B5%AC%EC%B6%95%EB%90%9C+%EC%A7%80%EC%97%AD%EC%9E%84';
var metaContents  = 'Warehouse++Storage+Chicago++BUILDING+STORAGE+SERVICE-+UTS+Chicago++%ED%95%9C%EA%B5%AD%ED%83%9D%EB%B0%B0Chicago+Warehouse++Storage+%28BuildingSvc.com%29+WAREHOUSE+LEASE++STORAGE+SERVICE-+UTS+Chicago%2C+Warehouse+near+Chicago+Ohare+Airport%2C%28ChicagoWarehouse.net%29+Chicago+Storage+120%2C000+s.f.+ChicagoCHICAGO+%EC%8B%9C%EC%B9%B4%EA%B3%A0+UTS+%EC%B0%BD%EA%B3%A0%EB%B3%B4%EA%B4%80+%EC%82%AC%EB%AC%B4%EC%8B%A4+%EC%9E%84%EB%8C%80-+BUILDING++WAREHOUSE+STORAGE+SERVICE+++%EC%8B%9C%EC%B9%B4%EA%B3%A0+%EA%B3%B5%ED%95%AD+%EC%A7%80%EC%97%AD++%EC%B5%9C%EA%B3%A0%EC%9D%98+%EC%95%88%EC%A0%84%EC%A7%80%EB%8C%80%EC%9D%B4%EB%A9%B0+%EC%A3%BC%EC%9C%84%EC%9D%98+%EC%82%B0%EC%97%85%EB%B3%B5%ED%95%A9%EC%97%B0%EA%B3%84+%EC%9A%A9%EC%9D%B4%EC%A7%80%EC%97%AD%EC%9E%85%EB%8B%88%EB%8B%A4';
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();
};
