window.addEvent('domready', function() {

    /* - IE6 Submit Button Hovers & Thumb nail hovers - */
    if (Browser.Engine.version == 4) {		
      var lis = $$('span.button');
      lis.each(function(li){
        li.addEvent('mouseenter',function(){
          li.addClass('over');
        });
        li.addEvent('mouseleave',function(){
          li.removeClass('over');
        });
      });
	  var portraits = $$('a.portrait img');
	  portraits.each(function(portrait) {
		portrait.addEvent('mouseenter', function() {
			portrait.setStyle('border', '5px solid #7EB9BF');
		});
		portrait.addEvent('mouseleave', function() {
			portrait.setStyle('border', '5px solid #E8E8E8');
		});
	  });
    }
	
    /* - Blog Comments Validation & Ajax - */
    if ($chk($('blogcomments'))) {
      $('submit').addEvent('click', function(e) {
        e.stop();
        var errors = new Array();
        if ($chk($('commentauthor')) && $('commentauthor').value == '') {
          errors.push('You need to enter your name!');
        }
        if ($chk($('email')) && $('email').value == '') {
          errors.push('You need to enter an Email address, this will not be shown!');
        }
        if ($('comment').value == '') {
          errors.push('You need to enter a comment!');
        }
        if (errors.length == 0) {
          var submitComment = new Request({
            url: '/blog/wp-comments-post.php',
            method: 'post',
            onSuccess: function(responseText) {
              $('respondinner').innerHTML = '<h3>Thank you</h3><p>Your comment has been submitted, and will need to be approved by an administrator before it is published.</p>';
            }
          });
          submitComment.post({
            author: $('commentauthor').value,
            email: $('email').value,
            comment: $('comment').value,
            comment_post_ID: $('comment_post_ID').value
          });
        } else {
          var output = '<ul id="commenterrors">';
          errors.each(function(error) {
            output = output + '<li>' + error + '</li>';
          });
          output = output + '</ul>';
          $('ajaxresponse').innerHTML = output;
        }
      });
    }
	
});
