
	
	$(function () {

		$("h2").hide().fadeIn(500);
		$("h2 span").css({ opacity: "0"}).animate({ opacity: "+=0"}, 1000).animate({ opacity: "1"}, 300);

		//hover state for submit button
		$("input#submit")
			.hover(
				function() {
					$(this).css({ background: "url(/images/sub-up.jpg) repeat-x 0 0", color: "#eee" });
				}, function()	{
					$(this).css({ background: "url(/images/sub-bg.png) repeat-x 0 0", color: "#e407b8" });
				}
			)
			.click(function() {
				$(this).css({ background: "url(/images/sub-bg.png) repeat-x 0 0", color: "#e407b8" });
			})
		;
	
    $("#twitter-box").tweet({
    	username: "IBPlayers",
      join_text: "auto",
      avatar_size: 35,
      count: 4,
      auto_join_text_default: "we said:", 
      auto_join_text_ed: "we:",
      auto_join_text_ing: "we were:",
      auto_join_text_reply: "we replied to:",
      auto_join_text_url: "we were checking out:",
      loading_text: "loading tweets..."
    });
  
		// same page nice scrolling links
		
 		function filterPath(string) {
    	return string
      	.replace(/^\//,'').replace(/(index|default).[a-zA-Z]{3,4}$/,'').replace(/\/$/,'');
	  }
  	
  	$('a[href*=#]').each(function() {
    	if ( filterPath(location.pathname) == filterPath(this.pathname)
	    && location.hostname == this.hostname
  	  && this.hash.replace(/#/,'') ) {
    	  var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
      	var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
	       if ($target) {
  	       var targetOffset = $target.offset().top;
    	     $(this).click(function() {
      	     $('html, body').animate({scrollTop: targetOffset}, 900);
        	   return false;
         	});
	      }
  	  }
	  });
		
	});