$(document).ready(function() { 


//merch


$.getJSON("http://pipes.yahoo.com/pipes/pipe.run?_id=98a71b6d344d064c2819c1b03f625524&_render=json&_callback=?", function(data) {
 $.each(data.value.items, function() {
 $('<div class="merchitem"></div>')
  .append('<a href="' + this.link + '" target=_blank"><img src="' + this["media:content"].url + '"/><p>' + this["media:title"] + '</p></a>')
  .appendTo('#merch #items');
});
});



//videos

$.getJSON("http://pipes.yahoo.com/pipes/pipe.run?_id=be0f6c790b06c8021b03d988e3c97945&_render=json&_callback=?", function(obj) {
 $.each(obj.value.items, function() {
 $('<div class="vid"></div>')
 .append('<span class="vidthumb" style="background: black url(' + this["media:group"]["media:thumbnail"][0].url + ') no-repeat center;"><a class="vidtitle" href="' + this["media:group"]["media:player"].url + '&autoplay=1">' + this["media:group"]["media:title"].content + '</a></span>')
  .appendTo('#videos');
  
   $('#videos a').click(function() {
                 $.fancybox({
                  'padding'             : 0,
                  'autoScale'   		: false,
                  'transitionIn'        : 'none',
                  'transitionOut'       : 'none',
                  'title'               : this.title,
                  'width'               : 680,
                  'height'              : 383,
				  'href'				: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                  'type'                : 'swf', 
                  'swf'                 : {'allowfullscreen':'true'}
                  });
                 return false;

            }); 
  
  
});
});



//blog
jQuery('#blog').rssfeed('http://thedemos.tumblr.com/rss', {
  limit: 3,
  snippet: false,
});



//menu
$('#top h2').click(function () {
 $.scrollTo( { top:0, left:0}, 800 );
 return false;
});

$('a[href=#blog]').click(function () {
 $.scrollTo( { top:300, left:0}, 800 );
 return false;
});

$('a[href=#shows]').click(function () {
 $.scrollTo($('#shows'), 'normal', 'swing');
 return false;
});

$('a[href=#merch]').click(function () {
 $.scrollTo( { top:300, left:0}, 800 );
 return false;
});

$('a[href=#videos]').click(function () {
 $.scrollTo($('#videos'), 'normal', 'swing');
 return false;
});


$('a[href=#contact]').click(function () {
 $.scrollTo($('#contact'), 'normal', 'swing');
 return false;
});



}); //end

