window.onload = function () {
	if( document.childNodes && document.createElement && ( document.styleSheets || window.opera || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) && !navigator.__ice_version ) {
		if( document.all && !window.XMLHttpRequest && !window.opera && navigator.userAgent.match(/msie/i) ) {
			// no Stylesheet switching in IE6
			return;
		}
		var linkList = document.getElementsByTagName('link');
		
		var oParent = document.getElementById('style');
		//oParent.appendChild(document.createTextNode('Style: '));
		
		if (oParent) {
			var color = {Schwarz: '#000', 'Grün': '#213320', 'Grau': '#1A1A1A'};

			for( var n = 0, a, oRel, oTitl; n < linkList.length; n++ ) {
				oRel = linkList[n].getAttribute('rel');
				oTitl = linkList[n].getAttribute('title');
				if( !oRel || !oTitl || ( oRel != 'stylesheet' && oRel != 'alternate stylesheet' ) ) { continue; }
				a = document.createElement('a');
				a.href = '#';
				a.title = oTitl;
				a.style.backgroundColor = color[oTitl] ? color[oTitl] : 'transparent';
				a.onclick = (function(oTitl){
					return function() {
						changeStyle(oTitl);
						rememberStyle('mainsitestyle',10);
						return false;
					};
				})(oTitl);
				oParent.appendChild(a);
			}
		}

		useStyleAgain('mainsitestyle');
	}
};
