﻿    
    function Login()
    {
        var un = getv("ipt_Username");
        var pw = getv("ipt_Password");
        var rm = get("chk_Remember").checked;
        
        ZinSite.SiteMethods.Login(un, pw, rm, redirect);
    }
    
    function change_Date(url, date)
    {
        location.replace(url.replace("{0}", date));
    }
    
	function openUpdate(nid, tag)
	{	
		var d = get("NewsC" + nid);
		
		if (d.style.display == "" || d.style.display == "block")
			JumpTo("/html/" + tag + "_" + nid + "_1.html");
		else
			showDIV("NewsC" + nid);
	}
	
	function openReplay(nid)
	{
		if (tempid > 0 && nid != tempid)
			hideDIV("RepC" + tempid);
		
		tempid = nid;
		var d = get("RepC" + nid);
		
		if (d.style.display == "block")
			JumpTo("/html/Replay_" + nid + ".html");
		else
			showDIV("RepC" + nid);
	}
	
	function search_News(tag)
	{
		var keyword = getv("N_Keyword");
		
		location.replace("/html/" + tag + "_Search_" + keyword + "_1.html");	
	}
		
	function search_Replay()
	{
		var map = search_Replay_Query("RS_Map");
		var raceA = search_Replay_Query("RS_RaceA");
		var raceB = search_Replay_Query("RS_RaceB");
		var teamA = search_Replay_Query("RS_TeamA");
		var teamB = search_Replay_Query("RS_TeamB");
		var version = search_Replay_Query("RS_Version");
		
		location.replace("/html/Replay_Search_None_" + map + "_None_" + raceA + "_" + teamA + "_" + raceB + "_" + teamB + "_None_" + version + "_None_1.html");	
	}
	    
	function search_Replay_Query(n)
	{
	    var v = getv(n);
	    
	    if (v == "" || v == null)
	        return "None";
	        
	    return v;
	}
	    
    function submit_Comment(uid, id, pid, pt, site)
    {
    	var c = Trim(getv("txt_Comment"));
    	
    	if (c == "")
    	{
    		alert("请填写评论!");
    		return;
    	}
    	
    	Submitting(site);
    	ZinSite.SiteMethods.Submit_Comment(id, pid, pt, c, Submitted);
    }
        
    function Submitting(site)
    {
    	temp = get("div_SubmitComment").innerHTML;
    	get("div_SubmitComment").innerHTML = "<img src=\"/" + site + "/Images/Submitting.gif\" align=\"absmiddle\" />";
    }
	
	function Submitted(r)
	{
		get("div_SubmitComment").innerHTML = temp;
		
		if (finish(r))
		{
			get("txt_Comment").value = "";
			get("btn_Comment").disabled = true;
			alert("提交成功，1-60秒随机刷新。");
		}
	}
	
	function set_EmptyImage(img)
	{
	    img.src = "/Images/space.gif";
	    img.onerror = "";
	}
	
    function submit_CommentFilter(un)
    {
    	ZinSite.SiteMethods.Submit_CommentFilter(un, Deleted);
    }
	
	function white_Comment(pid, ro)
	{
		if (window.confirm("漂白这回合吗？"))
		{
			ZinSite.SiteMethods.White_Comment(pid, ro, Deleted);
		}
	}
    
	function black_Comment(pid, ro)
	{
		if (window.confirm("抹黑这回合吗？"))
		{
			ZinSite.SiteMethods.Black_Comment(pid, ro, Deleted);
		}
	}
	
	function Deleted(r)
	{
		if (finish(r))
			alert("操作成功");
	}
		
	function redirect(r)
	{
	    var url = getv("_ctl0_ipt_ReturnURL");
	    
	    location.replace(url);
	}
    