 var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9829730-5']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
  
function searchString() {
	var searchStrng = document.getElementById("text_field");
	$.ajax({
	   type: "GET",
	   url: "search.php",
	   data: "search="+searchStrng.value,
	   cache: false,
	   success: function(msg){
		 alert( "Data Saved: " + msg );
	   }
	 });

}
function showArtistSongs(id) {
	   $.ajax({
		   type: "GET",
		   url: "artist_view.php",
		   data: "id="+id,
		   success: function(html){
			 //alert( "Data Saved: " + html );
			 $('#search_result').html(html);
		   } 
		 });
	}
function likeThis(id) {
	   $.ajax({
		   type: "GET",
		   url: "like_track.php",
		   data: "id="+id,
		   success: function(html){
				$('.like_this').fadeOut('fast');
		   } 
		 });
	}	
function loadHelp() {
		$("#search_result").load("about.php");	
	}	
function playSong(id) {
	//alert(artist+" "+id);
	$("#p").load("p.php", { 'choices[]': ["na", ""+id+""] } );	
}

function playFromList(id,cid) {
	//alert(artist+" "+id);
	//var oldList = $('#play_list').html();
	//var newList = oldList.replace("", "W3Schools")
	//$("."+id).fadeOut('fast');
	//alert(id);
	$("."+cid).fadeOut("slow");
	$("#p").load("p.php", { 'choices[]': ["na", ""+id+""] } );	
}

	$('#song_link').live('click', function() {								
			$('#song_link_url').fadeIn().delay(15000).fadeOut();		
		})
	function addToPlaylist(id) {
		//alert(artist+" "+id);
		//$("#p").load("p.php", { 'choices[]': ["na", ""+id+""] } );	
		//$("#play_list_1").load("playlist.php", { 'choices[]': ["na", ""+id+""] } )
	
		   $.ajax({
			   type: "GET",
			   url: "playlist.php",
			   data: "id="+id,
			   success: function(html){
				 //alert( "Data Saved: " + html );
				 //$('#play_list').html(html);
					var oldList = $('#play_list').html();
					//$('#play_list').html("");
					$("#play_list").append(html);
					$('#play_list_title').html('');
			   } 
			 });
	
	}



	function addAlbumToPlayList(id) {
			   $.ajax({
			   type: "GET",
			   url: "playlist.php",
			   data: "id="+id+"&type=1",
			   success: function(html){
				 //alert( "Data Saved: " + html );
				 //$('#play_list').html(html);
					var oldList = $('#play_list').html();
					//$('#play_list').html("");
					$("#play_list").append(html);
					$('#play_list_title').html('');
			   } 
			 });	
	}

	function close_popup() {
				$('.popup-overlay').fadeOut('fast');
				$('.popup').fadeOut('fast', function() {
					$('.popup-wrap').remove();
				});
		
		}
		$(document).keyup(function(e) {
			if (e.keyCode == 27) {
				$('.popup-overlay').fadeOut('fast');
				$('.popup').fadeOut('fast', function() {
					$('.popup-wrap').remove();
				});
			}
		});
		
		function editTrack(id,song,artist) {
			$("#search_result").load("ajax.php", { 'choices[]': ["edit", ""+id+"", ""+artist+"", ""+song+""] } );	
		}
		
		
