The JavaScript function to toggle CSS themes:
(view source to see more)

// define some global styles which are to be ignored when
// toggling between CSS styles
var arrGlobalStyles = new Array('styleGlobal1', 'styleGlobal2');
        
function SwitchToStyle(sCSSName)
{
    // get all LINK and STYLE tags
    var arrLinkTags = document.getElementsByTagName('link');
    var arrStyleTags = document.getElementsByTagName('style');
    
    // put all style elements into an array
    var arrAllCSSElements = new Array();
    for (var i = 0; i < arrLinkTags.length; i++)
        arrAllCSSElements.push(arrLinkTags[i]);
    for (var i = 0; i < arrStyleTags.length; i++)
        arrAllCSSElements.push(arrStyleTags[i]);
    
    for (var i = 0; i < arrAllCSSElements.length; i++)
    {
        // check if the element has a type of text/css
        if (arrAllCSSElements[i].type == "text/css")
        {
            // see if this stylesheet is in our global "don't touch" array
            var bIsGlobalSheet = false;
            for (var j = 0; j < arrGlobalStyles.length; j++)
            {
                if (arrAllCSSElements[i].id == arrGlobalStyles[j])
                {
                    bIsGlobalSheet = true;
                    break;
                }
            }
            
            // toggle the stylesheet
            if (!bIsGlobalSheet)
                arrAllCSSElements[i].disabled = !(arrAllCSSElements[i].id == sCSSName);
        }
    }
}



text