<!-- 
    var g_controlDown = false;
    function keyDown(e)
    {
        var keynum
        if(window.event) // IE
        {
            keynum = e.keyCode
        }
        else if(e.which) // Netscape/Firefox/Opera
        {
            keynum = e.which
        }
        if (keynum == 17) // CTRL
        {
            g_controlDown = true;
        }
        return (true) ;
    }
    
    function keyUp(e)
    {
        var keynum
        if(window.event) // IE
        {
            keynum = e.keyCode
        }
        else if(e.which) // Netscape/Firefox/Opera
        {
            keynum = e.which
        }
        if (keynum == 17) // CTRL
        {
            g_controlDown = false;
        }
        return (true) ;
    }

    var g_previousObjTitles = Array();
    var g_highlightColours = Array("#FFC6D6", "#FFDD81", "#B5FDAF", "#CEC0F6", "#BDF4F9", "#FF7970");
    var g_numHighlightColours = 6;
    
    function safeGetElementById(id)
    {
        var obj = null;
        if (document.getElementById)
        {
            obj = document.getElementById(id);
        }
        if (obj == null)
        {
			if (document.all)
			{
				obj = document.all[id];
			}
        }
        return obj;
    }
    
    function safeGetElementsByTitle(elemType, objTitle)
    {
        var arr = null;
        if (document.getElementsByName)
        {
            arr = document.getElementsByTagName(elemType);
        }
        
        var arr2 = Array();
        
        for(var i=0;i<arr.length;i++)
        {
            if (arr[i].title)
            {
                if (arr[i].title == objTitle)
                {
                    arr2.push(arr[i]);
                }
            }
        }
        return arr2;
    }
    function safeGetTrElementsByTitle(objTitle)
    {
        return safeGetElementsByTitle("tr", objTitle);
    }

    function safeGetTdElementsByTitle(objTitle)
    {
        return safeGetElementsByTitle("td", objTitle);
    }
    
    function removeitemFromArray(arr, item)
    {
        var i = 0;
        while (i < arr.length)
        {
            if (arr[i] == item)
            {
                arr.splice(i, 1);
            }
            else 
            {
                i++;
            }
        }
        return arr;
    }
    
    function toggleHighlightCells(objTitle)
    {
        return toggleHighlight("td", objTitle);
    }
    
    function toggleHighlightRows(objTitle)
    {
        return toggleHighlight("tr", objTitle);
    }
    
    function toggleHighlight(elemType, objTitle)
    {
		// Disable this for now (don't think it is useful any more)
		return;
		
        // find out whether this title is currently highlighted
        var alreadyHighlighted = false;
        for(var j=0; j < g_previousObjTitles.length; j++)
        {
            if (objTitle == g_previousObjTitles[j])
            {
                alreadyHighlighted = true;
                break;
            }
        }
        // If control is not pressed, then clear the previous highlighting
        if (!g_controlDown && (g_previousObjTitles.length != 0))
        {
            // Remove previous highlighting
            for(var j=0; j < g_previousObjTitles.length; j++)
            {
                var arr = safeGetElementsByTitle(elemType, g_previousObjTitles[j]);
                var arr = safeGetElementsByTitle(elemType, g_previousObjTitles[j]);
                for(var i=0;i<arr.length;i++)
                {
                    arr[i].style.fontWeight = "";
                    arr[i].style.backgroundColor = "";
                }
            }
            
            // Clear the list of highlighted titles
            while (g_previousObjTitles.length != 0) { g_previousObjTitles.pop(); }
        }
        
        // If this title was not already highlighted, then highlight it now.
        if (!alreadyHighlighted)
        {
            // only allow 6 highlights (this is all of the colours that are defined)
            if (g_previousObjTitles.length != g_numHighlightColours)
            {
                var arr = safeGetElementsByTitle(elemType, objTitle);
                for(var i=0;i<arr.length;i++)
                {
                    arr[i].style.fontWeight = "bold";
                    arr[i].style.backgroundColor = g_highlightColours[g_previousObjTitles.length];
                }
                g_previousObjTitles.push ( objTitle );
            }
        }
        else
        {
            // un-highlight this title
            var arr = safeGetElementsByTitle(elemType, objTitle);
            for(var i=0;i<arr.length;i++)
            {
                arr[i].style.fontWeight = "";
                arr[i].style.backgroundColor = "";
            }
            g_previousObjTitles = removeitemFromArray( g_previousObjTitles, objTitle);
        }
    }

    function UpdatePlayerSummaryPlayer(playerId)
    {
		parent.location = setUrlParam(window.location, "id", playerId);
    }
    
    function UpdatePlayerSummarySeason(seasonId)
    {
		parent.location = setUrlParam(window.location, "season", seasonId);
    }
    
    function update()
    {
      var location = window.location;
      
      var selectedLeagueType = document.optionsform.leaguetype.options[document.optionsform.leaguetype.selectedIndex].value;
      var selectedClub = document.optionsform.club.options[document.optionsform.club.selectedIndex].value;
      var selectedDivision = document.optionsform.division.options[document.optionsform.division.selectedIndex].value;
      var selectedSuffix = document.optionsform.suffix.options[document.optionsform.suffix.selectedIndex].value;
      var playerFilter = "";
      if (document.optionsform.player)
      {
        playerFilter = document.optionsform.player.value;
      }

      if (selectedLeagueType != "")
      {
        location = setUrlParam(location, "league_type", selectedLeagueType);
      }
      else
      {
        location = removeUrlParam(location, "league_type");
      }
      
      if (selectedClub != "")
      {
        location = setUrlParam(location, "club", selectedClub);
      }
      else
      {
        location = removeUrlParam(location, "club");
      }
      
      if (selectedDivision != "")
      {
        location = setUrlParam(location, "division", selectedDivision);
      }
      else
      {
        location = removeUrlParam(location, "division");
      }
      
      if (selectedSuffix != "")
      {
        location = setUrlParam(location, "suffix", selectedSuffix);
      }
      else
      {
        location = removeUrlParam(location, "suffix");
      }
      
      if (playerFilter != "")
      {
        location = setUrlParam(location, "player", playerFilter);
      }
      else
      {
        location = removeUrlParam(location, "player");
      }

      parent.location = location;
    }
    
    function updateBestPairs()
    {
      var location = window.location;
      
      var matchesMinimum = document.optionsform.matchesMinimum.options[document.optionsform.matchesMinimum.selectedIndex].value;
      var matchesPercent = document.optionsform.matchesPercent.options[document.optionsform.matchesPercent.selectedIndex].value;
      var rubbersPercent = document.optionsform.rubbersPercent.options[document.optionsform.rubbersPercent.selectedIndex].value;

      if (matchesMinimum != "")
      {
        location = setUrlParam(location, "matches_minimum", matchesMinimum);
      }
      else
      {
        location = removeUrlParam(location, "matches_minimum");
      }
      
      if (matchesPercent != "")
      {
        location = setUrlParam(location, "matches_percent", matchesPercent);
      }
      else
      {
        location = removeUrlParam(location, "matches_percent");
      }
      
      if (rubbersPercent != "")
      {
        location = setUrlParam(location, "rubbers_percent", rubbersPercent);
      }
      else
      {
        location = removeUrlParam(location, "rubbers_percent");
      }
      
      parent.location = location;
    }
    
    function showmonth(index)
    {
        var obj = safeGetElementById("plusmonth_" + index);
        obj.style.display = "none";

        var obj = safeGetElementById("minusmonth_" + index);
        obj.style.display = "inline";
        
        var obj = safeGetElementById("month_" + index);
        obj.style.display = "";
    }

    function hidemonth(index)
    {
        var obj = safeGetElementById("minusmonth_" + index);
        obj.style.display = "none";
        
        var obj = safeGetElementById("plusmonth_" + index);
        obj.style.display = "inline";

        var obj = safeGetElementById("month_" + index);
        obj.style.display = "none";
    }

    function show(index)
    {
        var obj = safeGetElementById("plus_" + index);
        obj.style.display = "none";

        obj = safeGetElementById("minus_" + index);
        obj.style.display = "inline";

        obj = safeGetElementById("details_" + index);
        obj.className = "results_detail_open";
    }

    function hide(index)
    {
        obj = safeGetElementById("minus_" + index);
        obj.style.display = "none";

        var obj = safeGetElementById("plus_" + index);
        obj.style.display = "inline";

        obj = safeGetElementById("details_" + index);
        obj.className = "results_detail_closed";
    }

    function setShowFilter(visible)
    {
        window.location = setUrlParam(window.location, "set_show_filter", visible);
    }
    
    function change_season(id, name)
    {
		parent.location = setUrlParam(window.location, "selected_season", id);
    }
    
    function setUrlParam(url, name, value)
    {
        var newUrl = "" + url;
        
        // Does the URL have parameters?
        var questionMark = newUrl.indexOf("?");
        if (questionMark == -1)
        {
            // no existing parameters
            newUrl = newUrl + "?" + name + "=" + escape(value);
        }
        else
        {
            // URL has existing parameters
            var paramString = newUrl.substring(questionMark + 1);
            
            // Check for an existing named param in the URL
            var existingParam = paramString.indexOf(name)
            if (-1 == existingParam)
            {
                // Add a new entry for the param
                if (newUrl.charAt(newUrl.length - 1) != "&")
                {
                    newUrl = newUrl + "&";
                }
                newUrl = newUrl + name + "=" + escape(value);
            }
            else
            {
                // Replace the existing param
                var params = paramString.split("&");
                var newParams = "";
                for (i in params)
                {
                    var param = params[i];
                    if (param != "")
                    {
                        if (-1 != param.indexOf(name + "="))
                        {
                            newParams = newParams + name + "=" + escape(value) + "&";
                        }
                        else
                        {
                            newParams = newParams + param + "&";
                        }
                    }
                }
                
                newUrl = newUrl.substring(0, questionMark + 1) + newParams;
            }
        }
        
        return newUrl;
    }

    function removeUrlParam(url, name)
    {
        var newUrl = "" + url;
        
        // Does the URL have parameters?
        var questionMark = newUrl.indexOf("?");
        if (questionMark == -1)
        {
            // no existing parameters
        }
        else
        {
            // URL has existing parameters
            var paramString = newUrl.substring(questionMark + 1);
            
            // Check for an existing named param in the URL
            var existingParam = paramString.indexOf(name)
            if (-1 == existingParam)
            {
                // Param not found
            }
            else
            {
                // Remove the existing param
                var params = paramString.split("&");
                var newParams = "";
                for (i in params)
                {
                    var param = params[i];
                    if (param != "")
                    {
                        if (-1 == param.indexOf(name + "="))
                        {
                            newParams = newParams + param + "&";
                        }
                    }
                }
                
                newUrl = newUrl.substring(0, questionMark + 1) + newParams;
            }
        }
        
        return newUrl;
    }

    function sort(key, order)
    {
        var newLocation = setUrlParam(window.location, "sort_key", key);
        parent.location = setUrlParam(newLocation, "sort_order", order);
    }

    var visiblePostScan = null;
    function showPostScan(id)
    {
        if (visiblePostScan != null)
        {
               visiblePostScan.style.display = "none";
        }
	
        var scan = safeGetElementById(id);
        scan.style.display = "block";

        visiblePostScan = scan;
    }
	
	function enableElement(id)
    {
        obj = safeGetElementById(id);
		if (obj)
		{
			obj.disabled = false;
		}
    }

	function disableElement(id)
    {
        obj = safeGetElementById(id);
		if (obj)
		{
			obj.disabled = true;
		}
    }

	function hideElement(id)
    {
        obj = safeGetElementById(id);
		if (obj)
		{
			obj.style.display = "none";
		}
    }

	function showElementInline(id)
    {
        obj = safeGetElementById(id);
		if (obj)
		{
			obj.style.display = "inline";
		}
    }

	function showElementBlock(id)
    {
        obj = safeGetElementById(id);
		if (obj)
		{
			obj.style.display = "block";
		}
    }

	function isIE()
	{
		var detect = navigator.userAgent.toLowerCase();
		if ( !(navigator && navigator.userAgent && navigator.userAgent.toLowerCase) )
		{
			return false;
		}
		else
		{
			if  (detect.indexOf('msie') + 1)
			{
				// browser is internet explorer
				return true;
			} 
			else 
			{
				return false;
			}
		}
	} 

	function bringContentFrameToFront()
	{
		//window.focus();
	}

	function switchDetailedTables(tabName)
	{
		window.location = setUrlParam(window.location, "view", tabName);
	}

	function addClass(existingClass, newClass)
	{
		existingClass = removeClass(existingClass, newClass);
		return existingClass + " " + newClass;
	}
	
	function removeClass(existingClass, classToRemove)
	{
		// Remove the existing param
		var classParts = existingClass.split(" ");
		var newClass = "";
		for (i in classParts)
		{
			var classPart = classParts[i];
			if (classPart != classToRemove)
			{
				newClass = newClass + classPart + " ";
			}
		}
		
		return newClass;
	}
	
	function highlightrow(id)
	{
        var obj = safeGetElementById(id);
        obj.className = addClass(obj.className, "highlight");
	}

	function unhighlightrow(id)
	{
        var obj = safeGetElementById(id);
        obj.className = removeClass(obj.className, "highlight");
	}

// -->
