$(document).ready(function()
{
	  
	  // =====================================================================
	  // Cufon
	  Cufon.replace('.droid_sans, #mainnav li a', { fontFamily: 'Droid Sans' });
	  
	  
	  
	  
	  // =====================================================================
	  // Form Text Fields Focus/Blur
	  $('input.text').focus(function()
	  { if (this.value == this.defaultValue) { this.value = ''; $(this).parents('form').css('background-position', 'bottom');}});
	  $('input.text').blur(function()
	  { if (this.value == '') { this.value = this.defaultValue; $(this).parents('form').css('background-position', 'top');} });
	  
	  
	  
	  
	  // =====================================================================
	  // Load Feedburner Subscriber Stats
	  $('.rss_box').load('feedburner.php');
	  $('#sidebar .banners_125 li:even').css('margin-right', '0').css('float', 'right');
	  $('#contact_form p.submit input').hover(function()
	  {
		    $(this).css('background-position', 'bottom');
	  }, function()
	  {
		    $(this).css('background-position', 'top');
	  });
	  
	  
	  
	  
	  // =====================================================================
	  // Contact Form + Validation
	  var name = $("input#name").val();
	  var email = $("input#email").val();
	  var subject = $("input#subject").val();
	  var message = $("textarea#message").val();
	  var math = $("input#math").val();
	  
	  $("input#name").blur(function() 
      {
	        if ($(this).val().length === 0) 
			{ $('input#name').parents('p').css('background-position', 'bottom left'); }
			else
			{$('input#name').parents('p').css('background-position', 'top left'); }
      });
	  
	  $("input#email").blur(function() 
      {
	        if ($(this).val().length === 0) 
			{ $('input#email').parents('p').css('background-position', 'bottom left'); }
			else
			{ $('input#email').parents('p').css('background-position', 'top left'); }
      });
	  
	  $("input#math").blur(function() 
      {
	        if ($(this).val() == '29') 
			{ $('input#math').parents('p').css('background-position', 'top left'); }
			else
			{ $('input#math').parents('p').css('background-position', 'bottom left'); }
      });
	  
	  $("input#subject").blur(function() 
      {
	        if ($(this).val().length === 0) 
			{ $('input#subject').parents('p').css('background-position', 'bottom left'); }
			else
			{ $('input#subject').parents('p').css('background-position', 'top left'); }
      });
	  
	  $("textarea#message").blur(function() 
      {
	        if ($(this).val().length === 0) 
			{ $('textarea#message').parents('p').css('background-position', 'bottom left'); }
			else
			{ $('textarea#message').parents('p').css('background-position', 'top left'); }
      });

	  




	  // =====================================================================
	  // Pseudo Button Hover
      $('#sidebar .newsletter_box input.submit').hover(function()
	  {
		    $(this).parents('.newsletter_box').css('background-position', 'bottom')
	  }, function()
	  {
		    $(this).parents('.newsletter_box').css('background-position', 'top')
	  });
	  
	  $('.comments .submit_comment input').hover(function()
	  {
		    $(this).css('background-position', 'bottom');
	  }, function()
	  {
		    $(this).css('background-position', 'top');
	  })
	  
	  
	  
	  
	  // =====================================================================
	  // Sliding Ids
	  $('a[href*=#]').click(function() 
	  {
		    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')&& location.hostname == this.hostname) 
			{
				  var $target = $(this.hash);
				  $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				  
				  if ($target.length) 
				  {
					    var targetOffset = $target.offset().top;
						$('html,body').animate({scrollTop: targetOffset}, 600);
						return false;
				  }
            }
      });
	  
	  
	  
	  
	  // =====================================================================
	  // Twitter
	  $(".tweet").tweet({
            username: "seaofclouds",
            join_text: "auto",
            /*avatar_size: 26,*/
            count: 5,
            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..."
      });
	  
	  
	  
	  
	  // =====================================================================
	  // Looped Slider
	  $.fn.loopedSlider.defaults.addPagination = true;
	  $('#loopedSlider').loopedSlider
	  ({
	         autoStart: 4500,
			 restart: 8000,
			 containerClick: false
      });
	  
      
	  
	  
	  // =====================================================================
	  // Dropdown Menu
      $('#mainnav a').bind('mouseover', function()
      {
            $(this).parents('li').children('ul').show();
      });
	  
	  $('#mainnav a').bind('mouseout', function()
	  {
	        $(this).parents('li').children('ul').hide();
	  });
	  
});


			      

