$(document).ready(function(){
	
	$("#SearchForm").jqTransform();
	
	$("#txtSearch").focus(function(){
		if ($(this).val() == 'QUICK SEARCH')
		{
			$(this).val('');
		}
	});
	
	$("#txtSearch").blur(function(){
		if ($(this).val() == '')
		{
			$(this).val('QUICK SEARCH');
		}
	});
	
	var FeatureBoxHeight = Math.max(Math.max(Math.max($('#Feature1').height(),$('#Feature2').height()),$('#Feature3').height()),$('#Feature4').height());
	$('#Feature1').height(FeatureBoxHeight);
	$('#Feature2').height(FeatureBoxHeight);
	$('#Feature3').height(FeatureBoxHeight);
	$('#Feature4').height(FeatureBoxHeight);
	
	var FeatureBox2Height = Math.max($('#LatestNewsFeature').height(),$('#FAQs').height());
	$('#LatestNewsFeature').height(FeatureBox2Height);
	$('#FAQs').height(FeatureBox2Height);
	
	$("#Navigation li").hover(
		function(){
			$(this).addClass('MouseOver');
			var elm = $(this);
			setTimeout(function(){
				handleNavigation(elm,'expand');
			},500);
		},
		function(){
			$(this).removeClass('MouseOver');
			var elm = $(this);
			setTimeout(function(){
				handleNavigation(elm,'collapse');
			},500);
		}
	);
	
	if ($.browser.msie && ($.browser.version == "6.0"))
	{
		$('#Body').append('<div id="IE6_Clear"></div>');
		$('#IE6_Clear').css('clear','both');
	}
	
});

function handleNavigation(nav, action)
{
	if (nav.hasClass('MouseOver') && action == 'expand')
	{
		nav.children('ul').slideDown('slow');
	}
	else if (!nav.hasClass('MouseOver') && action == 'collapse')
	{
		nav.children('ul').slideUp('slow');
	}	
}
