	$(document).ready(function()
	{
		if ($.browser.msie && $.browser.version <= '6.0')
		{
			DD_belatedPNG.fix('#header .visual, #logo');
			
			$('#nav-main li.root').hover(function() {
				$(this).find('ul').show();	
			}, function() {
				$(this).find('ul').hide();	
			});
		}
		
		// Fix z-index issues IE6/7
		if ($.browser.msie && $.browser.version <= '7.0')
		{
			var zIndexNumber = 1000;
			$('div').each(function() {
				$(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
		}
		
		// Rotating header images
	
		if ($('#page-wrapper.home').length) {
			$('#visual .vsl:gt(0)').hide();	
			setInterval(function(){
				$('.vsl:first-child').fadeOut().next('.vsl').fadeIn()
				.end().appendTo('#visual');
			}, 5000);
		}
		
		// Make entire blockitems element clickable
		$('.cta li, .blockitem[id!=highlight]').mouseover(function() {
			if ($(this).find('a:not(.xbtn)').length) $(this).css({ cursor: 'pointer' });
		}).click(function() {
			if ($(this).find('a:not(.xbtn)').length) {
				if ($(this).find('a[target=_blank]').length) {
					window.open($(this).find('a').attr('href'));
				} else {
					window.location = $(this).find('a').attr('href');
				}
			}
			return false;
		});
		
		// Create custom submit buttons
		$('input[class~=custom]').replaceSubmitButton();

		// Re initialize block elements to fix height
		$('.x').hide();
		$('.x').show();
		
		// Print page
		$('#printpage').click(function() { window.print(); return false; });
	});
	
	
	// Fancy submit buttons
	
	$.fn.replaceSubmitButton = function() {
		if (!$(this).length) return;
		$(this).replaceWith(
			$('<a href="#" />').text($(this).val()).addClass('xbtn').click(function() {
				$(this).closest('form').submit();
				return false;
			})
		);
	};

	
	
	
	
	
