// JavaScript Document
function getnews(id){
	showScreen();
	contentObj = document.getElementById("newsdetail");
	url = "doinfo.php?doinfo=getnews&id="+id;
	if(window.XMLHttpRequest){
		list = new XMLHttpRequest();
		list.onreadystatechange = processChech;
		list.open("GET",url,true);
		list.send(null);
	}else{
		list = new ActiveXObject("Microsoft.XMLHTTP");
		if(list){
			list.onreadystatechange = processChech;
			list.open("GET",url,true)
			list.send(null);
		}
	}
}

function processChech() {
	if (list.readyState == 4) {
		if (list.status == 200) {
			contentObj.innerHTML = list.responseText;
		}
	}
}

function userlogin(username,password){
	showScreen();
	contentObj = document.getElementById("newsdetail");
	url = "doinfo.php?doinfo=userlogin&username="+username+"&password="+password;
	if(window.XMLHttpRequest){
		list = new XMLHttpRequest();
		list.onreadystatechange = processChech2;
		list.open("GET",url,true);
		list.send(null);
	}else{
		list = new ActiveXObject("Microsoft.XMLHTTP");
		if(list){
			list.onreadystatechange = processChech2;
			list.open("GET",url,true)
			list.send(null);
		}
	}
}

function processChech2() {
	if (list.readyState == 4) {
		if (list.status == 200) {
			if(list.responseText=="no"){
				alert("用户名或密码不正确");
			}else{
				contentObj.innerHTML = list.responseText;
			}
		}
	}
}

function getnews2(id){
	showScreen();
	contentObj = document.getElementById("newsdetail");
	url = "doinfo.php?doinfo=getnews2&id="+id;
	if(window.XMLHttpRequest){
		list = new XMLHttpRequest();
		list.onreadystatechange = processChech3;
		list.open("GET",url,true);
		list.send(null);
	}else{
		list = new ActiveXObject("Microsoft.XMLHTTP");
		if(list){
			list.onreadystatechange = processChech3;
			list.open("GET",url,true)
			list.send(null);
		}
	}
}

function processChech3() {
	if (list.readyState == 4) {
		if (list.status == 200) {
			contentObj.innerHTML = list.responseText;
		}
	}
}


function getWidth()
{
    var strWidth,clientWidth,bodyWidth;
    clientWidth = document.documentElement.clientWidth;
    bodyWidth = document.body.clientWidth;
    if(bodyWidth > clientWidth){
        strWidth = bodyWidth + 20;
    } else {
        strWidth = clientWidth;
    }
    return strWidth;
}
//获取高度
function getHeight()
{
    var strHeight,clientHeight,bodyHeight;
    clientHeight = document.documentElement.clientHeight;
    bodyHeight = document.body.clientHeight;
    if(bodyHeight > clientHeight){
        strHeight = bodyHeight + 30;
    } else {
        strHeight = clientHeight;
    }
    return strHeight;
}
// 锁屏
function showScreen()
{
    var Msg = document.getElementById('Message');
    var Bg = document.getElementById('Screen');
    Bg.style.width = getWidth()+'px';
    Bg.style.height = getHeight()+'px';
    document.getElementById('Message').style.left=(document.body.clientWidth/2)-400+"px"; // alert(screen.height/2-240);
    document.getElementById('Message').style.top=screen.height/2-350+"px";
    Msg.style.display = 'block';
    Bg.style.display = 'block';
}
//解屏
function hideScreen()
{
	contentObj = document.getElementById("Message");
	contentObj.innerHtml = "";
    var Msg = document.getElementById('Message');
    var Bg = document.getElementById('Screen');
    Msg.style.display = 'none';
    Bg.style.display = 'none';
}