/* [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','8401',jdecode('Welcome'),jdecode(''),'/8401.html','true',[],''],
	['PAGE','8222',jdecode('News'),jdecode(''),'/8222.html','true',[],''],
	['PAGE','8201',jdecode('Biography'),jdecode(''),'/8201.html','true',[],''],
	['PAGE','3894',jdecode('Art+%26+Fine+Living+w%2FJona'),jdecode(''),'/3894.html','true',[],''],
	['PAGE','3801',jdecode('Artist+Representation'),jdecode(''),'/3801.html','true',[],''],
	['PAGE','3852',jdecode('Press+Releases'),jdecode(''),'/3852.html','true',[],''],
	['PAGE','3936',jdecode('Photos-Radio%26Friends'),jdecode(''),'/3936.html','true',[],''],
	['PAGE','3873',jdecode('Lori+Laitman'),jdecode(''),'/3873.html','true',[],''],
	['PAGE','3915',jdecode('Contact%2FLinks'),jdecode(''),'/3915.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='FBB044';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32047';
theSitetree.graphicsetId='13869';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Grace',
				paletteFamily: 	'FBB044',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32047',
				graphicsetId: 	'13869',
				contentColor: 	'484848',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20100325-120513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3873',
internalId:  '',
customField: '20100325-122548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8201',
internalId:  '',
customField: '20100410-163945'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3894',
internalId:  '',
customField: '20100325-121900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20100713-090704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3852',
internalId:  '',
customField: '20100616-132822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8222',
internalId:  '',
customField: '20100713-102038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3936',
internalId:  '',
customField: '20100325-121649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3915',
internalId:  '',
customField: '20100430-175646'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1501']={
webappId:    '1501',
documentId:  '8401',
internalId:  '1501',
customField: '1501'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8201',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3894',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3801',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3852',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8222',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3936',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3873',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '3915',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-26993806']={
webappId:    '1501',
documentId:  '8401',
internalId:  '26993806',
customField: '1501'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INVLRA';
var companyName   = 'Jona+Rapoport%3A+Radio+Host+%26++Artist+Management%2FPR';
var htmlTitle	  = 'Jona+Rapoport+Artist+Management+%26+Radio+Host';
var metaKeywords  = 'jona+%2Crapoport+%2Cart%2C+culture%2Cart++fine+living+with+Jona%2Cradio%2C+producer%2Chost%2Cjournalist%2Cartist+management%2C+publicity%2C+PR%2C+press+release%2Cmarketing%2Creviews%2C+interviews%2C+music%2Copera%2Cdrama%2Ctheater%2Cdance%2Cballet%2Ccinema%2Cclassical%2C+jazz%2Cmedia%2Ccomposer%2C+lori%2C+laitman%2Ctenor%2Cben%2C+heppner%2C+violinist+James%2C+Ehnes%2C+Measha%2CBrueggergosman%2CNir%2CKabaretti%2C+Opera+de+Montreal%2C+Centaur%2Ctheatre%2C+Canada%2CMontreal%2Cmuseum%2C+contemporary%2Cauthor%2Cgrsee+consulting%2C+osm%2Cbach+festival%2Cothalie+graham%2Ccourtney+huffman%2C';
var metaContents  = 'Jona+Rapoport++Producer+and+Host%2C+Art++Fine+Living+with+Jona%2C+CJRS+1650+AM+Radio+in+Montreal%2C+and+Jona+Rapoport+Artist+Management%2FPR%2C+providing+artist+management+and+publicity+services+to+artists%2C+art+organizations+and+corporations.';
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();
};
