$(function()
{
	
	// homepage banner cycle
	$('#indexBannerWrap').cycle(
	{
		fx: 'fade'
	});
	
	
	
	// add pointy hands to buttons
	$('input[type=button], input[type=submit]').css({'cursor':'pointer'});



	
	
	// h1 logo link
	$('#logoWrap')
	.css({'cursor':'pointer'})
	.click(function()
	{
		window.location.href = '/';
	});
	
	

	$('#documentTree').treeview(
	{
		persist: 'cookie', 
		cookieId: 'documentCategoryTree', 
		animated: 'fast',
		collapsed: 'true'
	});
	
	$('#documentTree > li').each(function(i) {
		if($(this).text() != 'Public Documents') {
			if($('ul:not(.possibleExtra) > li', $(this)).length == 0) $(this).remove();
		}
	});

	// corners...
	// ie6 users do not deserve them
	// ie6 cannot handle it
	if ( $.browser.msie && $.browser.version == 6 )
	{
		// fixes are done in /js/ie6.js
	}
	else
	{
		// wrap spans around images added via the editor 
		$('img', '#cmsWrap').each(function()
		{
			$(this).wrap('<span class="cornerMe" style="' + $(this).attr('style') + '"></span>');
		});
		
		// then add corners...
		corners();
		cornersPrimary();
		cornersSecondary();
	}
	
	
	

	// append css3 stylesheet to the head...
	setTimeout("$('head').append(\"<link href='/css/css3.css' rel='stylesheet' type='text/css' media='screen' />\")", 1000)
	
	

	// index rollover links
	$('#indexBannerLinks tr td')
	.mouseover(function()
	{
		$(this).addClass('indexFeatureLinkHover');
	})
	.mouseout(function()
	{
		if ( !$(this).hasClass('current') )
		{
			$(this).removeClass('indexFeatureLinkHover');
		}
	})
	.click(function()
	{
		window.location = $('a', $(this)).attr('href');
	})
	;
	
	
	
	
	// finally, apply a target of blank to external links...
	$('a.external').click(function()
	{
		$(this).attr('target', '_blank');
	});
	
	
	
	
	
});

