/*	
javascript per mostrar les gràfiques al contentpane
*/

(function(){
	var d = dojo;
	var theme = false; var testMode;
	if(window.location.href.indexOf("?") > -1)
	{
		var str = window.location.href.substr(window.location.href.indexOf("?")+1).split(/#/);
		var ary  = str[0].split(/&/);
		for(var i=0; i<ary.length; i++)
		{
			var split = ary[i].split(/=/),
			key = split[0],
			value = split[1];
			switch(key)
  			{
				case "locale":
					// locale string | null
					dojo.config.locale = locale = value;
					break;
				case "dir":
					// rtl | null
					document.getElementsByTagName("html")[0].dir = value;
					break;
				case "theme":
					// tundra | soria | noir | squid | nihilo | null
					theme = value;
					break;
				case "a11y":
					if(value){ testMode = "dijit_a11y"; }
			}
		}
	}		

	// always include the default theme files:
	if(!theme){ theme = dojo.config.defaultTestTheme || 'tundra'; }
	var themeCss = d.moduleUrl("dijit.themes",theme+"/"+theme+".css");
	var themeCssRtl = d.moduleUrl("dijit.themes",theme+"/"+theme+"_rtl.css");
	document.write('<link rel="stylesheet" type="text/css" href="'+themeCss+'"/>');
	document.write('<link rel="stylesheet" type="text/css" href="'+themeCssRtl+'"/>');

	if(dojo.config.parseOnLoad)
	{ 
		dojo.config.parseOnLoad = false;
		dojo.config._deferParsing = true;
	}

	d.addOnLoad(function()
	{

		// set the classes
		if(!d.hasClass(d.body(),theme)){ d.addClass(d.body(),theme); }
			
		// link matrix code:
		var node = document.createElement('div');
		node.id = "NodeDialog";
		d.addClass(node,"dijitNodeDialog");
		d.body().appendChild(node);


		if(dojo.config._deferParsing){ d.parser.parse(d.body()); }

	});


})();
