/* [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','1310',jdecode('Home'),jdecode(''), jdecode('%2F1310.html'), 'true',[],'',''],
	['PAGE','5022',jdecode('Gallery'),jdecode(''), jdecode('%2F5022%2Findex.html'), 'true',[ 
		['PAGE','57101',jdecode('Landscapes'),jdecode(''), jdecode('%2F5022%2F57101.html'), 'true',[],'',''],
		['PAGE','57122',jdecode('Mission+Works'),jdecode(''), jdecode('%2F5022%2F57122.html'), 'true',[],'',''],
		['PAGE','57143',jdecode('Animals'),jdecode(''), jdecode('%2F5022%2F57143.html'), 'true',[],'',''],
		['PAGE','57164',jdecode('Still+Lifes'),jdecode(''), jdecode('%2F5022%2F57164.html'), 'true',[],'',''],
		['PAGE','68201',jdecode('Commissioned+Works'),jdecode(''), jdecode('%2F5022%2F68201.html'), 'true',[],'','']
	],'',''],
	['PAGE','1362',jdecode('Recent+Work'),jdecode(''), jdecode('%2F1362.html'), 'true',[],'',''],
	['PAGE','5001',jdecode('Prints+from+Originals'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','1415',jdecode('Contact+Me'),jdecode(''), jdecode('%2F1415.html'), 'true',[],'',''],
	['PAGE','1383',jdecode('A+Journey+of+Faith+and+Art'),jdecode(''), jdecode('%2F1383.html'), 'false',[],'',''],
	['PAGE','55501',jdecode('Shows+and+Events'),jdecode(''), jdecode('%2F55501.html'), 'true',[],'',''],
	['PAGE','1341',jdecode('About+me'),jdecode(''), jdecode('%2F1341.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Billy';
theSitetree.paletteFamily='7B5599';
theSitetree.keyvisualId='7102';
theSitetree.keyvisualName='kv_7102.jpg';
theSitetree.fontsetId='16379';
theSitetree.graphicsetId='12127';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='7B5599';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC24G'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Billy',
				paletteFamily: 	'7B5599',
				keyvisualId: 	'7102',
				keyvisualName: 	'kv_7102.jpg',
				fontsetId: 		'16379',
				graphicsetId: 	'12127',
				contentColor: 	'FFFFFF',
				contentBGColor: '7B5599',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57164',
internalId:  '',
customField: '20110327-173413'
};
webappMappings['7050']=webappMappings['7050-3312']={
webappId:    '7050',
documentId:  '1383',
internalId:  '3312',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57101',
internalId:  '',
customField: '20110324-201816'
};
webappMappings['7008']=webappMappings['7008-10465']={
webappId:    '7008',
documentId:  '1415',
internalId:  '10465',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1310',
internalId:  '',
customField: '20111227-164108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1341',
internalId:  '',
customField: '20110328-203838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1362',
internalId:  '',
customField: '20111227-162722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1383',
internalId:  '',
customField: '20110111-210218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55501',
internalId:  '',
customField: '20110127-220407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1415',
internalId:  '',
customField: '20110129-222642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57122',
internalId:  '',
customField: '20110328-061701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5022',
internalId:  '',
customField: '20111227-164302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20110328-061912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57143',
internalId:  '',
customField: '20110324-202344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68201',
internalId:  '',
customField: '20111227-171415'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INFK1I';
var companyName   = 'Paintings+by+Kristen+Molder';
var htmlTitle	  = 'Kristen+Molder+-+Purple+Lizard+Studio';
var metaKeywords  = 'Kristen+Molder+Purple+Lizard+Studio+fine+art+pastel+paintings+soft+pastels+landscapes+mission+art+work+Africa+pet+portraits';
var metaContents  = 'pastel+paintings%0AKristen+Molder';
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();
};

