(function() { // Entire function

  jQuery(function() { // Jquery
    
    // Keys, global vars, and such
    var consumer_key = "c2b70728ea7c9bacb39e78b5cfa79acf",
     		page_title = document.title;
    
    // Check for mobile
    var mobile = (/iPad|ipad|iPhone|iphone|mobile|pre\//i).test(navigator.userAgent);
    
    // Sizing & Layout
    $(window).resize(function(){
      
      var $intro = $('.intro'),
          $contain = $('.container');

      $intro.css({
        width: $(window).height() / 0.64296875,
        height: $(window).height(),
        maxWidth: $(window).width()
      });
      $contain.css({
        top: ($(window).height() - $contain.height()) / 2,
        left: ($(window).width() - $contain.width()) / 2
      });
      
      $('ul.contacts').css({
        left: ($('div.contacts').width() - $('ul.contacts').outerWidth()) / 4.20,
        top: ($('div.contacts').height() - $('ul.contacts').outerHeight()) / 2
      });
      
    });
    $(window).resize();
    
    // YouTube iFrame API
    var tag = document.createElement('script');
          tag.src = "http://www.youtube.com/player_api";
          var firstScriptTag = document.getElementsByTagName('script')[0];
          firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    
    // ### SoundCloud and Sound Stuff
    SC.initialize({
      client_id: consumer_key
    });
    SC.whenStreamingReady(function(){
      
      var getTracksCount = 0;
      function getTracks(){
          getTracksCount += 1;
          if(getTracksCount < 2){

            $('<div class="time"><div class="buffer"></div><div class="played"></div></div>').appendTo('body');
            $('.time').fadeIn('slow');

            // Get Gorilla Manor
            SC.get('/playlists/444344', function(playlist){

              $("<div class='"+playlist.permalink+" set'><div class='info'><img /></div><ul class='"+playlist.permalink+" tracks'><li>Loading...</li></ul></div><br /><hr class='clear' />").appendTo('div.music');

              $("."+playlist.permalink+" .info img").attr('src', playlist.artwork_url.replace('-large', '-crop'));
            
              if(playlist.title){
                $("<p><a href='"+playlist.permalink_url+"' target='_blank'>"+playlist.title+"</a></p>").appendTo("."+playlist.permalink+" .info");
              }
              if(playlist.release_year){
                $("<p>Release "+playlist.release_year+"</p>").appendTo("."+playlist.permalink+" .info");
              }
              if(playlist.purchase_url && playlist.type){
                $("<p><a href='"+playlist.purchase_url+"' target='_blank'>buy "+playlist.type+"</a></p>").appendTo("."+playlist.permalink+" .info");
              }
            
              $('.set ul').empty();

              $.each(playlist.tracks, function(index, track){

                $li = $('<li class="track_'+track.id+'">'+(index+1)+'. '+track.title+'</li>').data('track', track).data('track', track).appendTo("."+playlist.permalink+" ul");
              
                url = track.stream_url;

        				(url.indexOf("secret_token") == -1) ? url = url + '?' : url = url + '&';

        				url = url + 'consumer_key=' + consumer_key;
        				
        				var $this = $('.track_'+track.id);
      				
                // var sound = SC.stream(track.id);
                var s = soundManager.createSound({

        					// ### Sound Defaults		

        					// * Auto load the first track
        					// * Add an id in the format *track_123456*
        					// * Set multiShot to false to make sure track can't play more than once simultaneously 
        					// * Add the SoundCloud stream url created above

        					autoLoad: (index == 0),
        					id: track.id,
        					multiShot: false,
        					url: url,
        					volume: 100,
        					onplay: function(){
                    $this.addClass('active');
        					},
        					onfinish: function(){
                    document.title = page_title;
                    nextTrack();
                    $this.removeClass('playing');
                    $this.removeClass('active');
                  },
                  whileloading: function(){
  									percent = this.bytesLoaded / this.bytesTotal * 100;
  									$('.buffer').css({width: percent+'%'});
  								},
  								whileplaying: function() {
  									percent = this.position / track.duration * 100;
  									load = this.bytesLoaded / this.bytesTotal * 100;
  									$('.played').css({width: percent+'%'});
  									if(load == 100){
  										$('.buffer').css('width', '100%');
  									}
  								}
  							});
      					
                $(document).on('click', 'li.track_'+track.id, function(){
                  $('.tracks li').not(this).removeClass('playing');
                  soundManager.stopAll();
                  var $this = $(this);
                  if($(this).hasClass('playing')){
                    soundManager.pause(track.id);
                    document.title = page_title;
                  } else {
                    soundManager.play(track.id);
                    document.title = '\u25B6 ' + track.title;
                  }
                   $(this).toggleClass('playing');
                });
        
              }); // End $.each()
            
              // Get Wide Eyes Single
              SC.get('/playlists/1421813', function(playlist){

                $("<div class='"+playlist.permalink+" set'><div class='info'><img /></div><ul class='"+playlist.permalink+" tracks'></ul></div><br /><hr class='clear' />").appendTo('div.music');

                $("."+playlist.permalink+" .info img").attr('src', playlist.artwork_url.replace('-large', '-crop'));

                if(playlist.title){
                  $("<p><a href='"+playlist.permalink_url+"' target='_blank'>"+playlist.title+"</a></p>").appendTo("."+playlist.permalink+" .info");
                }
                if(playlist.release_year){
                  $("<p>Release "+playlist.release_year+"</p>").appendTo("."+playlist.permalink+" .info");
                }
                if(playlist.purchase_url && playlist.type){
                  $("<p><a href='"+playlist.purchase_url+"' target='_blank'>buy "+playlist.type+"</a></p>").appendTo("."+playlist.permalink+" .info");
                }

                $.each(playlist.tracks, function(index, track){

                  $li = $('<li class="track_'+track.id+'">'+(index+1)+'. '+track.title+'</li>').data('track', track).data('track', track).appendTo("."+playlist.permalink+" ul");

                }); // End $.each()
              
                // Get World News Single
                SC.get('/playlists/1421840', function(playlist){

                  $("<div class='"+playlist.permalink+" set'><div class='info'><img /></div><ul class='"+playlist.permalink+" tracks'></ul></div><br /><hr class='clear' />").appendTo('div.music');

                  $("."+playlist.permalink+" .info img").attr('src', playlist.artwork_url.replace('-large', '-crop'));

                  if(playlist.title){
                    $("<p><a href='"+playlist.permalink_url+"' target='_blank'>"+playlist.title+"</a></p>").appendTo("."+playlist.permalink+" .info");
                  }
                  if(playlist.release_year){
                    $("<p>Release "+playlist.release_year+"</p>").appendTo("."+playlist.permalink+" .info");
                  }
                  if(playlist.purchase_url && playlist.type){
                    $("<p><a href='"+playlist.purchase_url+"' target='_blank'>buy "+playlist.type+"</a></p>").appendTo("."+playlist.permalink+" .info");
                  }

                  $.each(playlist.tracks, function(index, track){

                    $li = $('<li class="track_'+track.id+'">'+(index+1)+'. '+track.title+'</li>').data('track', track).data('track', track).appendTo("."+playlist.permalink+" ul");

                  }); // End $.each()
                
                  // Get Sun Hands Single
                  SC.get('/playlists/1421857', function(playlist){

                    $("<div class='"+playlist.permalink+" set'><div class='info'><img /></div><ul class='"+playlist.permalink+" tracks'></ul></div><br /><hr class='clear' />").appendTo('div.music');

                    $("."+playlist.permalink+" .info img").attr('src', playlist.artwork_url.replace('-large', '-crop'));

                    if(playlist.title){
                      $("<p><a href='"+playlist.permalink_url+"' target='_blank'>"+playlist.title+"</a></p>").appendTo("."+playlist.permalink+" .info");
                    }
                    if(playlist.release_year){
                      $("<p>Release "+playlist.release_year+"</p>").appendTo("."+playlist.permalink+" .info");
                    }
                    if(playlist.purchase_url && playlist.type){
                      $("<p><a href='"+playlist.purchase_url+"' target='_blank'>buy "+playlist.type+"</a></p>").appendTo("."+playlist.permalink+" .info");
                    }

                    $.each(playlist.tracks, function(index, track){

                      $li = $('<li class="track_'+track.id+'">'+(index+1)+'. '+track.title+'</li>').data('track', track).data('track', track).appendTo("."+playlist.permalink+" ul");

                    }); // End $.each()
                  
                    // Get Airplanes Single
                    SC.get('/playlists/1421872', function(playlist){

                      $("<div class='"+playlist.permalink+" set'><div class='info'><img /></div><ul class='"+playlist.permalink+" tracks'></ul></div><br /><hr class='clear' />").appendTo('div.music');

                      $("."+playlist.permalink+" .info img").attr('src', playlist.artwork_url.replace('-large', '-crop'));

                      if(playlist.title){
                        $("<p><a href='"+playlist.permalink_url+"' target='_blank'>"+playlist.title+"</a></p>").appendTo("."+playlist.permalink+" .info");
                      }
                      if(playlist.release_year){
                        $("<p>Release "+playlist.release_year+"</p>").appendTo("."+playlist.permalink+" .info");
                      }
                      if(playlist.purchase_url && playlist.type){
                        $("<p><a href='"+playlist.purchase_url+"' target='_blank'>buy "+playlist.type+"</a></p>").appendTo("."+playlist.permalink+" .info");
                      }

                      $.each(playlist.tracks, function(index, track){

                        $li = $('<li class="track_'+track.id+'">'+(index+1)+'. '+track.title+'</li>').data('track', track).data('track', track).appendTo("."+playlist.permalink+" ul");

                      }); // End $.each()

                      $('.content div.music').bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
                        if(scrollPositionY != 0){
                          $('.jspDrag').addClass('active');
                          setTimeout(function() {
                            $('.jspDrag').removeClass('active');
                          }, 1050);
                        } else if(isAtTop){
                          $('.jspDrag').removeClass('active');
                          setTimeout(function() {
                            $('.jspDrag').removeClass('active');
                          }, 1050);
                        } else {
                          setTimeout(function() {
                            $('.jspDrag').removeClass('active');
                          }, 1050);
                        }
                      }).jScrollPane({
                        autoReinitialise: true
                      });

                    }); // End SC.get()

                  }); // End SC.get()

                }); // End SC.get()

              }); // End SC.get()

            }); // End SC.get()
          
          } // End if >0
      
      } // End getTracks()
      
      // ### Get Contacts from SoundCloud
      var getContactsCount = 0;
      function getContacts(){
        getContactsCount += 1;
        if(getContactsCount < 2){
          $('<ul class="contacts"><li>Loading...</li></ul>').appendTo('div.contacts');
          $.getJSON('https://api.soundcloud.com/users/1536870.json?consumer_key='+consumer_key+'&callback=?', function(data){

            $('ul.contacts').empty();

            $('<li>'+data.description+'</li>').appendTo('ul.contacts');
            
            $(window).resize();

          }); // End getJSON // SC Contact Links

        }
      }
    
      // ### Get Photos from Tumblr
      var getPhotosCount = 0;
      function getPhotos(){
        getPhotosCount += 1;
        if(getPhotosCount < 2){
          $("<ul class='photos'><li>Loading...</li></ul>").appendTo('div.photos');
          $.getJSON('http://outtasighttumblr.tumblr.com/api/read/json?num=10&type=photo&callback=?', function(data){

        		$('ul.photos').empty();

        		posts = data.posts;

        		$.each(posts, function(index, post){

        			var url100 = post["photo-url-100"],
        					url500 = post["photo-url-500"],
        					caption = post["photo-caption"];

        			var $li = $('<li><a href="'+post.url+'" target="_blank"><img src="'+url500+'"></a><br>'+caption+'</li>').appendTo('ul.photos');

        		}); // End .each(Tumblr Photos)
      		
        		$('.content div.photos').bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
              if(scrollPositionY != 0){
                $('.jspDrag').addClass('active');
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              } else if(isAtTop){
                $('.jspDrag').removeClass('active');
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              } else {
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              }
            }).jScrollPane({
              autoReinitialise: true
            });

        	}); // End getJSON // Tumblr
        }
      }
    
      // ### Get Text Blog from Tumblr
      var getBlogCount = 0;
      function getBlog(){
        getBlogCount += 1;
        if(getBlogCount < 2){
          // ### Get Tumblr Blog Feed (Text Only)
        
            $("<ul class='blog'><li>Loading...</li></ul>").appendTo('div.blog');

        		$.getJSON('http://outtasightblog.tumblr.com/api/read/json?num=3&type=text&callback=?', function(data){

        			$('ul.blog').empty();

        			posts = data.posts;

        			$.each(posts, function(index, post){

        				var body = post["regular-body"],
        						title = post["regular-title"];

        				var $li = $('<li><h6>'+title+'</h6><p>'+body+'</p></li>').appendTo('ul.blog');

        			}); // End .each(Tumblr Photos)
      			
        			$('.content div.blog').bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
                if(scrollPositionY != 0){
                  $('.jspDrag').addClass('active');
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                } else if(isAtTop){
                  $('.jspDrag').removeClass('active');
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                } else {
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                }
              }).jScrollPane({
                autoReinitialise: true
              });
      			
        			var playerHeight = Math.round(($('ul.videos li').width() * 0.6));
        			if(25 == 25){
        				$('img').css({
        					marginLeft: 0,
        					width: "100%",
        					height: "auto"
        				});
        				$('object').css({
        					width: "100% !important",
        					height: playerHeight+'px'
        				});
        				// $('embed').css({
        				// 	width: "100% !important",
        				// 	height: playerHeight+'px'
        				// });
        			} else {
        				$('ul.blog img').css({
        					display: "none"
        				});
        			}

        		}); // End getJSON // Tumblr
        }
      }
      
      // ### Get Videos from YouTube
      var getVideosCount = 0;
      function getVideos(){
        getVideosCount += 1;
        if(getVideosCount < 2){
          
          $("<ul class='videos'><li>Loading...</li></ul>").appendTo('div.videos');
    $.getJSON('http://gdata.youtube.com/feeds/api/videos?author=localnativesband&v=2&orderby=published&max-results=10&alt=jsonc&callback=?', function(data){

        		$('ul.videos').empty();

        		videos = data.data.items;

        		$.each(videos, function(index, video){
        		  
        		  $('<li><div id="player_'+video.id+'"></div></li>').appendTo('ul.videos');
        		  
        		  var player;
                player = new YT.Player('player_'+video.id, {
                  height: '300',
                  width: '100%',
                  videoId: video.id,
                  events: {
                    'onStateChange': onPlayerStateChange
                  }
                });

              function onPlayerStateChange(event) {
                if (event.data == YT.PlayerState.PLAYING) {
                  $('ul.tracks li.playing').click();
                }
              }
        		  
              // var $li = $('<li><iframe width="100%" height="300" src="http://www.youtube.com/embed/'+video.id+'?rel=0&amp;hd=1" frameborder="0" allowfullscreen></iframe></li>').appendTo('ul.videos');

        			// var $li = $('<li style="width:100%;"><object style="width: 100%;height:400px;" width="100%" height="300"><param name="movie" value="http://www.youtube.com/v/'+video.id+'?version=3&autohide=1&enablejsapi=1&fs=1&iv_load_policy=3&feature=player_embedded"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'+video.id+'?version=3&autohide=1&enablejsapi=1&fs=1&iv_load_policy=3&feature=player_embedded" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="100%" height="300"></object><br></li>').appendTo('ul.videos');

        		}); // End .each(YouTube)
        		
        		$('.content div.videos').bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
              if(scrollPositionY != 0){
                $('.jspDrag').addClass('active');
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              } else if(isAtTop){
                $('.jspDrag').removeClass('active');
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              } else {
                setTimeout(function() {
                  $('.jspDrag').removeClass('active');
                }, 1050);
              }
            }).jScrollPane({
              autoReinitialise: true
            });

        	}); // End getJSON // YouTube
        }
      }

      // ### Get Shows from Songkick
      var getShowsCount = 0;
      function getShows(){
        getShowsCount += 1;
      
        if(getShowsCount < 2){
        
          $("<ul class='gigs'><li><h2>Upcoming Shows</h2></li><li>Loading...</li></ul><ul class='oldgigs'><li><h2>Past Shows</h2></li><li>Loading...</li></ul>").appendTo('div.shows');
      
          $.getJSON('http://api.songkick.com/api/3.0/artists/2350755-local-natives/calendar.json?apikey=jwzmbEyCAIwD7HCy&jsoncallback=?&per_page=45', function(data){

        		gigs = data.resultsPage.results.event;

        		// if gigs exist
        		if(typeof gigs != 'undefined'){
        		  
              $('ul.gigs').empty();
              
        			$.each(gigs, function(index, gig){

        				if(typeof gig.series === "undefined"){
        						place = gig.venue.displayName
        					} else {
        						place = gig.series.displayName
        					}
        				var rawDate = gig.start.date;
      				
        				if(typeof gig.performance === "undefined"){
        				  var wit = "";
        				} else {
        				  var wit = "<br>w/ "+gig.performance[0].artist.displayName;
        				}
      				
                var $li = $("<li>"+rawDate+"<br>"+gig.location.city+"<br>"+place+wit+"<br><a href='"+gig.uri+"' target='_blank'>More Info</a></li>").appendTo('ul.gigs');
                // var $li = $('<li>'+place+'<span><br><a href="'+gig.uri+'" target="_blank">More Info</a>&nbsp;</span><br><cite>'+rawDate+'</cite></li>').appendTo('ul.gigs');

        			}); // End .each(Songkick)
        			
        			$('<li><h2>Upcoming Shows</h2></li>').prependTo('ul.gigs');

        		} else { // End if 'gigs exist'
        		
        		  $('ul.gigs').empty();

        			$('<li><h2>Upcoming Shows</h2></li><li>Nothing scheduled...</li>').appendTo('ul.gigs');

        		}

        	}); // End getJSON // Songkick UPCOMING

        	// Check for Total Entries // Required to reverse the Gigography

        	$.getJSON('http://api.songkick.com/api/3.0/artists/2350755-local-natives/gigography.json?apikey=jwzmbEyCAIwD7HCy&per_page=1&page=1&jsoncallback=?', function(data){

        		var total = data.resultsPage.totalEntries,
        				pageDirty = total / 45,
        				pageClean = Math.round(pageDirty*10)/10,
        				page = Math.ceil(pageClean);

        		// Get the recent gigs and prepend them
        		$.getJSON('http://api.songkick.com/api/3.0/artists/2350755-local-natives/gigography.json?apikey=jwzmbEyCAIwD7HCy&per_page=45&page='+page+'&jsoncallback=?', function(data){

        			$('ul.oldgigs').empty();

        			gigs = data.resultsPage.results.event;

        			$.each(gigs, function(index, gig){

        				if(gig.series){
        						place = gig.series.displayName
        					} else {
        						place = gig.venue.displayName
        					}
        				var rawDate = Date.parse(gig.start.date).toString('MMMM d, yyyy');
      				
        				if(gig.performance && !gig.series && gig.performance[0].artist.displayName != "Local Natives"){
        				  var wit = "<br>w/ "+gig.performance[0].artist.displayName;
        				} else {
        				  var wit = "";
        				}
              
                var $li = $("<li>"+rawDate+"<br>"+gig.location.city+"<br>"+place+wit+"<br><a href='"+gig.uri+"' target='_blank'>More Info</a></li>").prependTo('ul.oldgigs');
                // var $li = $('<li>'+place+'<span><br><a href="'+gig.uri+'" target="_blank">More Info</a>&nbsp;</span><br><cite>'+rawDate+'</cite></li>').prependTo('ul.oldgigs');

        			}); // End .each(Songkick)
        			
        			$('<li><h2>Past Shows</h2></li>').prependTo('ul.oldgigs');
      			
        			$('.content div.shows').bind('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
                if(scrollPositionY != 0){
                  $('.jspDrag').addClass('active');
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                } else if(isAtTop){
                  $('.jspDrag').removeClass('active');
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                } else {
                  setTimeout(function() {
                    $('.jspDrag').removeClass('active');
                  }, 1050);
                }
              }).jScrollPane({
                autoReinitialise: true
              });

        		}); // End getJSON 

        	}); // End getJSON // Songkick GIGOG // Check
      	
      	} // End >0
      
      } // End getShows
    
      // ### GUI Events, Clicks, Etc
    
      // Intro to main screen
      $(document).on('click', 'a.intro', function(){
        $('.intro').fadeOut('fast', function(){
          $('.container').fadeIn('fast');
          $(window).resize();
        });
      });
    
      // Handle Nav Clicks
      $(document).on('click', 'ul.nav li a', function(){
        var $t = $(this);
        $('ul.nav li a').removeClass('active');
        $t.addClass('active');
        if($t.hasClass('twitter') || $t.hasClass('facebook') || $t.hasClass('stems')){
          // do nothing
        } else {
          $('.content').fadeIn('fast');
        }
        $('.body').fadeOut('fast', function(){
          if($t.hasClass('music')){
            getTracks();
            $('div.music').addClass('active').fadeIn('fast');
          } else if($t.hasClass('shows')){
            getShows();
            $('div.shows').addClass('active').fadeIn('fast');
          } else if($t.hasClass('blog')){
            getBlog();
            $('div.blog').addClass('active').fadeIn('fast');
          } else if($t.hasClass('photos')){
            getPhotos();
            $('div.photos').addClass('active').fadeIn('fast');
          } else if($t.hasClass('videos')){
            getVideos();
            $('div.videos').addClass('active').fadeIn('fast');
          } else if($t.hasClass('contacts')){
            getContacts();
            $('div.contacts').addClass('active').fadeIn('fast');
          } else if($t.hasClass('twitter')){
            $('.content').hide();
          } else if($t.hasClass('facebook')){
            $('.content').hide();
          } else if($t.hasClass('stems')){
            $('.content').hide();
          }
        });
      });
    
      // Scrubbing GUI Events
      $(window).on('click', '.time', function(){
        scrub(this, event.pageX);
      });
    
      // Fancy Scrolling Shit
      $(window).on('mouseenter', '.jspTrack', function(){
        $('.jspDrag').addClass('active');
      });
      $(window).on('mouseleave', '.jspTrack', function(){
        setTimeout(function() {
          $('.jspDrag').removeClass('active');
        }, 1050);
      });
    
      // ###### Sound Functions
    
      // ### Scrub

    	// Calculate relative position before calling the Seek function

    	var scrub = function(node, xPos) {

    		// Calculate the relative position and make sure it doesn't exceed the buffer's current width.

    		relative = Math.min( $('.buffer').width(), (xPos - $('.time').offset().left) / $('.time').width() );

    		// Pass the relative position to the *onSeek* function.

    		onSeek(relative);

      };

    	// ### Seek

    	// Seek the currently playing track

    	var onSeek = function(relative){

    		// Get the current active track

    		$track = $('li.active').data('track');

    		// Calculate a new position given the click's relative position and the track's duration.

    		position = $track.duration * relative;

    		// Set the position in SoundManager2

    		if($('ul.tracks li').hasClass('playing')) {

    			soundManager.setPosition($track.id, position).play();

    		} else {

    			soundManager.setPosition($track.id, position);

    		}

    	}
  	
    	// ### Next Track

    	// Loads the next track or first if there isn't a next track

    	var nextTrack = function(){

    		soundManager.stopAll();

    		if ( $('ul.tracks li.playing').next().click().length == 0 ) {
    			$('ul.tracks li:first').click();
    		}

    	}
    	
  	});
    
  }); // End jQuery()
  
}).call(this); // End entire function
