ALA's Style Switcher - dynamically create lists?

I’m using ALA’s Alternative Style: Working With Alternate Style Sheets code to switch between my alternate stylesheets. With the JavaScript code in place, you would normally switch a stylesheet by clicking on a link, but I would like to place them dynamically so I don’t have to list each one.
[whisper](Note: I am omitting the part involving cookies because I won’t need them later on–this is irrelevent, though.)[/whisper]

Normally, to change a stylesheet, you’d just have a link on a page accessing the javascript functions, like this:


<a href="#" onclick="setActiveStyleSheet('default'); return false;">change style to default</a>

Here is the JavaScript code I’m using:


function setActiveStyleSheet(title) {
    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")*); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
            a.disabled = true;
            if(a.getAttribute("title") == title) a.disabled = false;
        }
    }
}
function getActiveStyleSheet() {
    var i, a;
    for(i=0; (a = document.getElementsByTagName("link")*); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled)
            return a.getAttribute("title");
    }
    return null;
}
function getPreferredStyleSheet() {
    var i, a;
    for(i=0; (a = document.getElementsByTagName("link")*); i++) {
        if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title"))
            return a.getAttribute("title");
    }
    return null;
}
window.onload = function(e) {
    var title = getPreferredStyleSheet();
    setActiveStyleSheet(title);
}

How do I alter this code to create my links dynamically?