

/* from http://www.dustindiaz.com/getelementsbyclass/
 */
function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if (node == null)
        node = document;
    if (tag == null)
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}


/* For 'read more' function in Blog
 * Original from http://chagg.blogspot.com/2006/10/blogger-beta.html
 * Modified by Yu-Kuan Jiang, 2007/3/9
 */
function hidePost(postUrl)
{
    //var fullpost = document.getElementById("fullpost");
    var fullpost= getElementsByClass("fullpost", null, "span")[0];

    if (fullpost != null) {
        eA = document.createElement("a");
        eA.setAttribute("href", postUrl);
        eA.setAttribute("title","Read More");
        eA.appendChild(document.createTextNode("...Continue Reading >>"));
        eB = document.createElement("p");
        eB.setAttribute("id","read-more");
        eB.appendChild(eA);

        //fullpost.parentNode.appendChild(eB);
        fullpost.parentNode.insertBefore(eB, fullpost);
        fullpost.parentNode.removeChild(fullpost);
    }
}
