/**
 * simple PNG background fixer for IE6
 * @author: Andy Thomas (andyt@coolpink.net)
 * @date:	08/06/2011
 **/

// AT: 08/06/2011 simple PNG background fixer for IE6
ie6_pngbg_fix = function() {
	var args = arguments;
	try {
		jQuery(document).find('*').each(function(){
			
			var bg = jQuery(this).css('background-image');
			
			if (bg.indexOf('.png') != -1) {
				bg = bg.split('url("')[1].split('")')[0];
				var exclude = 0;
				
				if (args.length > 0) {
					for (var i=0;i<args.length;i++) {
						if (bg === window.location.protocol + '//' + window.location.hostname + args[i]) {
							exclude = 1;
							break;
						}
					}
				}
				
				if (!exclude) {
					jQuery(this).css('background-image', 'none');
					jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bg + "',sizingMethod='scale')";
				}
			}
		});
	} catch(e) {
		alert('NB: PNG images could not be optimized for your browser. Some may appear incorrectly - sorry for any inconvenience.');
	}
}
