$(document).ready(
	function()
	{

		// fix 1: fix to make the home link in the firt tab center aligned
//		$('ul.primary-links li a:first').css('padding-left', '0px');
//		$('ul.primary-links li a:first').css('text-align', 'center');
		// end of fix 1.
		
		//fix 2: another fix is to make the links in the main tab **non-clickable** :-S
		//=============================================================================
		//another thing to note here is to make it work in such a way that only the main 
		//tabs which have a heiracrchy underneath should be **non-clickable**. While those 
		//with no links in the dropdown shall stay clickable as they were.
		$('ul.primary-links li ul').each(
			function()
			{
				$(this).parent().find('a').each(
					function()
					{
						$(this).css('cursor', 'default');
					}
				);
				$(this).parent().find('a').click(
					function()
					{
						return false;
					}
				);
				
				$(this).children().find('a').each(
					function()
					{
						$(this).css('cursor', 'pointer');
					}
				);
				$(this).children().find('a').click(
					function()
					{
						window.location = $(this).attr('href');
					}
				);
			}
		);
		
		var hasActiveClass = false;
		$('ul.primary-links li ul li').mouseover(
			function()
			{
				if($(this).parent().parent().find('a:first.active').length == 1)
				{
					hasActiveClass = true;
				}
				else
				{
					hasActiveClass = false;
					$(this).parent().parent().find('a:first').addClass('active');
				}
			}
		);
		
		$('ul.primary-links li ul li').mouseout(
			function()
			{
				if( hasActiveClass == false )
				{
					$(this).parent().parent().find('a:first').removeClass('active');
				}
			}
		);
	}
);
