/*function ajaxRequest(elementID, url )
{
	var params = new Array();
	var i;
	for( i=2; i < arguments.length; i++)
		params.push(arguments[i]);
	params.push("id=" + elementID);

	//$(elementID).innerHTML = "<div class='loading'>Loading...</div>";
	ajaxEngine.registerRequest(url, url);
	ajaxEngine.registerAjaxElement(elementID);
	var options = {
		parameters: ajaxEngine._createQueryString(params,0),
		evalScripts: true,
		asynchronous: true,
		onComplete: function(request) {
			request.responseText.evalScripts();
		}
	};
	ajaxEngine.sendRequest(url, options);
}*/

function getSearchResults(page)
{
	if (!page) page = 1;
	new Ajax.Updater(
	   'resultsDiv',
	   '/ajax/get_search_results.html?page=' + page
	);
}

function addToPlaylist(url, action)
{
	if (!action) action = 0;
	if (url)
		new Ajax.Updater('add_to_playlist', '/ajax/add_to_playlist.html?url=' + url + (action == 1 ? '&action=add' : ''));
	return true;
}

function addToFavorites(url, action)
{
	if (!action) action = 0;
	if (url)
		new Ajax.Updater('add_to_favorites', '/ajax/add_to_favorites.html?url=' + url + (action == 1 ? '&action=add' : ''));
	return true;
}

function copyClipboard(id)
{
	var	t = $(id);
	var code = t.value;

	if (code.length > 0)
	{
		try
		{
			window.clipboardData.setData("Text", code);
			alert("Your Code has been copied to the ClipBoard! \n\n Simply PASTE (Ctrl+V) this into your html document.");
		}
		catch(err)
		{
			t.focus();
			t.select();
			alert("Use Right Mouse Button & Select COPY!");
		}
	}else
		alert("You do not have anything to Copy!");
}

function startSearch(key)
{
	new Ajax.Updater('statusDiv', '/ajax/search.html?q=' + key);
}

function stopSearch()
{
	new Ajax.Updater('statusDiv', '/ajax/stop_search.html');
}

function getRecentSearches()
{
	new Ajax.Updater('resultsDiv', '/ajax/get_recent_searches.html');
}

function getRecentPlayed()
{
    new Ajax.Updater('resultsDiv', '/ajax/get_recent_played.html');
}