(function($) {

	/**
	 * @desc Fixes IE7 and below's inability to work out z-index's properly.
	 * @author Craig Bassett
	 * @version 1.0
	 *
	**/
	
	$.fn.zIndexFix = function() {
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		
		//*** Check for CSS support ***
		var hasCSS = function()  {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}
		
		//*** Determine's if our browser is IE or not.
		var isIE = function() {
			if(navigator.userAgent.match(/MSIE \d\.\d+/)) return true;
			return false;
		}

		// check for basic CSS support
		if (!hasCSS()) { return false; }
		
		// Fix IE7 and below's z-Index issues.
	    if(isIE()) {
			var zIndexNumber = 10000;
			$('div').each(function() {
				$(this).css('zIndex', zIndexNumber);
				zIndexNumber -= 10;
			});
		}
		
		return this;
		
	};

})(jQuery);
