﻿
function setLocation()
{
    var expdate = new Date();
    expdate = expdate.addDays(7);
    Cookies.setValue("LastLocation", window.location.href, expdate);
}

function setTab(id)
{
    var dvs = $("TP" + id);
    if (dvs.style.display != "none")
    {
        return;
    }
    else
    {
        var obj = $("Li" + id);
        obj.className = "tc_Li_Atd";
        obj.getElementsByTagName("span")[0].className = "tc_Span1_Atd";
        obj.getElementsByTagName("label")[0].className = "tc_Label_Atd";
        obj.getElementsByTagName("span")[1].className = "tc_Span2_Atd";

        var pa = $("Tab");
        var cur = pa.getAttribute("va");

        var old = $("Li" + cur);
        old.className = "tc_Li";
        old.getElementsByTagName("span")[0].className = "tc_Span1";
        old.getElementsByTagName("label")[0].className = "tc_Label";
        old.getElementsByTagName("span")[1].className = "tc_Span2";

        $("TP" + cur).style.display = "none";
        dvs.style.display = "inline-block";
        pa.setAttribute("va", id);
    }
}

function focus_ipt()
{
    if ($V("V_Key").trim() == "请输入关键字")
    {
        $("V_Key").value = "";
    }
}

function blur_ipt()
{
    if ($V("V_Key").trim() == "")
    {
        $("V_Key").value = "请输入关键字";
    }
}

function searchVote()
{
    var val = $V("V_Key").trim();
    if (val == null || val == "" || val == "请输入关键字")
    {
        TopView.v.KeyWord = null;
    }
    else
    {
        TopView.v.KeyWord = val;
    }
    TopView.v.InfoID = $("V_Type").getAttribute("val");
    if (TopView.v.InfoID == null || TopView.v.InfoID == "")
    {
        TopView.v.InfoID = "1";
    }
    TopView.render();
}

function closeBox()
{
    box.Close();
}

function showBox(mes)
{
    $("MesInfo").innerHTML = mes;
    box.Show();
}

function sendVote(id)
{
    var res = Vxun.BL.MBR.Space.AddVoteInfo(id);
    if (res.error != null)
    {
        showBox(res.error.Message);
        return;
    }
    TopView.render();
    showBox(res.value);
}

function sendWeibo(title, url)
{
    window.open("http://v.t.sina.com.cn/share/share.php?title=" + encodeURIComponent(title) +
        "&url=" + encodeURIComponent(url));
}

function setMSOver(id)
{
    if ($("RW" + id).value == "0")
    {
        $("RW" + id).value = "1";
        $("RWO" + id).style.display = "none";
        $("RWI" + id).style.display = "block";
    }
}

function setMSOut(id)
{
    if ($("RW" + id).value == "1")
    {
        $("RW" + id).value = "0";
        $("RWI" + id).style.display = "none";
        $("RWO" + id).style.display = "block";
    }
}

var box = new LightBox("idBox");
