/* [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','19001',jdecode('Home'),jdecode(''),'/19001.html','true',[],''],
	['PAGE','19022',jdecode('Products+on+Sale'),jdecode(''),'/19022.html','true',[],''],
	['PAGE','45112',jdecode('New+PIS+Projects'),jdecode(''),'/45112.html','true',[],''],
	['PAGE','159923',jdecode('Paint+Downloads'),jdecode(''),'/159923.html','true',[],''],
	['PAGE','37612',jdecode('Product+Reviews'),jdecode(''),'/37612.html','true',[],''],
	['PAGE','19094',jdecode('PIS+Forum'),jdecode(''),'/19094.html','true',[],''],
	['PAGE','19115',jdecode('PIS+Support'),jdecode(''),'/19115/index.html','true',[ 
		['PAGE','36812',jdecode('Freeware'),jdecode(''),'/19115/36812.html','true',[],'']
	],''],
	['PAGE','19136',jdecode('Real+World+Aviation'),jdecode(''),'/19136.html','true',[],''],
	['PAGE','19157',jdecode('Pilot+Logbook'),jdecode(''),'/19157.html','true',[],''],
	['PAGE','29501',jdecode('About+Us'),jdecode(''),'/29501.html','true',[],''],
	['PAGE','32701',jdecode('Essential+Links'),jdecode(''),'/32701.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Holz';
theSitetree.paletteFamily='FF7112';
theSitetree.keyvisualId='8821';
theSitetree.keyvisualName='KV_07.swf';
theSitetree.fontsetId='17181';
theSitetree.graphicsetId='12654';
theSitetree.contentColor='FF7112';
theSitetree.contentBGColor='262626';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Holz',
				paletteFamily: 	'FF7112',
				keyvisualId: 	'8821',
				keyvisualName: 	'KV_07.swf',
				fontsetId: 		'17181',
				graphicsetId: 	'12654',
				contentColor: 	'FF7112',
				contentBGColor: '262626',
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FF6600',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37612',
internalId:  '',
customField: '20100415-204556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19022',
internalId:  '',
customField: '20100305-082009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19001',
internalId:  '',
customField: '20100415-204941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19094',
internalId:  '',
customField: '20090928-183247'
};
webappMappings['7060']=webappMappings['7060-a82f2ecc38535cf1abe4069594b57a9f']={
webappId:    '7060',
documentId:  '19022',
internalId:  'a82f2ecc38535cf1abe4069594b57a9f',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19115',
internalId:  '',
customField: '20100212-171647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19136',
internalId:  '',
customField: '20090928-182402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19157',
internalId:  '',
customField: '20090928-183749'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '19001',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-18499679']={
webappId:    '1501',
documentId:  '19001',
internalId:  '18499679',
customField: '1501'
};
webappMappings['1002']=webappMappings['1002-19157aendu0in3i07']={
webappId:    '1002',
documentId:  '19157',
internalId:  '19157aendu0in3i07',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36812',
internalId:  '',
customField: '20090928-183718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29501',
internalId:  '',
customField: '20091130-172634'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32701',
internalId:  '',
customField: '20100422-171454'
};
webappMappings['7060']=webappMappings['7060-3ba34427bdfb5ab2a5a8716ccdb21ba9']={
webappId:    '7060',
documentId:  '19136',
internalId:  '3ba34427bdfb5ab2a5a8716ccdb21ba9',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-a3fdd2a140c2b358741fc00571252156']={
webappId:    '7060',
documentId:  '45112',
internalId:  'a3fdd2a140c2b358741fc00571252156',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45112',
internalId:  '',
customField: '20091121-001831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '159923',
internalId:  '',
customField: '20100207-175721'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0IN3I07';
var companyName   = 'Pacific+Islands+Simulation+++++++++-+++++++++%27Scenes+from+the+South+Pacific%27';
var htmlTitle	  = 'Pacific+Islands+Simulation';
var metaKeywords  = '';
var metaContents  = '';
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();
};

