//页面一些小JS效果
//date:2010-3
//author:Stri
function runCode(obj)
{var code=obj.parentNode.childNodes[0];
var newwin=window.open('about:blank');
newwin.document.open();
newwin.document.write(code.value);
newwin.document.close();
}
function copyCode(obj) 
{var code=obj.parentNode.childNodes[0];
var rng = document.body.createTextRange();
rng.moveToElementText(code);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
function saveCode(obj) 
{var code=obj.parentNode.childNodes[0];
var winname = window.open('', '_blank', 'top=10000');
winname.document.open('text/html', 'replace');
winname.document.write(code.value);winname.document.execCommand('saveas','','http://striblog.com.html');
winname.close();}
function reset_big(obj) {

    obj.style.height = "150px";
    obj.style.overflowY = "auto";
    obj.style.borderTop = "1px solid #ccc";
}
function text_copy(text, te) {
    if (document.all) {
        clipboardData.setData('text', text);
        alert(te);
    } else if (prompt('非常抱歉!\n您需要手动复制(请用ctrl+c实现复制).\n(Sorry!You must shoudong copy!)', text)) {
        alert(te);
    }
}
//引用代码
function c_o_code(ob) {
    var obj = ob.parentNode.nextSibling;
    var obj_a = ob.parentNode.childNodes[0];
    obj_a.style.display = (obj.style.display == "block") ? "none": "block";
    obj.style.display = (obj.style.display == "block") ? "none": "block";

    ob.className = (obj.style.display == "block") ? "code_o": "code_c";
}

function copyCode_code(obj) {
    var code = obj.parentNode.parentNode.childNodes[1];

    if (document.all) {
        var rng = document.body.createTextRange();
        rng.moveToElementText(code);
        rng.scrollIntoView();
        rng.select();
        rng.execCommand("Copy");
        rng.collapse(false);
    }
    else {
        alert("你的游览器不支持此功能,你需要手动复制!^^")
    }
}