// Here we create a custom function to load our css based on the i-weather "js_iweatherCss()" function
// We have set the variables "iweatherCss=0;" in our html file to avoid having 2 functions loading the css

js_addLoadEvent(function() {js_iweatherCssFabric()});

function js_iweatherCssFabric() {
	if (iweatherValues['init']) {
		var nodes=document.getElementsByTagName('style');
		var found=-1;
		for (var n=0;(n<nodes.length && found==-1);n++) if(nodes[n].getAttribute('title')=='i-weather') found=n;
		if (found==-1) {
			var style=document.createElement('style');
			style.setAttribute('type','text/css');
			style.setAttribute('title','i-weather');
		} else {
			var style=nodes[found];
		}
		var content='';
		content+='body {background-color: '+iweatherValues['iweatherColorHex']+'; color: '+iweatherValues['greyColorHex']+';}\n';
		content+='a {color: '+iweatherValues['greyColorHex']+';}\n';
		content+='.iweatherColor { color: '+iweatherValues['iweatherColorHex']+';}\n';
		content+='.iweatherGreyColor { color: '+iweatherValues['greyColorHex']+';}\n';
		content+='.iweatherBgColor { background-color: '+iweatherValues['iweatherColorHex']+';}\n';
		content+='body {scrollbar-face-color:  '+iweatherValues['iweatherColorHex']+'; scrollbar-shadow-color: '+iweatherValues['greyColorHex']+'; scrollbar-highlight-color:  '+iweatherValues['iweatherColorHex']+'; scrollbar-3dlight-color: '+iweatherValues['greyColorHex']+'; scrollbar-darkshadow-color:  '+iweatherValues['iweatherColorHex']+'; scrollbar-track-color:  '+iweatherValues['iweatherColorHex']+'; scrollbar-arrow-color: '+iweatherValues['greyColorHex']+';}\n';
		content+='td, p, li, dd, dt {  font-family: Mini, Verdana, Arial, Helvetica, sans-serif; font-size: 10px}\n';
		content+='a { text-decoration: underline;}\n';
		content+='a:hover { text-decoration: none;}\n';
		content+='dd { margin-top: 0px;	margin-right: 0px; margin-bottom: 5px; margin-left: 50px;}\n';
		content+='table {  border: 0px '+iweatherValues['iweatherColorHex']+' solid}\n';
		content+='input { border: 0px solid '+iweatherValues['iweatherColorHex']+'; background-color: '+iweatherValues['iweatherColorHex']+'; font-family: Mini, Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: '+iweatherValues['greyColorHex']+'}\n';
		content+='.project { text-decoration: none; color: #000000; background-color: #FFFFFF }\n';
		if (style.styleSheet) {
			style.styleSheet.cssText=content;							// IE
		} else {
			style.textContent=content;									// FireFox
		}
		if (found==-1) document.getElementsByTagName('head')[0].appendChild(style);
		setTimeout("js_iweatherCssFabric()",10000);							// Changing the CSS every 10 seconds
	}
}