function cscore_loadurl(series_id)
{
 
	try
	 	{
		// Moz supports XMLHttpRequest. IE uses ActiveX. 
		// browser detction is bad. object detection works for any browser
		cscore_xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
		}
	catch (e)
	 	{
		// browser doesn't support ajax. handle however you want
		}
 
	// the xmlhttp object triggers an event everytime the status changes
	// triggered() function handles the events

	cscore_xmlhttp.onreadystatechange = function() { cscore_triggered(series_id); }

	var score_val = document.getElementById('scoreSeriesID'+series_id);
	var myVal = score_val.value;
	var actualurl = 'includes/change_score.php?series_id='+series_id+'&score='+myVal;
	
	// open takes in the HTTP method and url.
	cscore_xmlhttp.open("GET", actualurl);
	
	
	// send the request. if this is a POST request we would have
	// sent post variables: send("name=aleem&gender=male)
	// Moz is fine with just send(); but
	// IE expects a value here, hence we do send(null);
	cscore_xmlhttp.send(null);
	
	cscore_determineScoreVisibility(series_id);
	score_val.value = '';
	return false;

}

function cscore_triggered(series_id)
{
  // if the readyState code is 4 (Completed)
  // and http status is 200 (OK) we go ahead and get the responseText
  // other readyState codes:
  // 0=Uninitialised 1=Loading 2=Loaded 3=Interactive
  
  if ((cscore_xmlhttp.readyState == 4) && (cscore_xmlhttp.status == 200))
    {
    // cscore_xmlhttp.responseText object contains the response.
    document.getElementById("outputScore"+series_id).innerHTML = cscore_xmlhttp.responseText;
    }
}

function cscore_determineScoreVisibility(layer_id)
{
    
    var myLayer = document.getElementById('scoreLayer'+layer_id);
    var visibleVal = (myLayer.style.display != "none");
    var myText = document.getElementById('scoreText'+layer_id);
    
    
    if (visibleVal)
			{
			//key.innerHTML = "+";
            // hide 
			myLayer.style.display = "none"; 
	 		myText.style.fontWeight = "normal";
			}
		else
			{
			//key.innerHTML = "-";
            //show 
            
			myLayer.style.display = "block";
			myText.style.fontWeight = "bold";
            document.getElementById('scoreSeriesID'+layer_id).focus();
			}
    
}    