//*** This code is copyright 2002-2003 by Gavin Kistner, !@phrogz.net //*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt //*** Reuse or modification is free provided you abide by the terms of that license. //*** (Including the first two lines above in your source code satisfies the conditions.) // Add a new stylesheet to the document; // url [optional] A url to an external stylesheet to use // idx [optional] The index in document.styleSheets to insert the new sheet before function AddStyleSheet(url,idx){ var css,before=null,head=document.getElementsByTagName("head")[0]; if (document.createElement){ if (url){ css = document.createElement('link'); css.rel = 'stylesheet'; css.href = url; } else css = document.createElement('style'); css.media = 'all'; css.type = 'text/css'; if (idx>=0){ for (var i=0,ct=0,len=head.childNodes.length;i