(function ($) {
	$(function () {
		/*****************************************************************************
		*** Hacks/Fixes for All Browsers
	 	*****************************************************************************/
		// Give inputs a class equal to their type attribute
		$('input[type]').each(function () {
			$(this).addClass('' + $(this).attr('type'));
		});
		
		// open certain links in new windows
		$('a[href^="http"], a[href$=".pdf"]').attr({'target' : '_blank'});
		
		// zebra striping
		$('#primaryContent table tbody tr:even').addClass('alt');

		/*****************************************************************************
		*** Hacks/Fixes for Internet Explorer (All Versions)
	 	*****************************************************************************/
		if ($.browser.msie) {
			// IE7 introduces support for :first-child but, strangely, not :last-child...
			$('ul#primaryNavigation li ul li:last-child, .form_element :last-child').addClass('last-child');
			$('ul#primaryNavigation > li li:last-child a').css({'border' : 'none'});
			
			// ...or :only-child
			$('.form_element :only-child').addClass('only-child');

			// z-indexing issues
			$('ul#primaryNavigation li')
				.bind('mouseenter', function () {
					$(this).css({'z-index' : '99999'});
					$('*', this).css({'z-index' : '99999'});
				})
				.bind('mouseleave', function () {
					$(this).css({'z-index' : '1'});
					$('*', this).css({'z-index' : '1'});
				});
			
			/*****************************************************************************
			*** Hacks/Fixes for Internet Explorer 6
			*****************************************************************************/
			if ($.browser.version == '6.0') {
				// And IE6 doesn't support :first-child at all...
				$('#userTools ul li:first-child').addClass('first-child');
				// Alpha layer transparencies on PNGs are great, but IE6 doesn't support them...
				$('img[src$=".png"], ul#primaryNavigation > li').addClass('CM_pngFix');
				DD_belatedPNG.fix('.CM_pngFix');
				
				// IE6 doesn't recognize :hover on any element other than anchors
				$('ul#primaryNavigation li')
					.bind('mouseenter', function () {
						$(this).addClass('hover');
					})
					.bind('mouseleave', function () {
						$(this).removeClass('hover');
					});
			}
		}
				
		/*****************************************************************************
		*** Hacks/Fixes for Firefox/Mozilla/Gecko-Based Browsers
	 	*****************************************************************************/
		
		/*****************************************************************************
		*** Hacks/Fixes for Safari/Chrome/WebKit-Based Browsers
	 	*****************************************************************************/
	});
})(jQuery);