/* [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','43',jdecode('Home'),jdecode(''), jdecode('%2F43.html'), 'true',[],'',''],
	['PAGE','73',jdecode('Before+Graduation'),jdecode(''), jdecode('%2F73.html'), 'true',[],'',''],
	['PAGE','14243',jdecode('Videos'),jdecode(''), jdecode('%2F14243.html'), 'true',[],'',''],
	['PAGE','2326',jdecode('1st+Official+Photograph'),jdecode(''), jdecode('%2F2326.html'), 'true',[],'',''],
	['PAGE','3732',jdecode('Flight+Photo'),jdecode(''), jdecode('%2F3732.html'), 'true',[],'',''],
	['PAGE','4323',jdecode('Airman%26%23x27%3Bs+Creed+Poster'),jdecode(''), jdecode('%2F4323.html'), 'true',[],'',''],
	['PAGE','4384',jdecode('Photo+DVD'),jdecode(''), jdecode('%2F4384.html'), 'true',[],'',''],
	['PAGE','3759',jdecode('Airman+Yearbook'),jdecode(''), jdecode('%2F3759.html'), 'true',[],'',''],
	['PAGE','4679',jdecode('Gift+Items'),jdecode(''), jdecode('%2F4679.html'), 'true',[],'',''],
	['PAGE','100',jdecode('Contact+Us'),jdecode(''), jdecode('%2F100.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Americanlife';
theSitetree.paletteFamily='7C7B7B';
theSitetree.keyvisualId='4249';
theSitetree.keyvisualName='kv_4249.jpg';
theSitetree.fontsetId='10673';
theSitetree.graphicsetId='11190';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='959494';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC241'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Americanlife',
				paletteFamily: 	'7C7B7B',
				keyvisualId: 	'4249',
				keyvisualName: 	'kv_4249.jpg',
				fontsetId: 		'10673',
				graphicsetId: 	'11190',
				contentColor: 	'000000',
				contentBGColor: '959494',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '43',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43',
internalId:  '',
customField: '20110505-125711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4323',
internalId:  '',
customField: '20110314-163402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2326',
internalId:  '',
customField: '20110314-163336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3732',
internalId:  '',
customField: '20111122-115406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4384',
internalId:  '',
customField: '20110314-162949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3759',
internalId:  '',
customField: '20110314-163005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4679',
internalId:  '',
customField: '20110911-100628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100',
internalId:  '',
customField: '20110505-125635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73',
internalId:  '',
customField: '20110920-092949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14243',
internalId:  '',
customField: '20110920-093257'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3N9';
var companyName   = 'Basic+Video+Productions';
var htmlTitle	  = 'Air+Force+Basic+Training';
var metaKeywords  = 'basic+video%2C+basic+training%2C+graduation%2C+graduation+video%2C+air+force+video%2C+air+force+graduation%2C+video%2C+basic%2C+a.f.b.%2C+a.f.%2C+san+antonio%2C+lackland%2C+lackland+AFB%2C+airman%2C+airmen%2C+bootcamp%2C+graduate%2C+AF%2C+AFB%2C+Texas%2C+military%2C+training%2C+lakeland%2C+order%2C+pictures%2C+photo%2C+photos%2C+air+force%2C++';
var metaContents  = 'graduation+video%2C+basic+training+video%2C+basic+video%2C+airforce+video%2C+air+force+video%2C+military+training%2C+air+force+pictures%2C+basic+training+pictures%2C+photo%2C+photos+';
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();
};

