//Load when the page is ready - Using jQuery to run events
$(document).ready(function(){	
						   
// fullsize background image

$.fn.fullBg = function(){
    var bgImg = $(this);		
 
    function resizeImg() {
      var imgwidth = bgImg.width();
      var imgheight = bgImg.height();
 
      var winwidth = $(window).width();
      var winheight = $(window).height();
 
      var widthratio = winwidth / imgwidth;
      var heightratio = winheight / imgheight;
 
      var widthdiff = heightratio * imgwidth;
      var heightdiff = widthratio * imgheight;
 
      if(heightdiff>winheight) {
        bgImg.css({
          width: winwidth+'px',
          height: heightdiff+'px'
        });
      } else {
        bgImg.css({
          width: widthdiff+'px',
          height: winheight+'px'
        });		
      }
    } 
    resizeImg();
    $(window).resize(function() {
      resizeImg();
    }); 
  };					   

// add a class to all external links called .externalLink
$("#content a:not(:has(img))").filter(function() {
         return this.hostname && this.hostname !== location.hostname;
        }).addClass('externalLink');

// twitter
$(".tweet").tweet({
                join_text: "auto",
                avatar_size: 32,
                count: 3,
                auto_join_text_default: "I said,",
                auto_join_text_ed: "I",
                auto_join_text_ing: "I was",
                auto_join_text_reply: "I replied to",
                auto_join_text_url: "I was checking out",
                loading_text: "loading tweets..."
            });

// will scroll to any anchor element
$.localScroll();

// reveal
/*
$("a.music").click(function(event){
	$("#musicplayer").toggleClass("hide").show("slow");
	event.preventDefault();
});
*/
/*
event.preventDefault();
     $("#musicplayer").animate({ height: 'hide', opacity: 'hide' }, 'slow');
   },function(){
     $("#musicplayer").animate({ height: 'show', opacity: 'show' }, 'slow');
*/


$(".music").click(function(event){
     $("#musicplayer").toggle("slow");
	 event.preventDefault();
});

// pop up window function
/*
var newwindow;
	function popwin(url) {
		newwindow=window.open(url,'name','height=210,width=340');
		if (window.focus) {newwindow.focus()}
	}
*/

// write the year in
$("#footer span.year").append(
	'2010'
);
//end ready function
});