/*
	name			: Methods for working with HTML 5 elements and selective UI components.
	update			: 9.11.10
	author			: Maurice van Creij
	dependencies	: none
	info			: http://www.classbehaviours.com/

	This file is part of jQuery.classBehaviours.

	ClassBehaviours is a javascript framework based on class-name parsing.
	Copyright (C) 2008  Maurice van Creij

	ClassBehaviours is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	ClassBehaviours is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with ClassBehaviours. If not, see http://www.gnu.org/licenses/gpl.html.
*/

	// methods for working with HTML 5
	HTML5 = {
		// method for HTML elements
		elements: function(){
			// construct a list of elements that Internet Explorer doesn't know about
			elementsList = new Array('section','nav','article','aside','hgroup','header','footer','dialog','mark','dfn','time','progress','meter','ruby','rt','rp','ins','del','figure','figcaption','video','audio','source','canvas','datalist','keygen','output','details','datagrid','command','bb','menu','legend','div');
			if(navigator.userAgent.indexOf('MSIE')>-1){
				// make one instance of every element to convince Internet Explorer of their existence
				for(var a=0; a<elementsList.length; a++){
					document.createElement(elementsList[a]);
				}
			}
		},
		// method for selective UI components
		classes: function(){
			// if there is a list of required components in the url
			componentsList = (document.location.href.indexOf('components=')>-1) ? document.location.href.split('components=')[1].split('&')[0].split(',') : new Array() ;
			if(componentsList.length>0){
				// start the inline stylesheet
				componentStyles = '<style>\n';
				// make all components implicitly invisible by default
				componentStyles += '.component {display : none !important;}\n';
				// for all components in the list
				for(var a=0; a<componentsList.length; a++){
					// make the listed component explicitly visible
					componentStyles += '#' + componentsList[a] + ', .component.' + componentsList[a] + ' {display : block !important;}\n';
					componentStyles += 'table.component.' + componentsList[a] + ' {display : table !important;}\n';
				}
				// end the inline stylesheet
				componentStyles += '</style>\n';
				// write the composed styles
				document.writeln(componentStyles);
			}
		}
	}

	// initialize the HTML 5 elements
	HTML5.elements();

	// initialize the selective UI components
	HTML5.classes();