function getElementsByClassName(name){
    var ret = new Array();
    var elements = document.getElementsByTagName("*");
    for(var i = 0;i < elements.length;i++){
        if(elements[i].className.indexOf(" ") >= 0){
            var classes = elements[i].className.split(" ");
            for(var j = 0;j < classes.length;j++){
                if(classes[j] == name)
                    ret.push(elements[i]);
            }
        }
        else if(elements[i].className == name)
            ret.push(elements[i]);
    }
    return ret;
}