/* Hover effect for recent projects tab in the header */
$(function() {
    $("td.second_header#recent_projects").hover(
    		function(){
		     	$(this).addClass('highlight');
		 	},
		 	function(){
		 		$(this).removeClass('highlight');
		 }).click(
			function(){
				location = $(this).find('a').attr('href');
		 });
    });

$(function(){
	$("body").addClass('ui-widget ui-helper-reset');
	$("#reviewByManagementBox").add("#codeOfHonourButton div").add("div.stars li")
	.add("#smoothmenu1").add(".header3").addClass('ui-helper-clearfix');
});

/* For the top left hand side buttons on some pages, fix an IE 6 issue 
 * where width of the button goes across whole page.
 */
$(function(){
	$("#certificateOfEntry .ddsmoothmenu").attr('style', 'width: ' + 
			$("#certificateOfEntry li").width() + 'px');

	$("#reviewByManagementBox .ddsmoothmenu").attr('style', 'width: ' + 
			$("#reviewByManagementBox li").width() + 'px');
});

$(function(){
	$(".projects table tr").addClass('ui-helper-clearfix');
});


/* Ajax request to get the hit counter data from the server. */
$(function(){
	$("#hitCounter").load('/counter?format=xml');
});


/** This plugin to blink */
(function($){
	$.fn.animateBlink = function(options) {
		var settings = $.extend({
			showDuration: 300,
			waitAfterShowDuration: 1000,
			hideDuration: 700
		}, options || {});

		this.addClass('es-animate-blink');

		var blinkShow = function() {
			$('.es-animate-blink').fadeTo(settings.showDuration, 0.9)
				.fadeTo(settings.waitAfterShowDuration, 1, blinkHide);;
		}
		
		var blinkHide = function() {
			$('.es-animate-blink').fadeTo(settings.showDuration, 0.1, blinkShow);
		}

		blinkShow();
		
		return this;
	};
}) (jQuery);

/* Blink the text inside one of the top headers.  For details about which header,
 * see the code. */
$(function(){
	$(".header3 p").animateBlink();
});

