define(['jquery',
        'underscore',
         'backbone'
  ],

  function( $, _, Backbone) {

    var Track = Backbone.Model.extend({

      search: function(params, success, error) {

        var name =  encodeURIComponent(params.query);
        this.fetch({
          url: 'http://ws.audioscrobbler.com/2.0/?method=' + params.service +'.gettoptracks&' + params.service + '=' +  name + '&api_key=0613f2c34cedeff7f3f81e3672f4237e&limit=32&autocorrect=1&format=json',
          type: 'get',
          dataType: 'jsonp',
          success: function(model, response) {
            var results = response.toptracks || [],
              track = results.track,
              instances = [],
              error = response.message;
            if(results && track) {
              for(var i=0;i<track.length;i++) {
                var r = results.track[i];
                instances.push( new Track(r) );
              }
            }else if(error){
              alert(error);
            }
            success(instances);
          },
          error: function() {
            error(arguments);
          }
        });
      },
      
      youtube: function(params, success, error) {

      }
    });

    return Track;
  });

@@ -609,21 +609,41 @@
 racks %7C%7C
+ response.track %7C%7C
  %5B%5D,%0A
+  
         
@@ -677,32 +677,34 @@
 ,%0A              
+  
 instances = %5B%5D,%0A
@@ -705,48 +705,8 @@
 = %5B%5D
-,%0A              error = response.message
 ;%0A  
@@ -734,16 +734,23 @@
 && track
+.length
 ) %7B%0A    
@@ -835,16 +835,69 @@
 ack%5Bi%5D;%0A
+                // better is use backbone collection%0A
         
@@ -956,66 +956,8 @@
   %7D%0A
-            %7Delse if(error)%7B%0A              alert(error);%0A 
     
@@ -957,32 +957,32 @@
  %7D%0A           %7D%0A
+
             succ
@@ -1074,32 +1074,32 @@
 s);%0A          %7D%0A
+
         %7D);%0A    
@@ -1098,75 +1098,8 @@
 %7D);%0A
-      %7D,%0A      %0A      youtube: function(params, success, error) %7B%0A%0A
     

fix tag search