﻿function doZoom(size){
	document.getElementById('textbody').style.fontSize=size+'px'
}
function havebg(ss,ttclassbg)
{document.getElementById(ss).className=ttclassbg;
}	
function havenobg(ss,ttclassnobg)
{document.getElementById(ss).className=ttclassnobg;
}

function $(id) {
    return document.getElementById(id);
}

function showMenu (baseID, divID) {
    baseID = $(baseID);
    divID  = $(divID);

    //var l = GetOffsetLeft(baseID);
    //var t = GetOffsetTop(baseID);

    //divID.style.left = l + 'px';
//    divID.style.top = t + baseID.offsetHeight + 'px';
    if (showMenu.timer) clearTimeout(showMenu.timer);
	hideCur();
    divID.style.display = 'block';
	showMenu.cur = divID;

    if (! divID.isCreate) {
        divID.isCreate = true;
        //divID.timer = 0;
        divID.onmouseover = function () {
            if (showMenu.timer) clearTimeout(showMenu.timer);
			hideCur();
            divID.style.display = 'block';
        };

        function hide () {
            showMenu.timer = setTimeout(function () {divID.style.display = 'none';}, 1000);
        }

        divID.onmouseout = hide;
        baseID.onmouseout = hide;
    }
	function hideCur () {
		showMenu.cur && (showMenu.cur.style.display = 'none');
	}
}

function trim(s) {
 return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}


    //ajax试验
    var xmlHttp = null;
    function fanhui()
    {
        $("cuowu").innerHTML = "";
    	var msg = trim(document.getElementById('msg').value);
    	if (msg == "")
    	{ 
    	    alert ("请填写有意义的评论！");
    	    return false;
    	}
	    var arcID = document.getElementById('arcID').value;
	    var username = trim(document.getElementById('username').value);
	    var pwd   = trim(document.getElementById('pwd').value);
	    var checkbox = document.getElementById('notuser');
    	if(checkbox.checked)
	        var notuser = 1;
        else
	        var notuser = 0;

        try
        {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e2)
            {
                xmlHttp = new XMLHttpRequest();  
                //alert("用了么?");
            }
        }
        var tempID = 0;
        params="action=send&arcID="+arcID+"&msg="+ escape(msg) +"&username="+username
				+"&pwd="+pwd+"&notuser="+notuser;

        xmlHttp.open("GET","pinglun.ashx?"+params,true);
        //xmlHttp.setRequestHeader("Content-type", "text/html;charset=utf-8");
        //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
        
        //xmlHttp.setRequestHeader("Content-type", "text/html;charset=gb2312");	
		xmlHttp.setRequestHeader("If-Modified-Since","0");	
		//xmlHttp.setRequestHeader("Content-length", params.length);
		//xmlHttp.setRequestHeader("Connection", "close");

        xmlHttp.onreadystatechange = OnHandler;
        xmlHttp.send(null);//一定要填写null，这样firefox才能工作正常
    }
    
    function OnHandler()
    {
        if (xmlHttp.readyState==4)
        {
        var tttt = xmlHttp.responseText;
        if (tttt == "0")
        {
            var cuowu = document.getElementById("cuowu");
            cuowu.innerHTML = "<b style='color:red'>用户名或密码错误！！<b>";
        }
        else
            {
                var div1 = document.getElementById("fedbk");
                div1.innerHTML = tttt;
            }
        }
    }
    
    function ajaxPinglun()
    {

	    var arcID = document.getElementById('arcID').value;

        try
        {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e2)
            {
                xmlHttp = new XMLHttpRequest();  
            }
        }
        var tempID = 0;
        params="action=show&arcID="+arcID;

        xmlHttp.open("GET","pinglun.ashx?"+params,true);
        //xmlHttp.setRequestHeader("Content-type", "text/html;charset=utf-8");
        //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
        
        //xmlHttp.setRequestHeader("Content-type", "text/html;charset=gb2312");	
		xmlHttp.setRequestHeader("If-Modified-Since","0");	
		//xmlHttp.setRequestHeader("Content-length", params.length);
		//xmlHttp.setRequestHeader("Connection", "close");

        xmlHttp.onreadystatechange = OnHandler;
        xmlHttp.send(null);//一定要填写null，这样firefox才能工作正常

    
    }
    
    
    

