//获取ID
function $id(id){
	return document.getElementById(id);
	}
function ShowMsg(){
	document.writeln("<div id=\"msgdiv\" style=\"position:absolute;display:none;\"><\/div>");
	document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\">");
	document.writeln("<\/div>");
	//回调函数
	this.ok_callback=function(){};
	this.cancel_callback=function(){};
	this.msgobjname=""
	this.show=function(){
		var tempobj1=$id("msgdiv");
		var tempobj2=$id("overdiv");
		var msgobj=this.msgobjname;
  		tempobj2.style.filter="alpha(opacity=75)";
  		tempobj2.style.MozOpacity = 75/100;
    	tempobj2.style.backgroundColor = "#000000";
	  	tempobj2.style.display = '';
    	tempobj2.style.zIndex= 1000;
    	tempobj2.style.height= document.documentElement.clientHeight+1000+"px";
    	tempobj2.style.width= document.documentElement.clientWidth+"px";
			tempobj2.style.left=0;
			tempobj2.style.top=0;
			tempobj1.style.display="none";
    	tempobj1.style.left= (document.documentElement.clientWidth)/3+"px";
    	tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/3)+"px";
    	tempobj1.style.display= '';
    	tempobj1.style.width=280+"px";
    	tempobj1.style.zIndex= 2000;
    	var OutStr;

		OutStr="<div class=\"msg_login\" canmove=\"true\" forid=\"msgdiv\"><h1><label>"+"请登陆"+"</label><a href=\"javascript:"+msgobj+".cancel()\"><img src=\"/images/closs.gif\" /></a></h1><form action='/login.php?action=process' method=\"post\" name=\"register2\" id=\"register2\"><input type=\"hidden\" name=\"action\" value=\"login\" /><p><label>"
		OutStr=OutStr+"帐 号："+"</label><input name=\"username\" type=\"text\" class=\"msginp\"/></p><p><label>"
		OutStr=OutStr+"密 码："+"</label><input name=\"password\" type=\"password\" class=\"msginp\"/></p><p><label>"
		OutStr=OutStr+"验证码："+"</label><input name=\"code\" type=\"text\" class=\"msginp2\"/><span class=\"div_yz\"></span></p>"
		OutStr=OutStr+"<p class=\"mbns\" align=\"center\"><input type=\"image\" src=\"/images/bn_mdl.gif\" alt=\"登陆\" border=\"0\" /><a href=\"http://www.svcn.com.cn/register\"><img src=\"/images/bn_mzc.gif\" alt=\"注册\" /></a><a href=\"/login/forgetpassword.php\"><img src=\"/images/bn_mwjmm.gif\" alt=\"忘记密码\" /></a></p></form>"
    	OutStr=OutStr+"</div>"
    	
    	tempobj1.innerHTML=OutStr;
    	var md=false,mobj,ox,oy
     	document.onmousedown=function(ev)
     	{
			var ev=ev||window.event;
			var evt=ev.srcElement||ev.target;
         	if(typeof(evt.getAttribute("canmove"))=="undefined")
         	{
            	 return;
         	}
         	if(evt.getAttribute("canmove"))
         	{
             	md = true;
             	mobj = document.getElementById(evt.getAttribute("forid"));
             	ox = mobj.offsetLeft - ev.clientX;
             	oy = mobj.offsetTop - ev.clientY;
         	}
     	}
     	document.onmouseup= function(){md=false;}
     	document.onmousemove= function(ev)
     	{
			var ev=ev||window.event;
         	if(md)
         	{
             	mobj.style.left= (ev.clientX + ox)+"px";
             	mobj.style.top= (ev.clientY + oy)+"px";
         	}
     	}
		}
		this.ok = function()
		{
			$id('msgdiv').style.display='none';
			$id('overdiv').style.display='none';
			this.ok_callback();
		}
		this.cancel=function(){
			$id('msgdiv').style.display='none';
			$id('overdiv').style.display='none';
			this.cancel_callback();
		}
	}

var ShowMsgo=new ShowMsg();
//设置对象名,供内部引用
ShowMsgo.msgobjname="ShowMsgo";
//定义回调函数
ShowMsgo.ok_callback=function(){}
ShowMsgo.cancel_callback=function(){document.location.href="/";}

