﻿function jsAction(parameter)
{
    var url="../jsAction.ashx?"+parameter+"&rnd=" + Math.floor(Math.random()*9999+1);
    var xmlHttp;
    try
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e)
    {
        xmlHttp = new XMLHttpRequest();
    }
    xmlHttp.open("get",url,true);
    xmlHttp.send();
    xmlHttp.onreadystatechange = function()
    {
        if(xmlHttp.readyState == 4)
        {
            if(xmlHttp.status == 200)
            {
                switch (xmlHttp.responseText)
                {
                    case "0":
                    alert('新增好友失敗！');
                    break;
                    case "1":
                    alert('新增好友成功！');
                    break;
                    case "00":
                    alert('新增黑名單失敗！');
                    break;
                    case "11":
                    alert('新增黑名單成功！');
                    break;
                    case "success":
                    alert('檢舉不當訊息完成。');
                    break;
                    case "fail":
                    alert('請不要重複檢舉，謝謝！');
                    break;
                }
            }
        }
    }
}

function changeSMSflag(n)
{
    var xmlHttp;
    try
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e)
    {
        xmlHttp = new XMLHttpRequest();
    }
    var url="../jsAction.ashx?ActionType=jsAction_changeSMS&SMS_flag="+n+"&md="+Math.floor(Math.random()*9999+1);
    xmlHttp.open("get",url,true);
    xmlHttp.send();
    xmlHttp.onreadystatechange = function()
    {
        if(xmlHttp.readyState == 4)
        {
            if(xmlHttp.status == 200)
            {
                document.getElementById("smsStatus").innerHTML=xmlHttp.responseText;
            }
        }
    }
}

				function jianJu(toUserid,InfoID,InfoType,WebSite) {
					 if( confirm('如果您是討厭此人，不想收取相關信件，建議可將此人加入黑名單，並將信件删除\n若您確認為不良訊息，請您按下確定，客服人員即為您受理。'))
					 {	
					  jsAction('ActionType=addJianJu&toUserid='+toUserid+'&InfoID='+InfoID+'&InfoType='+InfoType+'&WebSite='+WebSite);
					 }
				}
