/* ================================================================
This copyright notice must be untouched at all times.

The original version of this short url script
is available at http://www.nuff-respec.com/technology/css-emulate-javascript
Copyright (c) 2005-2007 Daniel Bulli. All rights reserved.
This code may be modified in any way to fit your requirements.

author : daniel bulli
license: MIT-style license

history:
05/03/2007 	dbulli	: Initial version
=================================================================== */


function css_mutate(who)
{
	//shortcus
	var doc = document;
	var sty = doc.styleSheets;
	var els = doc.getElementsByTagName('*');
	var hed = doc.getElementsByTagName('head')[0];
	
	//take out all the styles
	//http://dorward.me.uk/software/disablecss/
	for (i=0;i<sty.length;i++)  void(sty.item(i).disabled=true); 	
	for (i=0; i<els.length; i++) void(els[i].style.cssText = '');	
	
	//new style
	if(who == undefined || who == '') 
	{
		who="http://www.nuff-respec.com/textpattern/css.php?s=default";	
		who=prompt('css stylesheet',who);
	}
	
	//create new link tag
	var lnk = doc.createElement("link");
	lnk.rel="stylesheet";
	lnk.media="all";	
	lnk.type="text/css";
	
	//set new stye
	lnk.href=who;
	
	//insert into head
	hed.appendChild(lnk);
	
	return false;
}
