/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],''],
	['PAGE','552',jdecode('Comics'),jdecode(''),'/552.html','true',[],''],
	['PAGE','573',jdecode('Magic%3A+the+Gathering'),jdecode(''),'/573.html','true',[],''],
	['PAGE','7801',jdecode('Pokemon'),jdecode(''),'/7801.html','true',[],''],
	['PAGE','26201',jdecode('World+of+Warcraft'),jdecode(''),'/26201.html','true',[],''],
	['PAGE','8101',jdecode('Yu+Gi+Oh%21'),jdecode(''),'/8101.html','true',[],''],
	['PAGE','22206',jdecode('Guestbook'),jdecode(''),'/22206/index.html','true',[ 
		['PAGE','22201',jdecode('Read+Guestbook'),jdecode(''),'/22206/22201.html','false',[],'']
	],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Fantasy';
theSitetree.paletteFamily='906145';
theSitetree.keyvisualId='9904';
theSitetree.keyvisualName='kv4.swf';
theSitetree.fontsetId='17882';
theSitetree.graphicsetId='13064';
theSitetree.contentColor='FED8BF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Fantasy',
				paletteFamily: 	'906145',
				keyvisualId: 	'9904',
				keyvisualName: 	'kv4.swf',
				fontsetId: 		'17882',
				graphicsetId: 	'13064',
				contentColor: 	'FED8BF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20081107-143813'
};
webappMappings['1002']=webappMappings['1002-22206abri10inxxqj']={
webappId:    '1002',
documentId:  '22206',
internalId:  '22206abri10inxxqj',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100210-180329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20100210-180417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100210-180515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26201',
internalId:  '',
customField: '20100210-180556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20090414-160107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22206',
internalId:  '',
customField: '20070125-200034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22201',
internalId:  '',
customField: '20070125-200034'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INXXQJ';
var companyName   = 'CCGs+Cards+Comics+and+Games';
var htmlTitle	  = 'CCGs+Cards+Comics+and+Games+-+Pittsburgh%27s+source+for+Magic+the+Gathering%2C+World+of+Warcraft%2C+Pokemon%2C+Yugioh+and+more';
var metaKeywords  = 'Magic+the+Gathering%3BAnachronism%3BComics%3B+CCGs%3BCollectible+Card+Games%3BWWE++Raw+Deal%3BPokemon%3BYuGiOh%3BDC%3BMarvel%3BGraphic+Novels%3BSettlers+of+Catan%3BCarcassonne%3BFMA%3BFullmetal+Alchemist%3BFull+Metal+Alchemist%3BApples+to+Apples%3BPittsburgh%3BWorld+of+Warcraft%3BAtari%3BColecovision%3BX-Box%3BX-Box+360%3BWii%3BPlaystation%3BPS2%3BPS3%3BNintendo%3BNES%3BSNES%3BSuper+Nintendo%3BN64%3BPS1%3BPSX%3BSega%3BGenesis%3BDS%3BGameboy%3BGamecube%3BJaguar%3B2600%3B5800%3B7600';
var metaContents  = 'Located+in+Pittsburgh%2C+PA%2C+CCGs+Cards+Comics+and+Games+has+been+supplying+the+area+with+supplies+and+play+space+for+the+Magic%3A+the+Gathering%2C+World+of+Warcraft%2C+Pokemon%2C+and+YuGiOh+Collectible+Card+Games.+We+also+sell+new+comic+books%2C+and+Buy%2FSell%2FTrade+used+video+games+and+video+game+systems.';
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();
};
