/* [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','7501',jdecode('Home'),jdecode(''),'/7501.html','true',[],'',''],
	['PAGE','7552',jdecode('About+us'),jdecode(''),'/7552.html','true',[],'',''],
	['PAGE','7573',jdecode('News'),jdecode(''),'/7573.html','true',[],'',''],
	['PAGE','7594',jdecode('Contact'),jdecode(''),'/7594.html','true',[],'',''],
	['PAGE','7615',jdecode('Events'),jdecode(''),'/7615.html','true',[],'',''],
	['PAGE','7636',jdecode('Club+News'),jdecode(''),'/7636.html','true',[],'',''],
	['PAGE','7657',jdecode('Instruction'),jdecode(''),'/7657.html','true',[],'',''],
	['PAGE','7678',jdecode('Fun'),jdecode(''),'/7678.html','true',[],'',''],
	['PAGE','7699',jdecode('Store'),jdecode(''),'/7699.html','true',[],'',''],
	['PAGE','7720',jdecode('The+House+of+Chess+Blog'),jdecode(''),'/7720.html','true',[],'',''],
	['PAGE','7741',jdecode('Location'),jdecode(''),'/7741.html','true',[],'',''],
	['PAGE','7762',jdecode('Driving+Directions'),jdecode(''),'/7762.html','true',[],'',''],
	['PAGE','7783',jdecode('Guestbook'),jdecode(''),'/7783.html','true',[],'',''],
	['PAGE','7804',jdecode('Media'),jdecode(''),'/7804.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Jakarta';
theSitetree.paletteFamily='9E9C9C';
theSitetree.keyvisualId='7861';
theSitetree.keyvisualName='kv_7861.jpg';
theSitetree.fontsetId='16854';
theSitetree.graphicsetId='12295';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D2D2D2';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'true',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Jakarta',
				paletteFamily: 	'9E9C9C',
				keyvisualId: 	'7861',
				keyvisualName: 	'kv_7861.jpg',
				fontsetId: 		'16854',
				graphicsetId: 	'12295',
				contentColor: 	'000000',
				contentBGColor: 'D2D2D2',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'9E9C9C',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7050']=webappMappings['7050-99']={
webappId:    '7050',
documentId:  '7720',
internalId:  '99',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '7741',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '7762',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['1002']=webappMappings['1002-7783anfi10inxhd1']={
webappId:    '1002',
documentId:  '7783',
internalId:  '7783anfi10inxhd1',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-3df7b2f3c32e9f71dc75158c0bd747a1']={
webappId:    '7060',
documentId:  '7804',
internalId:  '3df7b2f3c32e9f71dc75158c0bd747a1',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20100902-075001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7552',
internalId:  '',
customField: '20091013-162820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7699',
internalId:  '',
customField: '20091109-180452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7678',
internalId:  '',
customField: '20091109-180337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7720',
internalId:  '',
customField: '20091222-100657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7741',
internalId:  '',
customField: '20090930-205143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7615',
internalId:  '',
customField: '20100705-063532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7762',
internalId:  '',
customField: '20091101-233549'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7783',
internalId:  '',
customField: '20090930-205147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7804',
internalId:  '',
customField: '20090930-205147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7636',
internalId:  '',
customField: '20100817-060758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7594',
internalId:  '',
customField: '20091014-190222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7573',
internalId:  '',
customField: '20100705-070933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7657',
internalId:  '',
customField: '20091021-174545'
};
webappMappings['1501']=webappMappings['1501-7323420']={
webappId:    '1501',
documentId:  '7501',
internalId:  '7323420',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '7501',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'localhost';
var accountId     = 'ANFI10INXHD1';
var companyName   = 'The+House+of+Chess';
var htmlTitle	  = 'The+House+of+Chess';
var metaKeywords  = 'Chess%2C+Chess+Club%2C+Chess+Store%2C+Chess+book%2C+Chess+Player%2C+Chess+Tournament%2CChess+Board%2C+Chess+Set%2C+Chess+Clock%2C+Chess+Bag%2C+T-Shirts%2C+Chess+Software%2C+Chess+Game';
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();
};
