	// utils.js
	
	// default value is false, because it's for scoreboard. Viecast page will override it
	isViewcast = false;
	/////////////////////////////////
	// MAP
	/////////////////////////////////
	METADATA = true;
	DEBUG = false;
	INTERVAL = 10000;
	VIEWCAST_PATH = null;
	
	VIEWCAST_ACTIVE = true;
	
	// keep cookie for ~8-1/2 months of season.
	COOKIE_LIFE = 1000 * 60 * 60 * 24 * 250;
	
	MASTER_ARRAY_LENGTH = 13;
	
	TIMESTAMP = 0;
	SETINTERVAL = 1;
	DATA_INDEX = 1;
	
	FEED_ROW_DELIMITER = "\n";
	TOP_LEVEL_DELIMITER = "|";
	SECOND_LEVEL_DELIMITER = ";";
	THIRD_LEVEL_DELIMITER = "#";
	
	IMG_SERVER = "http://i.cdn.turner.com/si";
	IMG_PATH = "/.e1d/img/3.0/sect/football/nfl";
	LOGO_PATH = "/.e1d/img/3.0/sect/basketball/nba/logos/";
	
	GAMES_IN_ROW = 2;
	CONTEST_ID = 0;
	STATSINC_CONTEST_ID = 1;
	SEASON_YEAR = 2;
	STAGE_ID = 3;
	SUBSTAGE_ID = 4;
	STATUS = 5;
	DATE_URL = 6;
	DATE_STR = 7;
	GAMESTATE = 8;
	VENUE = 9;
	LINKS = 10;
	HOME_TEAM = 11;
	VSTR_TEAM = 12;
	
	GAME_ORDER = 0;
	CLOCK = 1;
	PERIOD = 2;
	ACTIVE = 3;
	
	STADIUM = 0;
	CITY = 1;
	STATE = 2;
	
	PREVIEW = 0;
	BOXSCORE = 1;
	//PLAYBYPLAY = 2;
	RECAP = 2;
	GAMEBLOG = 3;
	TICKETCITY = 4;
	
	TEAM_ID = 0;
	VENDOR_ID = 1;
	TEAM_NAME = 2;
	TEAM_NICKNAME = 3;
	TEAM_ABRV = 4;
	TEAM_URL = 5;
	TOTAL_SCORE = 6;
	WINS = 7;
	LOSSES = 8;
	PTSLDR = 9;
	RBNDLDR = 10;
	ASSTLDR = 11;
	// college valuables
	DIV = 12;
	CONF = 13;
	RANK = 14;
	TV1 = 15;
	
	LDR_ID = 0;
	LDR_NM = 1;
	LDR_LINK = 2;
	LDR_POS = 3;
	LDR_STAT = 4;
	
	/*    Debug Log Class
	 *         Started with the example at this URL:  http://ajaxcookbook.org/javascript-debug-log/
	 *         But this example needed many enhancements to get it to work properly.  I ended 
	 *         up encapsulating the log in its own class.
	*/
	function logClass() {
	
	    this.logWindow = null;
	    
	    this.create = function()
	    {
	        if (DEBUG)
	        {
	            this.logWindow = window.open("", null, "width=400,height=400," +
	                                      "scrollbars=yes,resizable=yes,status=no," +
	                                      "location=no,menubar=no,toolbar=no");
	            if (!this.logWindow)
	                return;
	            
	            this.logWindow.document.write("<html><head><title>Debug Log</title></head><body></body></html>");
	            this.logWindow.document.close();
	        }
	        else
	            return;
	    }
	    
	    this.write = function(text) {
	        
	        var newDiv;
	        var newTextLine;
	    
	        if (DEBUG)
	        {
	            if (this.logWindow != null && !this.logWindow.closed)
	            {
	                newDiv = this.logWindow.document.createElement("div");
	                newTextLine = this.logWindow.document.createTextNode(text);
	                newDiv.appendChild(newTextLine);
	            
	                this.logWindow.document.body.appendChild(newDiv);
	            }
	        }
	        else
	            return;
	    }      
	}
	
	
	function trimString(str) {
	
	    if (str != null && str.length > 0) {
	        str = str.replace( /^\s+/g, "" );            // strip leading
	        return str.replace( /\s+$/g, "" );            // strip trailing
	    }
	    
	    return new String("");
	}
	
	
	function isNumber(strData)
	{
	    var dataAsNumber;
	    
	    if (strData.length == 0)
	        return false;
	    
	    // fastest way to convert to a number type
	    dataAsNumber = (+strData);
	
	    if ((isNaN(dataAsNumber) == false) && dataAsNumber >= 0 ) {
	        return true;
	    }
	    return false;
	}
	
	function createImageElement(src,height,width,border,alt,alignment,myClass)
	{
	    var iElem = document.createElement("img");
	    iElem.setAttribute("src", src);
	    iElem.setAttribute("height", height);
	    iElem.setAttribute("witdh", width);
	    iElem.setAttribute("border", border);
	    if (alignment != null && ! alignment == "")
	        iElem.setAttribute("align", alignment);
	    iElem.alt = alt;
	    if (myClass != null && ! myClass == "")
	        iElem.className = myClass;
	    
	    return iElem;
	}
	
	function setMyAttribute(myName, myValue)
	{
	    var tempA = document.createAttribute(myName);
	    tempA.value = myValue;
	    return tempA;
	}
	
	function createTeamRecord(wins,losses,ties,isInParenthesis)
	{
	    var record = "";
	    
	    if (wins != "" && losses != "" &&
	        (parseInt(wins) > 0 || parseInt(losses) > 0))
	    {
	        record = record + wins + "-" + losses;
	        if (parseInt(ties) > 0)
	            record = record + "-" + ties;
	
	        if (isInParenthesis)
	            record = "(" + record + ")";
	    }
	    return record;
	}
	function createLinkElement(linkWhat, linkWhere, target, isImage, className)
	{
	    var linkElem = null;
	
	    ////log.write("Got link request: " + linkWhat + "..." + linkWhere + "..." + target + "..." + isImage);
	    
	    if (linkWhere == null || linkWhere == "")
	    {
	       if (isImage)
		return linkWhat;
	       else
	        return document.createTextNode(linkWhat);
	    }
	    else
	    {
	        linkElem = document.createElement("a");
	        linkElem.href = linkWhere;
	        if (target != null && !target == "")
	            linkElem.target = target;
	        if (isImage)
	            linkElem.appendChild(linkWhat);
	        else
	            linkElem.appendChild(document.createTextNode(linkWhat));
	
	        if (className != null)
	            linkElem.className = className;
	            
	        return linkElem;
	    }
	}


