function $(_sId)
{return document.getElementById(_sId);}
  
function moveDiv(event, _sId)
{
	var oObj = $(_sId);	
	oObj.onmousemove = mousemove;
	oObj.onmouseup = mouseup;
	oObj.setCapture ? oObj.setCapture() : function(){};
	oEvent = window.event ? window.event : event;
	var dragData = {x : oEvent.clientX, y : oEvent.clientY};
	var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
   
	function mousemove()
	{
		var oEvent = window.event ? window.event : event;
		var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
		var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
		oObj.style.left = iLeft;
		oObj.style.top = iTop;
		dragData = {x: oEvent.clientX, y: oEvent.clientY};  
	}
   
	function mouseup()
	{
		var oEvent = window.event ? window.event : event;
		oObj.onmousemove = null;
		oObj.onmouseup = null;
		if(oEvent.clientX < 1 || oEvent.clientY < 1)
		{
			oObj.style.left = backData.y;
			oObj.style.top = backData.x;
		}
			oObj.releaseCapture ? oObj.releaseCapture() : function(){};
	}
}

function closeDiv(_sID)
{
	var oObj = $(_sID);
	var overlay = $("overlay");	
	if(overlay != null)
	{
		overlay.outerHTML = "";
	}
	oObj.style.display = "none";
	
}

function getPageWidth(){
	sWidth = document.body.scrollWidth;
	oWidth = document.body.offsetWidth;
	return (sWidth>oWidth)?sWidth:oWidth;
}

function getPageHeight(){
	sHeight = document.body.scrollHeight;
	oHeight = document.body.offsetHeight;
	return (sHeight>oHeight)?sHeight:oHeight;
}

function alertDiv(){
	var overlayDiv =document.createElement("div");
	overlayDiv.id = "overlay";
	overlayDiv.style.width=getPageWidth();
	overlayDiv.style.height=getPageHeight();
	document.body.appendChild(overlayDiv);

	var floatDiv =document.createElement("div");
	floatDiv.id = "floatDiv";
  floatDiv.style.width=360;
  floatDiv.style.height=260;
	xScroll = document.body.offsetWidth;
	yScroll = document.body.offsetHeight;

	floatDiv.style.top = (yScroll - 260) / 2;
	floatDiv.style.left = (xScroll - 360) / 2;
  document.body.appendChild(floatDiv);

	floatDiv.innerHTML = 
		'<div class="divTitle" onmousedown="moveDiv(event,\'floatDiv\');">' + 
		'	<div style="float:left; width:250px;"><b>\u79d1\u6559\u63a7\u4ef6\u6ce8\u518c\u5931\u8d25</b></div>' + 
		'	<div style="float:right;text-align:right; height:25px;" >' + 
		'		<a href="javascript:;" onclick="closeDiv(\'floatdiv\');"><img src="images/dragform/ico_close.gif" onmouseout="this.src=\'images/dragform/ico_close.gif\';" onmousemove="this.src=\'images/dragform/ico_close1.gif\';" align="absmiddle" alt="\u5173\u95ed" /></a> ' + 
		'	</div>		' + 
		'</div>' + 
		'<div class="divContent" >' + 
		'	\u611f\u8c22\u60a8\u8bbf\u95ee\u8bba\u575b\u3002\u76ee\u524d\u60a8\u6ca1\u6709\u5b89\u88c5\u79d1\u6559\u63a7\u4ef6\uff0c\u4f46\u8fd9\u4e0d\u4f1a\u5f71\u54cd\u60a8\u8bbf\u95ee\u8bba\u575b\uff1b\u82e5\u8981\u53d1\u8868\u6587\u7ae0\u53ca\u56de\u590d\uff0c\u5219\u60a8\u9700\u8981\u4e0b\u8f7d\u5b89\u88c5\u79d1\u6559\u63a7\u4ef6\u3002 <br>' + 
		'	\u8bf7\u4e0b\u8f7d\u5b89\u88c5\u79d1\u6559\u63a7\u4ef6<a href="http://www.eduoffice.com.cn/EduOfficeBBS/setup.exe">\u79d1\u6559\u63a7\u4ef6</a>\u3002' + 
		'	<br>' + 
		'	<br>' + 
		'	<br>' + 
		'</div>' + 
		//'<div class="divFoot">' + 
		//'	<input type="button" class="divButton" onclick="closeDiv(\'floatdiv\')" value="\u53d6 \u6d88" />' + 
		'</div> ' ;
}

function testEduofficeBBSControl(){
	
	
	var testeduofficebbs = document.createElement("OBJECT");
	testeduofficebbs.setAttribute("id","testeduofficebbs");
	testeduofficebbs.setAttribute("classid","CLSID:CCD0A58F-74A9-4E54-9873-AEDF5C8E20F2");
	testeduofficebbs.style.width=0;
	testeduofficebbs.style.height=0;
	document.body.appendChild(testeduofficebbs);
	
	/*
	var bbsobjdiv = document.createElement("div");
	bbsobjdiv.style.top = -100;
	bbsobjdiv.style.width=0;
	bbsobjdiv.style.height=0;
	bbsobjdiv.innerHTML = '<OBJECT ID=eduofficebbs CLASSID=CLSID:CCD0A58F-74A9-4E54-9873-AEDF5C8E20F2 codebase=http://www.eduoffice.com.cn/EduOffice40BBS/EduOffice40BBS.cab#version=4,0,7,0 width=0 height=0></OBJECT>';
	document.body.appendChild(bbsobjdiv);
	*/
	try{
		eduofficebbs_version = testeduofficebbs.ShowToolBar(1);
		testeduofficebbs.parentNode.removeChild(testeduofficebbs);
	} catch (e) {
    	eduofficebbs_state = false;
		alertDiv();
	}
}

setTimeout("testEduofficeBBSControl()",3000);