﻿// JScript 文件
var xType;
//var userhost="219.136.247.204";
function myVote(eid, strType, flag, votetype)
{
    xType = strType;
    var id = "39_test_" + flag + "_" + eid + "_" + strType;
    
    //var textTitle2 =$("test_title2");
    //if (getcookie(id) == "")
    //{
        //setcookie(id, userhost, 120*60*1000, null, null, null);
       // load();
    //}
    /*else if (getcookie(id) == userhost)
    {
        alert("您投票太积极啦！");
        return;
    }*/
    

	var pathURL = "vote.asp?id=" + eid + "&type=" + strType + "&votetype=" + votetype;
	var req = newXMLHttpRequest();	
	if (req != null)
	{
        var handlerFunction = processVoteRequest(req);
	    req.onreadystatechange = handlerFunction;
	    req.open("GET", pathURL, true);
        req.setRequestHeader("Content-Type", "text/html;charset=utf-8;");
	    req.send(null);		
		//alert(pathURL);
	}
}

function processVoteRequest(req)
{
    return function ()
    {
        if (req.readyState == 4)
        {
            if (req.status == 200)
            {
                showVoteResult(req);
            }
        }
    }
}

function showVoteResult(req)
{
    if(req !=null)
    {
        var txt = req.responseText;
        var spnDown = $("spnDown");
        var spnInexact = $("spnInexact");
        var spnUp = $("spnUp");

        if(xType == 1)
        {
            spnUp.innerHTML = (parseInt(spnUp.innerHTML) + 1).toString();
        }
        else if (xType == 0)
        {
            spnDown.innerHTML = (parseInt(spnDown.innerHTML) + 1).toString();
        }
        else if (xType == 3)
        {
            spnInexact.innerHTML = (parseInt(spnInexact.innerHTML) + 1).toString();
        }
        alert(txt);
        
    }
}
 

