$(document).ready(function() {  
  $('.rollover').hover(function() {
    var currentImg = $(this).attr('src');
    $(this).attr('src', $(this).attr('hover'));
    $(this).attr('hover', currentImg);
  },
  function() {
    var currentImg = $(this).attr('src');
    $(this).attr('src', $(this).attr('hover'));
    $(this).attr('hover', currentImg);
  });
  
  if($("#user-login-form #edit-name").val() == '') {
    $("#user-login-form #edit-name").css('background', 'url(/sites/all/themes/custom/seo/images/username.png) no-repeat #fff');
  }
  
  $("#user-login-form #edit-name").focus(function() {
    $(this).css('background', 'none #fff');
  });
  $("#user-login-form #edit-name").blur(function() {
    if($(this).val() == '') {
      $(this).css('background', 'url(/sites/all/themes/custom/seo/images/username.png) no-repeat #fff');
    }
  });
  
  $("#user-login-form #edit-pass").css('background', 'url(/sites/all/themes/custom/seo/images/password.png) no-repeat #fff');
  $("#user-login-form #edit-pass").focus(function() {
    $(this).css('background', 'none #fff');
  });
  $("#user-login-form #edit-pass").blur(function() {
    if($(this).val() == '') {
      $(this).css('background', 'url(/sites/all/themes/custom/seo/images/password.png) no-repeat #fff');
    }
  });
  
  $(".more-detail").css('display', 'none');
  $(".show-more").click(function() {
    if($(".more-detail#" + this.id).css('display') == 'none') {
      $(".more-detail#" + this.id).show('slow');
    }
    else {
      $(".more-detail#" + this.id).hide('slow');
    }
  });
  
  /* if we have a short page, extend the #page div to the full window height - extends the dark background neatly */  
  $("#page").css('min-height', $(window).height());
  
  /* user interaction tracking - which parts of the page work best 
  $().mousemove(function(e) {
    $.get("http://www.stevecheng.com/tracka.php", { x: e.pageX, y: e.pageY, s:'aseo', r:location.href },null,'jsonp' );
  });
  */

        $('#feedback-tab').click(function(event){
            $(this).blur();
            if ($('#feedback-form').hasClass('open')) {
                $('#feedback-form')
                  .animate({width:'0px',padding:'0'}, 500)
                  .removeClass('open')
                  .html('');
                $("#feedback-darken").fadeOut(500).remove();
                
            } else {
                $("body").prepend('<div id="feedback-darken"></div>');
                $("#feedback-darken")
                  .css('height', $(document).height())
                  .css('opacity', '0.5');
                $('#feedback-form')
                  .animate({width:'800px', padding:'10px'},  500)
                  .addClass('open')
                  .load('/seo_feedback');
            }
            event.preventDefault();
        });

});


