        if(query.query != null) {
            var strQuery = IsValidInput( unescape( query.query ).replace( /[\+]+/g, ' ' ) );
        }

	function doSearch(){
		if( query.type != null && query.query != null ){
			var strQuery = IsValidInput( unescape( query.query ).replace( /[\+]+/g, ' ' ) );
			$T( 'Search ' + query.type + ' : ' + strQuery );
			$FORM( '/search/results.html' ).query.value = strQuery;
			var search_url = "/searchXML";
			switch( query.type.toLowerCase() ){
				case 'artist':
					search_url += '/artist/' + strQuery.strip( 'punctuation' ).escapeHTML().replace( /\+/g, '%20' );
					break;
				case 'album':
					search_url += '/album/' + strQuery.strip( 'punctuation' ).escapeHTML().replace( /\+/g, '%20' );
					break;
				case 'track':
					search_url += '/track/' + strQuery.strip( 'punctuation' ).escapeHTML().replace( /\+/g, '%20' );
					break;
				default:
					alert( 'Search type not specified' );
			}
			var myAjax = new Ajax.Request(
				search_url, {
					method: 'get',
					paramters: '',
					onComplete: showResults
				}
			);
		}
	}
	
	var objResultsInterval = setInterval( function(){
		if( blnPrototypeLoaded != null && blnPrototypeLoaded == true && document.getElementById( 'SearchResultsTable' ) != null ){
			clearTimeout( objResultsInterval );
			doSearch();
		}
	}, 10 );
	
	function showResults( request ){
		objXML = request.responseXML;
		objTable = new Table( 'SearchTable', null, $( 'SearchResultsTable' ), 0 );
		objTable.CountView = 'ResultsCountDisplay';
		var strErrorHTML = '<div class="NoRecordsReturned">';
		//strErrorHTML += '	<div class="ErrorImage"><img src="/images/icons/search/img_zeroresultsnewmusic.gif" alt="" /></div>';
		strErrorHTML += '	<div class="ErrorTextContainer">';
		strErrorHTML += '		<div class="ErrorHeader">The music you are looking for may be added soon.</div>';
		strErrorHTML += '		<div>Napster works every day to get you full access to every track you want. We constantly add music to our catalog along with the new releases every Tuesday.</div>';
		strErrorHTML += '		<div>Want to find out more about Napster\'s efforts to get you all the music you want? <a href="http://www.napster.com/faq/freeservice.html#findPlayBuymusicq16" target="_top">Click Here</a>.</div>';
		strErrorHTML += '	</div>';
		strErrorHTML += '</div>';
		objTable.ZeroRecordsError = strErrorHTML;
		objTable.isPaged = true;
		switch( query.type.toLowerCase() ){
			case 'artist':
				objTable.Headers( 'Artist' );
				objTable.HeaderClass( 'Artist_B' );
				objTable.AjaxFields( 'artist_id', 'artist_name' );
				objTable.RowTemplate( '<a href="/view/artist/index.html?id={0}" class=\"Link\" title="{1}">{1}</a>' );
				objTable.RowClass( 'Artist_B' );
				break;
			case 'album':
				objTable.Headers( 'Play', 'Album', 'Artist', 'PA', 'Share' );
				objTable.HeaderClass( 'Play', 'Album_A', 'Artist_A', 'PA', 'Share' );
				objTable.AjaxFields( 'artist_id', 'artist_name', 'explicit', 'track', 'album_id', 'album', 'streamable' );
				objTable.RowTemplate( 
					'',
					"<a href=\"/view/album/index.html?id={4}\" class=\"Link\" title=\"{5}\"><div>{5}</div></a>",
					"<a href=\"/view/artist/index.html?id={0}\" class=\"Link\" title=\"{1}\"><div>{1}</div></a>",
					'',
					//'<img src="/images/buttons/btn_buyalbum.gif" class="LinkButton" onclick="Buy( \'{4}\', 1 )" alt="" />'
					'<a href="/napsterlinks/?query={4}&amp;type=album" class="share"></a>'
				);
				objTable.RowLogic( '( {6} == 0 )? "<img src=\\\"/images/buttons/btn_30_second.gif\\\" class=\\\"LinkButton\\\" onclick=\\\"Play( {4}, 1 )\\\" alt=\\\"\\\" />" : "<img src=\\\"/images/buttons/btn_play_sml_white_up.gif\\\" class=\\\"LinkButton\\\" onclick=\\\"Play( {4}, 1 )\\\" alt=\\\"\\\" />"', null, null, '( {2} == 0 )? "" : "<a href=\\\"javascript:OpenPopupWindow( \'/info/info_explicit_lyrics.html\', \'ExplicitLyrics\', 240, 300 )\\\" class=\\\"ExplicitLyricsLink\\\">Explicit</div>"', null );
				objTable.RowClass( 'Play', 'Album_A', 'Artist_A', 'PA', 'Share' );
				break;
			case 'track':
			case 'hot_track':
				objTable.ContainsHotTracks = true;
				objTable.Headers( 'Play', 'Track', 'Artist', 'Album', 'PA', 'Share' );
				objTable.HeaderClass( 'Play', 'Track', 'Artist', 'Album', 'PA', 'Share' );
				objTable.AjaxFields(
					'artist_id', /* {0} */
					'artist_name', /* {1} */
					'explicit', /* {2} */
					'track', /* {3} */
					'album_id', /* {4} */
					'album', /* {5} */
					'streamable', /* {6} */
					'lfm_cost', /* {7} */
					'track_id', /* {8} */
					'type', /* {9} */
					'afs', /* {10} */
					'can_purchase' /* {11} */
					
				 );
				objTable.RowTemplate( 
					'',
					'',
					'',
					'',
					'',
					'<a href="/napsterlinks/?query={8}&amp;type=track" class="share"></a>'
				);
				objTable.RowLogic( 
					'( {6} == 0 )? "<a href=\\\"javascript:Play( {8}, 0 )\\\"><img src=\\\"/images/buttons/btn_30_second.gif\\\" alt=\\\"\\\" /></a>" : "<a href=\\\"javascript:Play( {8}, 0 ) \\\"><img src=\\\"/images/buttons/btn_play_sml_white_up.gif\\\" alt=\\\"\\\" /></a>"',
					'( "{9}" == "hot_track" )? "<a href=\\\"javascript:Play( {8}, 0 )\\\" title=\\\"{3}\\\" class=\\\"Hot_Track\\\"><nobr>{3}</nobr></a>" : "<a href=\\\"javascript:Play( {8}, 0 )\\\" title=\\\"{3}\\\" class=\\\"Links\\\"><nobr>{3}</nobr></a>"',
					'( "{9}" == "hot_track" )? "<a href=\\\"/nweb/view/artist/index.html?id={0}\\\" class=\\\"Hot_Track\\\" title=\\\"{1}\\\" target=\\\"_top\\\"><div>{1}</div></a>" : "<a href=\\\"/nweb/view/artist/index.html?id={0}\\\" class=\\\"Link\\\" title=\\\"{1}\\\" target=\\\"_top\\\"><div>{1}</div></a>"',
					'( "{9}" == "hot_track" )? "<a href=\\\"/view/album/index.html?id={4}\\\" class=\\\"Hot_Track\\\" title=\\\"{5}\\\" target=\\\"_top\\\"><div>{5}</div></a>" : "<a href=\\\"/view/album/index.html?id={4}\\\" class=\\\"Link\\\" title=\\\"{5}\\\" target=\\\"_top\\\"><div>{5}</div></a>"',
					'( {2} == 0 )? "" : "<a href=\\\"javascript:OpenPopupWindow( \'/info/info_explicit_lyrics.html\', \'ExplicitLyrics\', 240, 300 )\\\" class=\\\"ExplicitLyricsLink\\\">Explicit</div>"',
					//'( "{10}" == "Y" && {11} == 0 )? "<a href=\\\"/view/album/index.html?id={4}\\\"><img src=\\\"/images/buttons/btn_view_album.gif\\\" alt=\\\"\\\" /></a>" : "<div class=\\\"AdjustTextHeight\\\"><div class=\\\"DownloadButtonRollover\\\"><a href=\\\"javascript:Buy( {8}, 0 )\\\" title=\\\"Download Track\\\"></a></div></div>"'
					null
				);
				objTable.RowClass( 'Play', 'Track', 'Artist', 'Album', 'PA', 'Share' );
				break;
			default:
				$( 'ResultsCountDisplay' ).value = 'Unknown result type';
				return;
		}
		objTable.AjaxObject = objXML.documentElement;
		objTable.MakeTable();
	}
