﻿// JavaScript 文件
function blogit_init() {
    var lists = [
        {name : "QQ", logo : "QQ.gif", href : function(t,u,c) { return "http://shuqian.qq.com/post?from=3" + "\&uri=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t); } }, 
        {name : "ZhuaXia", logo : "zhuaxia.gif", href : function(t,u,c) { return "http://www.zhuaxia.com/add_channel.php?sourceid=103" + "\&url=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t); } }, 
        {name : "fanfou", logo : "fan.gif", href : function(t,u,c) { return "http://fanfou.com/sharer" + "?u=" + encodeURIComponent(u) + "?t=" + encodeURIComponent(t)+ "?d=" + encodeURIComponent(c); } }, 
        {name : "xianguo", logo : "xianguo.gif", href : function(t,u,c) { return "http://www.xianguo.com/subscribe.php?" + ";url=" + encodeURIComponent(u) + ";title=" + encodeURIComponent(t); } }, 
        {name : "365key", logo : "365key.gif", href : function(t,u,c) { return "http://www.365key.com/storeit.aspx?noui=yes\&jump=close" + "\&t=" + escape(t) + "\&u=" + escape(u) + "\&c=" + escape(c); } }, 
        {name : "baidu", logo : "baidu.gif", href : function(t,u,c) { return "http://cang.baidu.com/do/add?fr=ieo;\&it=" + encodeURIComponent(t) + "\&iu=" + encodeURIComponent(u) + "\&dc=" + encodeURIComponent(c); } }, 
        {name : "delicious", logo : "delicious.gif", href : function(t,u,c) { return "http://del.icio.us/post?v=4" + ";url=" + encodeURIComponent(u) + ";title=" + encodeURIComponent(t); } }, 
        {name : "digg", logo : "digg.gif", href : function(t,u,c) { return "http://digg.com/submit?phase=2" + "\&url=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t); } }, 
        {name : "Sina vivi", logo : "vivi.gif", href : function(t,u,c){ return "http://vivi.sina.com.cn/collect/icollect.php?pid=2008" + "\&title=" + escape(t) + "\&url=" + escape(u) + "\&desc=" + escape(c) } }, 
        {name : "hexun", logo : "hexun.gif", href : function(t,u,c) { return "http://bookmark.hexun.com/post.aspx?" + "title=" + escape(t) + "\&url=" + escape(u) + "\&excerpt=" + escape(c); } }, 
        {name : "Google", logo : "google.gif", href : function(t,u,c) { return "http://www.google.com/bookmarks/mark?op=add" + "\&bkmk=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t) } }, 
        {name : "Yahoo", logo : "yahoo.gif", href : function(t,u,c) { return "http://myweb.cn.yahoo.com/addp.html?method=add" + "\&url=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t) } }, 
        {name : "Windows Live Bookmarks", logo : "winlive.gif", href : function(t,u,c) { return "https://favorites.live.com/quickadd.aspx?marklet=1\&mkt=en-us" + "\&url=" + encodeURIComponent(u) + "\&title=" + encodeURIComponent(t) } } 
    ];
    var title = document.title;
    var url = location.href; 
    var comment = "好文章，推荐！"; 
    var blogit = document.getElementById("blogit"); 
    var i, a, button, img; 
    if (blogit) { 
        for (i=0; i<lists.length; i++) { 
            button = document.createElement("span"); 
            a = document.createElement("a"); 
            img = document.createElement("img"); 
            img.src = "http://pic1.kyzhi.com/blogit/" + lists[i].logo; 
            img.title = "提交到 " + lists[i].name; 
            img.align = "absmiddle"; 
            img.style.padding = "2px"; img.style.border = "1px solid #FFFFFF"; 
            img.onmouseover = function () { this.style.border = "1px solid #C3CED9"; } 
            img.onmouseout = function () { this.style.border = "1px solid #FFF";} 
            a.href = lists[i].href(title, url, comment); 
            a.target = "_blank"; 
            a.appendChild(img); 
            button.appendChild(a); 
            blogit.appendChild(button); 
        }
    }
} 
$(document).ready(function() { blogit_init(); });