function getSelectText() {
    var d = document;
    var desc = '';
    if(window.getSelection)desc=window.getSelection();
    else if(document.getSelection)desc=document.getSelection();
    else if(document.selection)desc=document.selection.createRange().text;
    else desc = '';
    return desc;
}

function addBookmark(sType, sTitle, sURL) {

    var via ='';
    var result = '';
    var sTitle = encodeURIComponent(sTitle);
    var sURL = encodeURIComponent(sURL);
    sDesc = encodeURIComponent( getSelectText());
   
    if( sType==("hemidemi")) {
        result = 'http://www.hemidemi.com/user_bookmark/new?title='+sTitle+'&url='+sURL+'&description='+sDesc+'&via='+via;
    } else if( sType==("myshare")) {
        result = 'http://myshare.url.com.tw/index.php?func=newurl&from=mysharepop&url='+sURL+'&desc='+sTitle+'&contents='+sDesc;
    } else if( sType==("baidu")) {
        result = 'http://cang.baidu.com/do/add?iu='+sURL+'&it='+sTitle+'&dc='+sDesc;
    } else if( sType==("google")) {
        result = 'http://www.google.com/bookmarks/mark?op=add&bkmk='+sURL+'&title='+sTitle+'&annotation='+sDesc;   
    } else if( sType==("yahoo")) {
        result = 'http://tw.myweb2.search.yahoo.com/myresults/bookmarklet?t='+sTitle+'&u='+sURL+'&d='+sDesc+'&ei=UTF-8';
    } else if( sType==("delicious")) {
        result = 'http://del.icio.us/post?title='+sTitle+'&url='+sURL+'&notes='+sDesc;
    } else if( sType==("digg")) {
        result = 'http://digg.com/submit?phase=2&url='+sURL+'&title='+sTitle+'&bodytext='+sDesc;
    } else if( sType==("technorati")) {
        result = 'http://technorati.com/faves?add='+sURL+'&title='+sTitle;
    } else if( sType==("furl")) {
        result = 'http://www.furl.net/storeIt.jsp?t='+sTitle+'&u='+sURL+'&r='+escape(via)+'&c='+sDesc+'&p=1';
    }
   
    if(result!='') {
        window.open( result, 'addbookmak');
    }

}