/* [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','6001',jdecode('Home'),jdecode(''),'/6001.html','true',[],''],
	['PAGE','6094',jdecode('August+21%2C+2010'),jdecode(''),'/6094.html','true',[],''],
	['PAGE','13201',jdecode('I%26%23x27%3Bd+Like+to+Help'),jdecode(''),'/13201.html','true',[],''],
	['PAGE','14801',jdecode('Contact+Us'),jdecode(''),'/14801.html','true',[],'']];
var siteelementCount=4;
theSitetree.topTemplateName='Hollywood';
theSitetree.paletteFamily='614DBB';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26571';
theSitetree.graphicsetId='13396';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F0F2C4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Hollywood',
				paletteFamily: 	'614DBB',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26571',
				graphicsetId: 	'13396',
				contentColor: 	'000000',
				contentBGColor: 'F0F2C4',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20100717-132733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6094',
internalId:  '',
customField: '20100604-182906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14801',
internalId:  '',
customField: '20100605-015853'
};
webappMappings['7008']=webappMappings['7008-24310']={
webappId:    '7008',
documentId:  '13201',
internalId:  '24310',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13201',
internalId:  '',
customField: '20100605-015843'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-24325']={
webappId:    '7008',
documentId:  '14801',
internalId:  '24325',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INV2AL';
var companyName   = 'Family+Movie+Nights';
var htmlTitle	  = 'Family+Movie+Nights';
var metaKeywords  = 'Harlingen+Movie+Nights%2C+things+to+do%2C+activities%2C+games%2C+free%2C+food%2C+free+food%2C+board%2C+films%2C+concert%2C+festival%2C+shows%2C+movie%2C+movies%2C+cinema%2C+outdoor%2C+event%2C+hill%2C+kids%2C+kid%2C+downtown%2C+snacks%2C+friend%2C+friends%2C+fun%2C+excitement%2C+summer%2C+weekend%2C+lawn%2C+music%2C+car+show%2C+car+shows%2C+clean%2C+wholesome%2C+entertainment%2C+park%2C+hill%2C+blues';
var metaContents  = 'Family+Movie+Nights+is+Harlingens+only+free+family-friendly+outdoor+movie+event.+Bring+your+friends%2C+familymembers%2C+lawn+chairs+and+blankets+and+get+ready+for+a+great+wholesome+time.+Join+us+every+third+Saturday+of+June%2C+July%2C+and+August+in+beautiful+and+historic+downtown+Harlingen.+Stroll+through+downtown+Harlingen+and+rediscover+its+unique+and+charming+shops+and+restaurants.+In+the+evening%2C+enjoy+all+of+the+fun+and+free+summer+activities+like+the+car+shows%2C+live+music%2C+free+snacks%2C+balloons%2C+and+our+great+featured+films%2C+so+dont+forget+to+bring+your+camera.++';
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();
};
