$(document).ready(function() {
$('a.nudge').hover(function() { //mouse in
    $(this).animate({ paddingLeft: '10px' }, 400);
	}, function() { //mouse out
	  $(this).animate({ paddingLeft: 0 }, 400);
  });



$("#email").blur(function()
{
 //remove all the class add the messagebox classes and start fading
 $("#alert-box2").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
 //check the email exists or not from ajax
 $.post("/validate-email.php",{ email:$(this).val() } ,function(data)
 {
  if(data=='no') //if email not avaiable
  {
   $("#alert-box2").fadeTo(200,0.1,function() //start fading the messagebox
   {
    //add message and change the class of the box and start fading
    $(this).html('This email address appears to be invalid&hellip').addClass('alert').fadeTo(900,1);
   });
  }
  else
  {
   $("#alert-box2").fadeTo(200,0.1,function()  //start fading the messagebox
   {
    //add message and change the class of the box and start fading
    $(this).html('').addClass('boxok').fadeTo(900,1);
   });
  }
 });
});

$(".email-box, .filled").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
  }).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
  });


$('a[rel="external"]').click( function() {
    window.open( $(this).attr('href') );
    return false;
    });  

  if ($.browser.msie && $.browser.version < 7) return;  
  $('#navigation li')
    .removeClass('highlight')
    .find('a')
    .append('<span class="hover" />').each(function () {
      var $span = $('> span.hover', this).css('opacity', 0);
      $(this).hover(function () {
        $span.stop().fadeTo(500, 1);
      }, function () {
        $span.stop().fadeTo(1000, 0);
      });
    });

});
