﻿// DG
// These are old functions that are still being used to 
// compose the Content Category lists used by HBX.

/*BEGIN EDITABLE SECTION
FUNCTIONS AND MODS BY TT 9-10-2004*/
function getQueryVariable(variable) {
  var query = window.location.search;
  var pieces = query.split("&");
  var value = "";
  for(var i = 0; i < pieces.length; i++)
  {
    var components = pieces[i].split("=");
    if(components.length == 2)
    {
      if(components[0] == variable) { value = components[1]; break; }
    }
  }
  return value;
}

// the dataset object prototype
function HBXdataset (url,arry) {
	this.url = "";
	this.category = "";
	this.acct = "";
	for (var i=0;i<arry.length;i++) {
		if (arry[i][3]==true) {
			if (url == arry[i][0].toString()) { //needs exact string match
				this.url = url;
				this.category = arry[i][1].toString();
				this.acct = arry[i][2].toString();
				if (this.category == "boards") { this.acct += HBXBoardsAcctAdd(this.url) }
				//alert("EXACT:" + this.category);
				return;
			}
		}
		else {	
  				if (url.indexOf(arry[i][0].toString()) != -1 ) { //needs to find the substring present
						//this = makeProperties(i,url,arry,this);
						this.url = url;
						//alert("SUBSTRING:" + this.url);
						this.category = arry[i][1].toString();
						//alert("SUBSTRING:" + this.category);
						this.acct = arry[i][2].toString();
						//alert("SUBSTRING:" + this.acct);
						if (this.category == "boards") { this.acct += HBXBoardsAcctAdd(this.url) }
						return;
				}
		}
	}
}

function HBXBoardsAcctAdd(url) {
	//alert ("board acct");
	// This appends a boards subgroup account based on forum number
	var sAcct = "";
	var sForumId = url.substring(url.lastIndexOf("=") +1, url.length);
	var aForumNums = new Array(	new Array (";DM540625AJBD",16,17,18,19,20,22,25,26,30,36,39,42,44,46,48,92,96,98,99,20,126,127,295,384,386,432,434,480,520,526),
								new Array (";DM5406256MRE",217,218,219,221,225,227,229,239,241,524),
								new Array (";DM540922NNAE",144,147,153,154,155,156,157,158,160,161,163,170,171,172,173,174,175,176,177,180,249,409,430,450,456,481,496,497,498),
								new Array (";DM540625LLEA",476,477,478,485,486,487,488,489,492),
								new Array (";DM540625OAEN",503,504,505,506),
								new Array (";DM5406252IVA",56,60,452,453,454,455,490)
								);
	for (var i=0;i<aForumNums.length;i++) {
		for (var j=1;j<aForumNums[i].length;j++) {
			if (sForumId == aForumNums[i][j].toString()) { 
				//alert ("MATCH"); 
				sAcct = aForumNums[i][0];
			} 			
		}
	}	
	return sAcct;	
}
// End Functions

// DG
// Below are definitions for variables used in HBX declarations, that are not page-specific 
// (or at least, which do not require access to page-loaded variables).

//SOME STRINGS BY TT 9-10-2004
var sHBXWinLoc= window.location.href.toLowerCase();
_acct = "DM560323DJEC";
