/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('About+the+CWSC'),jdecode(''),'/452.html','true',[],''],
	['PAGE','6201',jdecode('Lessons%2FSchedules'),jdecode(''),'/6201/index.html','true',[ 
		['PAGE','6222',jdecode('Class+Schedules'),jdecode(''),'/6201/6222.html','true',[],'']
	],''],
	['PAGE','12801',jdecode('How+to+find+us'),jdecode(''),'/12801/index.html','true',[ 
		['PAGE','12822',jdecode('Contact+Us'),jdecode(''),'/12801/12822.html','true',[],'']
	],''],
	['PAGE','15001',jdecode('Dance+Events+%26+News'),jdecode(''),'/15001/index.html','true',[ 
		['PAGE','52201',jdecode('Friday+Knight+Dance'),jdecode(''),'/15001/52201.html','true',[],'']
	],''],
	['PAGE','21801',jdecode('Photo+Album'),jdecode(''),'/21801.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='93A6CC';
theSitetree.keyvisualId='2224';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='365';
theSitetree.graphicsetId='415';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='93A6CC';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Enjoy',
				paletteFamily: 	'93A6CC',
				keyvisualId: 	'2224',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'365',
				graphicsetId: 	'415',
				contentColor: 	'000000',
				contentBGColor: '93A6CC',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'93A6CC',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-151']={
webappId:    '7008',
documentId:  '12822',
internalId:  '151',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-20838fd89633d318a6dd1e04b02d0d25']={
webappId:    '7060',
documentId:  '21801',
internalId:  '20838fd89633d318a6dd1e04b02d0d25',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090910-125144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20100817-140309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6222',
internalId:  '',
customField: '20100831-215626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15001',
internalId:  '',
customField: '20100831-215716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100710-100108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12801',
internalId:  '',
customField: '20100710-102124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12822',
internalId:  '',
customField: '20080908-092004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52201',
internalId:  '',
customField: '20100726-090019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21801',
internalId:  '',
customField: '20080907-133005'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INVL7H';
var companyName   = 'Country+%26+Western+Social+Club';
var htmlTitle	  = 'CWSC';
var metaKeywords  = 'Dancing%2C+country%2C+country++western%2C+country+western%2C+swing+dancing%2C+waltz%2C+dancing+in+Atlanta%2C+dance+lessons%2C+dance+lessons+in+Atlanta%2C+dance%2C+country+dancing%2C+country+western+dancing%2C+country+and+western+dancing%2C+country++western+dancing%2C+east+coast+swing%2C+ECS%2C+west+coast+swing%2C+WCS%2C+cha+cha%2C+cha-cha%2C+night+club+2%2C+night+club+two%2C+NC2%2C+2+step+lessons%2C+two+step+lessons';
var metaContents  = 'Dancing+at+its+very+best%21++Come+join+Bill+Robinson%2C+one+of+the+world%E2%80%99s+premier+dancers+and+learn+to+dance+the+West+Coast+Swing%2C+East+Coast+Swing%2C+Two+Step%2C+Waltz%2C+Cha-Cha%2C+and+Night+Club+2.++Dances+are+taught+on+a+rotating+basis+and+include+beginner+through+advanced+dancer+levels.';
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();
};
