/*
 * jQuery IEPngHack plugin method b
 * Version b.02  (03/05/2007)
 * @requires jQuery v1.1.1
 *
 * Examples at: http://khurshid.com/jquery/iepnghack/
 * Copyright (c) 2007 Khurshid M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 /**
  *
  * @example
  *
  * $('img[@src$=.png]').IEPNGHack();
  *
  * @get all images with png extension and apply the hack
  *
  * @name IEPNGHack
  * @type jQuery
  * @cat Plugins/Image
  * @return jQuery
  * @author jQuery Community
  */
 
(function($) {
	$.IEPNGHack = {pixel:'pixel.gif'};
	$.fn.IEPNGHack = function() {
		if (isltIE7!=true) { // process only IE lt 7
			return false;
		}
		this.each(function(){
			var $$ = $(this);
			var src = $$.attr('src');
			$$.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"})
			 .attr({src:$.IEPNGHack.pixel})
			 .width($$.width())
			 .height($$.height());
		});
	};
	
	var isltIE7 = function() {
		if ($.browser.msie) { // processing IE only
			var agent = navigator.userAgent;
			var version = agent.match(/MSIE (\d+(?:\.\d+)+(?:b\d*)?)/); // get IE browser version
			return (version[1]<7); // return true if IE version less then 7, otherwise return false
		}
	}();

})(jQuery);
