/**
 * IE HTML5 elements fix - jQuery plugin
 * Copyright (c) 2010 Johan de Jong <http://johan.notitia.nl>
 *
 * Creative Commons Attribution-Share Alike 3.0
 * http://creativecommons.org/licenses/by-sa/3.0/
 *
*/

(function($){
	$.extend({
		html5 : function(tags){
			// only execute when used in Internet Explorer
			if($.browser.msie){
				// list of (known) HTML5 elements
				e = "abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video";
				// if tags is set, add them to the elements list
				//if(tags.length > 0) { e += ','+tags; }
				x = e;
				e = e.split(',');
				i = e.length;
				// loop through the elements and add them to the DOM
				// please note that no jQuery is used here, this due a bug with innerHTML
				while(i--){
					document.createElement(e[i]);
				}
				// create a new style element, insert the CSS rules and put it in the HEAD
				// please note that no jQuery is used here, this due a bug with innerHTML
				s = document.createElement('style');
				s.setAttribute("type", "text/css");
				s.styleSheet.cssText = x + ' {display:block;zoom:1;}';
				h = document.getElementsByTagName('head')[0];
				h.appendChild(s);
			}
		}
	})
})(jQuery);
