function SPListenNow()
{
	this.request = BASE_URL + 'indexajax.php?action=SPListenNow';
}

SPListenNow.prototype.add = function(streamID)
{
    var	ajaxResponseResult;
	var ajaxResponseErrors;
	
	$.ajax({
		type: "get",
		url:  this.request + '&start=add&spc_stream_id=' + streamID,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
			$("response > result", xml).each (
				function()
				{
					ajaxResponseResult = ($(this).text());
				}
			);
	
			$("response > error", xml).each (
				function()
				{
					ajaxResponseErrors = ($(this).text());
				}
			);
		}
	});
}


SPListenNow.prototype.list = function(elementID, page, onPage, streamID)
{
    var	ajaxResponseResult;
	var ajaxResponseErrors;
	
	loadAjaxStart();
	
	$.ajax({
		type: "get",
		url:  this.request + '&start=find',
		dataType: "xml",
		data: {
			'streamID' : streamID,
			'onPage' : onPage,
			'page': page,
			'elementID' : elementID
		},
		global: false,
		success: function(xml)
		{
			$("response > html", xml).each (
				function()
				{
					$('#' + elementID).html($(this).text());
				}
			);
			
			$("response > counter", xml).each (
				function()
				{
					if($(this).text() > 0)
						$('#sp-listenow-box').show();
				}
			);
			
		},
		complete: function()
		{
			loadAjaxStop();
		}
	});
}

SPListenNow.prototype.listClub = function(elementID, page, onPage, streamID)
{
    var	ajaxResponseResult;
	var ajaxResponseErrors;
	
	loadAjaxStart();
	
	$.ajax({
		type: "get",
		url:  this.request + '&start=findClub',
		dataType: "xml",
		data: {
			'streamID' : streamID,
			'onPage' : onPage,
			'page': page,
			'elementID' : elementID
		},
		global: false,
		success: function(xml)
		{
			$("response > html", xml).each (
				function()
				{
					$('#' + elementID).html($(this).text());
				}
			);
		},
		complete: function()
		{
			loadAjaxStop();
		}
	});
}


