/*
 * jQuery fixpng plugin 0.1
 *
 * Copyright (c) 2009 Montrose Travel
 *
 * fixes png transparency with IE 6
 * 
 * jQuery setup:
 * $("#tabs").pngfix();
 * 
 */

;(function($) {
	var IE6and55 = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent);
	var settings = {};
	var defaults = {
        sizing: 'image'
	};

	$.fn.fixpng = function(options) {
        settings = $.extend({}, defaults, options);
		//run the plugin
		return this.each(function() {
			if (IE6and55) {
				$this = $(this);
				//fix css background pngs
				var bgIMG = $this.css('background-image');
				if(bgIMG.indexOf(".png") != -1){
					var iebg = bgIMG.split('url("')[1].split('")')[0];
					$this.css('background-image', 'none');
					$this.get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "', sizingMethod='" + settings.sizing + "')";
				}
			}
		});
	};
})(jQuery);