var xmlHttp;
function createXMLHttp(){
    if (window.ActiveXObject) {
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e1) {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
//建立主过程
function startXMLHttp(objname,sendurl){
    createXMLHttp(); //建立xmlHttp 对象
    if (xmlHttp){
        xmlHttp.onreadystatechange=function(){
	    if(xmlHttp.readyState==4)
		{
		if(xmlHttp.status==200){
		    document.getElementById(objname).innerHTML=xmlHttp.responseText;
			}else{
			document.getElementById(objname).innerHTML='获取数据失败';
			}
		}
	}
        xmlHttp.open("get",sendurl,true); //传送方式 读取的页面 异步与否
        xmlHttp.send(null); //发送
    }
    else
        {
            document.getElementById(objname).innerHTML='不支持ajax';
        }

}

function obj_getbyid(id) {
	itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all)	{
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}
	return itm;
}

function userpageover(axd,username){
    document.getElementById(axd).style.display="block";
    startXMLHttp(axd,"ajax/checkuser.asp?username="+username+"&spanid="+axd);
}

function userpageout(axd){
    document.getElementById(axd).style.display="none";
}

function sendinfo(axd,username){
    document.getElementById(axd).style.display="block";
    startXMLHttp(axd,"ajax/sendinfo.asp?username="+username+"&spanid="+axd);
}
function closesendinfo(axd,username){
    document.getElementById(axd).style.display="none";
}

function forpage1(enterpage,urlstr) 
{ 
    window.location.href=urlstr+"_"+enterpage.value+".html";
}
function forpage2(enterpage,urlstr) 
{ 
    window.location.href=urlstr+"&page="+enterpage.value;
}

function kpost(boardid)
{
    startXMLHttp("kpost","ajax/kpost.asp?boardid="+boardid)
}
function kpost2(boardid)
{
    startXMLHttp("kpost","../../ajax/kpost.asp?boardid="+boardid)
}

function closekpost()
{
    kpostinfo=obj_getbyid("kpost");
    kpostinfo.innerHTML='';
}

function showmenu(menuid){
    eval(menuid+".style.display='';");
}
function showoutmenu(menuid){
    eval(menuid+".style.display='none';");
}

function newwindow(axd,url)
{
    document.getElementById(axd).style.display="block";
    startXMLHttp(axd,url)
}
function closewindow(axd)
{
    kpostinfo=obj_getbyid(axd);
    kpostinfo.innerHTML='';
    document.getElementById(axd).style.display="none";
}

function CheckOthers(form)
{
    for (var i=0;i<form.elements.length;i++)
    {
        var e = form.elements[i];
//        if (e.name != 'chkall')
            if (e.checked==false)
            {
                e.checked = true;// form.chkall.checked;
            }
            else
            {
                e.checked = false;
            }
    }
}

function CheckAll(form)
{
    for (var i=0;i<form.elements.length;i++)
    {
        var e = form.elements[i];
//        if (e.name != 'chkall')
            e.checked = true// form.chkall.checked;
    }
}

function CText()
{ tt=location.href;
clipboardData.setData('text',tt);
alert(location.href+' 网址已复制，粘贴给好友请按Crtl+V。');
}

function openScript(url, width, height){
 var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}

function bbsgood_img(e, o)
{
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom += event.wheelDelta / 12;
if (zoom > 0) o.style.zoom = zoom + '%';
return false;
}
