/* [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','22',jdecode('Home'),jdecode(''),'/22.html','true',[],'',''],
	['PAGE','2667',jdecode('Photography+Galleries'),jdecode(''),'/2667/index.html','true',[ 
		['PAGE','2814',jdecode('American+West+Gallery'),jdecode(''),'/2667/2814.html','true',[],'',''],
		['PAGE','93315',jdecode('American+West+Gallery2'),jdecode(''),'/2667/93315.html','true',[],'',''],
		['PAGE','106515',jdecode('American+West+3'),jdecode(''),'/2667/106515.html','true',[],'',''],
		['PAGE','4559',jdecode('New+England++Gallery'),jdecode(''),'/2667/4559.html','true',[],'',''],
		['PAGE','89415',jdecode('Fine+Art+Posters'),jdecode(''),'/2667/89415.html','true',[],'',''],
		['PAGE','90715',jdecode('Wildlife+Gallery'),jdecode(''),'/2667/90715.html','true',[],'',''],
		['PAGE','69515',jdecode('Images+2009'),jdecode(''),'/2667/69515.html','true',[],'','']
	],'',''],
	['PAGE','71615',jdecode('New+Images+2009+2'),jdecode(''),'/71615.html','false',[],'',''],
	['PAGE','74115',jdecode('New+Images+2009%283%29'),jdecode(''),'/74115.html','false',[],'',''],
	['PAGE','5278',jdecode('Stock+Images'),jdecode(''),'/5278.html','true',[],'',''],
	['PAGE','4338',jdecode('Contact'),jdecode(''),'/4338.html','true',[],'',''],
	['PAGE','96815',jdecode('email+APG'),jdecode(''),'/96815.html','false',[],'',''],
	['PAGE','4886',jdecode('Bio'),jdecode(''),'/4886.html','true',[],'',''],
	['PAGE','50015',jdecode('General+Info'),jdecode(''),'/50015.html','true',[],'',''],
	['PAGE','52815',jdecode('Catalog%2FPurchase'),jdecode(''),'/52815.html','true',[],'',''],
	['PAGE','101215',jdecode('Wyoming+Centennial+poster'),jdecode(''),'/101215.html','true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Welcome';
theSitetree.paletteFamily='482ED0';
theSitetree.keyvisualId='9193';
theSitetree.keyvisualName='kv_9193.jpg';
theSitetree.fontsetId='10364';
theSitetree.graphicsetId='10525';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='482ED0';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Welcome',
				paletteFamily: 	'482ED0',
				keyvisualId: 	'9193',
				keyvisualName: 	'kv_9193.jpg',
				fontsetId: 		'10364',
				graphicsetId: 	'10525',
				contentColor: 	'FFFFFF',
				contentBGColor: '482ED0',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'938BBD',
				e_color: 		'B4AED6',
				f_color: 		'60E37E',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93315',
internalId:  '',
customField: '20100815-123606'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '22',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-1ab7802fbbbc88821abffe0a6e7ba29c']={
webappId:    '7060',
documentId:  '2814',
internalId:  '1ab7802fbbbc88821abffe0a6e7ba29c',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-d5c27c64a4182fd084708731beb7f715']={
webappId:    '7060',
documentId:  '4559',
internalId:  'd5c27c64a4182fd084708731beb7f715',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22',
internalId:  '',
customField: '20100815-131025'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2667',
internalId:  '',
customField: '20100628-095818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2814',
internalId:  '',
customField: '20100516-195703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4559',
internalId:  '',
customField: '20100516-195909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89415',
internalId:  '',
customField: '20100414-215758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90715',
internalId:  '',
customField: '20100326-213036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5278',
internalId:  '',
customField: '20091130-202828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4338',
internalId:  '',
customField: '20100414-212444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4886',
internalId:  '',
customField: '20091201-161740'
};
webappMappings['1501']=webappMappings['1501-22367']={
webappId:    '1501',
documentId:  '22',
internalId:  '22367',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50015',
internalId:  '',
customField: '20090918-094545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52815',
internalId:  '',
customField: '20100830-104519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71615',
internalId:  '',
customField: '20091130-230009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '69515',
internalId:  '',
customField: '20100326-214739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74115',
internalId:  '',
customField: '20091127-133147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '106515',
internalId:  '',
customField: '20100815-124513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101215',
internalId:  '',
customField: '20100517-000157'
};
webappMappings['7008']=webappMappings['7008-7558']={
webappId:    '7008',
documentId:  '96815',
internalId:  '7558',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '96815',
internalId:  '',
customField: '20100414-212727'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXSXO';
var companyName   = 'American+Photoart+Gallery+-+Philip+Bobrow';
var htmlTitle	  = 'American+Photoart+Gallery+-+Philip+Bobrow';
var metaKeywords  = 'photography%2C+photo%2C+photographer%2C+photos%2C+gallery%2C+art%2C+wall+decor%2C+pics%2C+images%2C+grand+teton%2C+yellowstone%2C+national+parks%2C+american+west%2C+new+england%2C+phil+bobrow%2C+philip+bobrow%2C+bobrow%2Cphotoart%2C+american+photoart+gallery%2C+vermont%2C+maine%2C+mountains%2C+rivers%2C+recreation%2C+wyoming%2C+utah%2C+american+west%2C+moon%2C+full+moon%2C+moonscape%2C+landscape%2C+townscape%2C+fireworks%2C+july+4th%2C+tetons.';
var metaContents  = 'Breathtaking+images+of+New+England+and+the+American+West+by+nationally+known+photographer%2C+Philip+Bobrow.+Peruse+the+galleries+exibiting+30+years+of+award+winning+photography%2C+of+landscape%2C+people%2C+flora+and+wildlife+images+from+Wyoming%2C+Utah%2C+Vermont+and+Maine.+Locations+include+Grand+Teton%2FYellowstone+NPs%2C+Vermonts+Green+Mountains%2C+Utah+and+Maine.';
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();
};
