﻿-
function() {
    var d = document,
    isStrict = d.compatMode == "CSS1Compat",
    dd = d.documentElement,
    db = d.body,
    m = Math.max,
    na = navigator.userAgent.toLowerCase(),
    ie = !!d.all,
    head = d.getElementsByTagName('head')[0],
    getWH = function() {
        return {
            h: (isStrict ? dd: db).clientHeight,
            w: (isStrict ? dd: db).clientWidth
        }
    },
    getS = function() {
        return {
            t: m(dd.scrollTop, db.scrollTop),
            l: m(dd.scrollLeft, db.scrollLeft)
        }
    },
    creElm = function(o, t, a) {
        var b = d.createElement(t || 'div');
        for (var p in o) {
            p == 'style' ? b[p].cssText = o[p] : b[p] = o[p]
        }
        return (a || db).insertBefore(b, (a || db).firstChild)
    },
    div,
    div1 = creElm({
        id: 'ckepop',
        style: "height:auto;position:absolute;z-index:100000;display:none;top:50%;left:50%;overflow:auto;"
    }),
    inputTimer,
    list,
    clist,
    as,
    texts = {},
    script,
    timerover,
    timerout,
    timerloop,
    loop = function() {
        var t = 1000,
        st = getS().t,
        c,
        wh = getWH();
        c = st - div.offsetTop + 350; /*到顶部的距离*/
        c != 0 && (div.style.top = div.offsetTop + c / 10 + 'px', t = 10);
        timerloop = setTimeout(loop, t)
    },
    iframe = creElm({
        style: 'position:' + (/firefox/.test(na) ? 'fixed': 'absolute') + ';display:none;',
        frameBorder: 0
    },
    'iframe'),
    conf = {
        type: 'right',
        move: 'roll'
    },
    scripts = d.getElementsByTagName('script');
    for (var i = 0,
    ci; ci = scripts[i++];) {
        if (/jiathis/.test(ci.src)) {
            ci.src.replace(/(type|btn|move)=([^&]+)/g,
            function(a, p, v) {
                conf[p] = v
            })
        }
    };
    div = creElm({
        id: 'ckepop',
        style: "height:auto;position:" + (conf.move == 'roll' || /msie 6/i.test(na) ? 'absolute': 'fixed') + ";z-index:100000000;top:" + (conf.move == 'roll' || /msie 6/i.test(na) ? '0': '150px') + ";" + (conf.type == 'right' ? "right:0;overflow:hidden;width:26px;": "left:-242px;overflow:auto;"),
        innerHTML: conf.type == 'right' ? "<table cellPadding=0 cellSpacing=0 ><tbody style='background:transparent'><tr><td style='background:transparent' ><img id='jiathis_a'src=http://www.525live.com/images/" + (conf.btn || 'r.gif') + " style='cursor:pointer;' onmouseover='$CKE.over()'/></td><td><div ></div></td></tr></tbody></table>": "<table cellPadding=0 cellSpacing=0 ><tbody style='background:transparent'><tr><td><div ></div></td><td><img id='jiathis_a'src=http://www.525live.com/images/" + (conf.btn || 'l.gif') + " style='cursor:pointer;' onmouseover='$CKE.over()' onclick='$CKE.center(this)'/></td></tr></tbody></table>"
    });
    creElm({
        href: 'http://www.525live.com/css/css1.css',
        rel: 'stylesheet',
        type: 'text/css'
    },
    'link');
    d.write('<script src="http://www.525live.com/js/jiathis_ckepop.js" charset="utf-8"></scr' + 'ipt>');
    $CKE = {
        pop: div.getElementsByTagName('div')[0],
        centerpop: div1,
        disappear: function(a) {
            var b = window.event || a,
            t = b.srcElement || b.target,
            contain = div1.contains ? div1.contains(t) : !!(div1.compareDocumentPosition(t) & 16),
            contain1 = div.contains ? div.contains(t) : !!(div.compareDocumentPosition(t) & 16);
            if (!contain && !contain1) {
                iframe.style.display = div1.style.display = 'none'
            }
        },
        over: conf.type == 'right' ?
        function() {
            if (div.offsetWidth > 26) return;
            clearTimeout(timerloop);
            clearInterval(timerout);
            div.style.cssText += ";height:" + this.pop.offsetHeight + "px;width:26px;left:" + (getWH() - 26) + "px";
            var t = 10,
            tmp = 0,
            step = this.pop.offsetWidth / 55;
            timerover = setInterval(function() {
                if (t == 0) {
                    clearInterval(timerover); (conf.move == 'roll' || /msie 6/i.test(na)) && loop()
                } else {
                    var n = Math.round(step * t--);
                    div.style.left = div.offsetLeft - n + 'px';
                    div.style.width = div.offsetWidth + n + 'px'
                }
            },
            10)
        }: function() {
            clearTimeout(timerloop);
            clearInterval(timerout);
            clearInterval(timerover);
            var t = 10,
            tmp = 0,
            step = Math.abs(div.offsetLeft / 55);
            timerover = setInterval(function() {
                if (t == 0) {
                    clearInterval(timerover); (conf.move == 'roll' || /msie 6/i.test(na)) && loop()
                } else {
                    var n = Math.round(step * t--);
                    div.style.left = div.offsetLeft + n + 'px'
                }
            },
            10)
        },
        out: conf.type == 'right' ?
        function() {
            if (div.offsetWidth > $CKE.pop.offsetWidth) {
                clearInterval(timerover);
                clearTimeout(timerloop);
                div.style.cssText += ";height:" + $CKE.pop.offsetHeight + "px;width:" + ($CKE.pop.offsetWidth + 26) + "px;left:" + (getWH() - 26 - $CKE.pop.offsetWidth) + "px";
                var t = 10,
                tmp = 0,
                step = (div.offsetWidth - 26) / 55;
                timerout = setInterval(function() {
                    if (t == 0) {
                        clearInterval(timerout);
                        div.style.left = ''; (conf.move == 'roll' || /msie 6/i.test(na)) && loop()
                    } else {
                        var n = Math.round(step * t--);
                        div.style.width = div.offsetWidth - n < 26 ? 26 : div.offsetWidth - n + 'px';
                        div.style.left = div.offsetLeft + n + 'px'
                    }
                },
                10)
            }
        }: function() {
            clearInterval(timerover);
            clearInterval(timerout);
            clearTimeout(timerloop);
            var t = 10,
            tmp = 0,
            step = Math.abs((div.offsetLeft + 242) / 55);
            timerout = setInterval(function() {
                if (t == 0) {
                    clearInterval(timerout);
                    div.style.left = '-242px'; (conf.move == 'roll' || /msie 6/i.test(na)) && loop()
                } else {
                    var n = Math.round(step * t--);
                    div.style.left = div.offsetLeft - n + 'px'
                }
            },
            10)
        },
        center: function(a) {
            if (a) {
                db.style.position = 'static';
                var b = getS();
                div1.style.display = "block";
                div1.style.margin = ( - div1.offsetHeight / 2 + b.t) + "px " + ( - div1.offsetWidth / 2 + b.l) + "px";
                list = d.getElementById('ckelist');
                clist = list.cloneNode(true);
                as = clist.getElementsByTagName('input');
                for (var i = 0,
                ci; ci = as[i++];) {
                    texts[ci.value] = ci.parentNode
                };
                with(iframe.style) {
                    left = top = '50%';
                    width = div1.offsetWidth + 'px';
                    height = div1.offsetHeight + 'px';
                    margin = div1.style.margin;
                    display = 'block'
                }
            }
        },
        choose: function(o) {
            clearTimeout(inputTimer);
            inputTimer = setTimeout(function() {
                var s = o.value.replace(/^\s+|\s+$/, ''),
                frag = d.createDocumentFragment();
                for (var p in texts) {
                    eval("var f = /" + (s || '.') + "/ig.test(p)");
                    f && frag.appendChild(texts[p].cloneNode(true))
                }
                list.innerHTML = '';
                list.appendChild(frag)
            },
            100)
        },
        centerClose: function() {
            iframe.style.display = div1.style.display = 'none'
        }
    };
    if (ie) {
        div.onmouseleave = $CKE.out;
        d.attachEvent("onclick", $CKE.disappear)
    } else {
        div.onmouseout = function(e) { ! (this === e.relatedTarget || (this.contains ? this.contains(e.relatedTarget) : this.compareDocumentPosition(e.relatedTarget) == 20)) && $CKE.out.call(this)
        };
        d.addEventListener("click", $CKE.disappear, false)
    }; (conf.move == 'roll' || /msie 6/i.test(na)) && loop()
} ();
function jiathis_sendto(a) {
    var e = encodeURIComponent,
    conf;
    try {
        conf = jiathis_config
    } catch(err) {
        conf = {}
    };
    if (a == 'renren'){
         window.open('http://share.renren.com/share/buttonshare.do?link='+e(conf.url || location)+'&title='+e(conf.title || document.title), '');
    }
    else if(a == 'tsina'){
         window.open('http://v.t.sina.com.cn/share/share.php?url='+e(conf.url || location)+'&title='+e(conf.title || document.title)+'&source=bookmark', '');
    }
    else if(a == 'baidu'){
         window.open('http://cang.baidu.com/do/add?it='+e(conf.title || document.title)+'&iu='+e(conf.url || location)+'&fr=ien#nw=1', '');
    }
    else if(a == 'douban'){
         window.open('http://www.douban.com/recommend/?url='+e(conf.url || location)+'&title='+e(conf.title || document.title), '');
    }
    else if(a == 'qq'){
         window.open('http://shuqian.qq.com/post?from=3&title='+e(conf.title || document.title)+'&uri='+e(conf.url || location)+'&jumpback=2&noui=1', '');
    }
    else if(a == 'sohu'){
         window.open('http://bai.sohu.com/share/blank/add.do?link='+e(conf.url || location), '');
    }
    
    
        else  if (a == 'kaixin001'){
         window.open('http://www.kaixin001.com/repaste/bshare.php?rurl='+e(conf.url || location)+'&rtitle='+e(conf.title || document.title)+ '&rcontent='+e(conf.url || location), '');
    }
    
/*    else{
        window.open('http://www.jiathis.com/send/?webid=' + a + '&url=' + e(conf.url || location) + '&title=' + e(conf.title || document.title) + (conf.un ? '&un=' + conf.un: ''), '');
    }*/
    return false
};
function jt_copyUrl() {
    var a = this.location.href;
    var b = document.title;
    if (window.clipboardData) {
        var c = b + "\n" + a;
        var d = window.clipboardData.setData("Text", c);
        if (d) alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友！")
    } else {
        alert("目前只支持IE，请复制地址栏URL,推荐给你的QQ/MSN好友！")
    }
};
function jt_addBookmark(a) {
    var b = parent.location.href;
    if (window.sidebar) {
        window.sidebar.addPanel(a, b, "")
    } else if (document.all) {
        window.external.AddFavorite(b, a)
    } else if (window.opera && window.print) {
        return true
    }
}
