/* [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','5901',jdecode('Home'),jdecode(''), jdecode('%2F5901.html'), 'true',[],'',''],
	['PAGE','44201',jdecode('Products'),jdecode(''), jdecode('%2F44201.html'), 'true',[],'',''],
	['PAGE','8522',jdecode('Monarke+Custom'),jdecode(''), jdecode('%2F8522%2Findex.html'), 'false',[ 
		['PAGE','8543',jdecode('Smaller+Monarkes'),jdecode(''), jdecode('%2F8522%2F8543.html'), 'true',[],'','']
	],'',''],
	['PAGE','8501',jdecode('Standard+Models'),jdecode(''), jdecode('%2F8501%2Findex.html'), 'false',[ 
		['PAGE','8564',jdecode('Rembrandt'),jdecode(''), jdecode('%2F8501%2F8564.html'), 'true',[],'',''],
		['PAGE','12301',jdecode('Sweelinck'),jdecode(''), jdecode('%2F8501%2F12301.html'), 'true',[],'',''],
		['PAGE','12322',jdecode('Opus'),jdecode(''), jdecode('%2F8501%2F12322.html'), 'true',[],'',''],
		['PAGE','12343',jdecode('Makin+Westmorland'),jdecode(''), jdecode('%2F8501%2F12343.html'), 'true',[],'','']
	],'',''],
	['PAGE','34922',jdecode('Sample+Recordings'),jdecode(''), jdecode('%2F34922.html'), 'false',[],'',''],
	['PAGE','34943',jdecode('Events'),jdecode(''), jdecode('%2F34943.html'), 'true',[],'',''],
	['PAGE','35301',jdecode('Testimonials'),jdecode(''), jdecode('%2F35301%2Findex.html'), 'true',[ 
		['PAGE','65912',jdecode('Youngblood+Residence+-+Liberty%2C+TX'),jdecode(''), jdecode('%2F35301%2F65912.html'), 'true',[],'',''],
		['PAGE','35322',jdecode('St.+James+Episcopal+-+La+Grange%2C+TX'),jdecode(''), jdecode('%2F35301%2F35322.html'), 'true',[],'',''],
		['PAGE','35343',jdecode('Mt.+Calvary+Lutheran+-+San+Antonio%2C+TX'),jdecode(''), jdecode('%2F35301%2F35343.html'), 'true',[],'',''],
		['PAGE','57612',jdecode('Gengler+Residence+-+Midland%2C+TX'),jdecode(''), jdecode('%2F35301%2F57612.html'), 'true',[],'','']
	],'',''],
	['PAGE','34901',jdecode('Installations'),jdecode(''), jdecode('%2F34901.html'), 'true',[],'',''],
	['PAGE','34964',jdecode('About+Us'),jdecode(''), jdecode('%2F34964.html'), 'true',[],'',''],
	['PAGE','13301',jdecode('Contact+Us'),jdecode(''), jdecode('%2F13301.html'), 'true',[],'',''],
	['PAGE','50812',jdecode('Dick%26%23x27%3Bs+temp+page'),jdecode(''), jdecode('%2F50812.html'), 'false',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Profile';
theSitetree.paletteFamily='336699';
theSitetree.keyvisualId='1263';
theSitetree.keyvisualName='handwerk_detail.jpg';
theSitetree.fontsetId='190';
theSitetree.graphicsetId='230';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Profile',
				paletteFamily: 	'336699',
				keyvisualId: 	'1263',
				keyvisualName: 	'handwerk_detail.jpg',
				fontsetId: 		'190',
				graphicsetId: 	'230',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'336699',
				b_color: 		'336699',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20100221-172506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8543',
internalId:  '',
customField: '20080422-231208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8564',
internalId:  '',
customField: '20080423-142251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8522',
internalId:  '',
customField: '20080422-230941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8501',
internalId:  '',
customField: '20080422-230704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12301',
internalId:  '',
customField: '20080422-231356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12322',
internalId:  '',
customField: '20080422-231457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12343',
internalId:  '',
customField: '20080409-143303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13301',
internalId:  '',
customField: '20090212-154929'
};
webappMappings['7008']=webappMappings['7008-2242']={
webappId:    '7008',
documentId:  '13301',
internalId:  '2242',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44201',
internalId:  '',
customField: '20090212-153642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34922',
internalId:  '',
customField: '20080422-160028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50812',
internalId:  '',
customField: '20080424-085722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34943',
internalId:  '',
customField: '20111207-174349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34964',
internalId:  '',
customField: '20100221-171648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34901',
internalId:  '',
customField: '20111207-180201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35301',
internalId:  '',
customField: '20100604-164522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35322',
internalId:  '',
customField: '20081108-204007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35343',
internalId:  '',
customField: '20081108-204018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57612',
internalId:  '',
customField: '20081108-210128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65912',
internalId:  '',
customField: '20111207-181756'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXLR5';
var companyName   = 'JOHANNUS+Organs+of+Texas';
var htmlTitle	  = 'Johannus+Organs+of+Texas+-+digital+church+organs%2C+pipe+organ+console+replacements+and+upgrades%2C+sales%2C+service%2C+installation';
var metaKeywords  = 'Johannus+organs%2Cdigital+organs%2C+church+organs%2C+pipe+organs%2CTexas%2CMonarke%2CSweelinck%2COpus%2CRembrandt%2Corgan+console';
var metaContents  = 'Authorized+provider+of+Johannus+church+organs+in+Texas+and+the+Southwest.+Custom+organs%2C+pipe+organ+additions%2C+console+replacements.+Sales%2C+service%2C+installation%2C+and+consultation.';
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();
};

