var dg_ajax=new dialog();

function dialog()
{
	this.mgTop = 10;
	this.mgLeft = "-20px";
	this.dg_bgColor = '#FFBDED';
    this.width=450;
    this.height=360;
    this.title_height=20;
    this.html='';
    this.title='';
    var self = this;
    var bgObj,msgObj,titleObj;
    this.close=function()
    {
    	optionView();
        document.body.removeChild(document.getElementById("bgDiv")); 
        document.body.removeChild(document.getElementById("msgDiv"));         
    }

    this.show=function()
    {
        var msgw,msgh,bordercolor; 
        msgw=self.width;
        msgh=self.height;
        bordercolor=self.dg_bgColor;
        //ordercolor="#ffffff";
        
        var sWidth,sHeight; 
        sWidth=document.body.offsetWidth; 
        sHeight=getScrollHeight(); 
        bgObj=document.createElement("div"); 
        bgObj.setAttribute('id','bgDiv'); 
        bgObj.style.position="absolute"; 
        bgObj.style.top="0"; 
        bgObj.style.background="#FBEFEF"; 
        bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
        bgObj.style.opacity="0.6"; 
        bgObj.style.left="0"; 
        bgObj.style.width=sWidth + "px"; 
        bgObj.style.height=sHeight + "px"; 
        bgObj.style.zIndex = "10000"; 
        document.body.appendChild(bgObj); 
        
        msgObj=document.createElement("div") 
        msgObj.setAttribute("id","msgDiv"); 
        msgObj.setAttribute("align","center"); 
        msgObj.style.background="#ffffff";    //上下文本背景色 
        //msgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50)"; 
        msgObj.style.border="1px solid " + bordercolor; 
        msgObj.style.position = "absolute"; 
        msgObj.style.left = "60%"; 
        msgObj.style.top = getScrollTop()+200; 
        msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
        msgObj.style.marginLeft = self.mgLeft ; 
        msgObj.style.marginTop = self.mgTop+document.documentElement.scrollTop+"px"; 
        msgObj.style.width = msgw + "px"; 
        msgObj.style.height =msgh + "px"; 
        msgObj.style.textAlign = "center"; 
        msgObj.style.lineHeight ="25px"; 
        msgObj.style.zIndex = "10001"; 
        
        
        //titleObj.onclick=function(){self.close();} //alpha(opacity=50)
        document.body.appendChild(msgObj); 
        var txt=document.createElement("div"); 
        txt.style.margin="1em 0" 
        txt.setAttribute("id","msgTxt"); //filter:alpha(opacity=50);//
       // txt.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50)"; 
        txt.style.background="#ffffff"; 	//中间文本背景色 
        txt.innerHTML=self.html; 
        document.getElementById("msgDiv").appendChild(txt); 
    }
}


//显示所有下拉框
function optionView(){
	var obj = document.getElementsByTagName("select");
	for(var i=0;i<obj.length;i++){
		obj[i].style.display = "inline";
	}	
}

function getScrollTop()  {     
 var t;          
 if (document.documentElement && document.documentElement.scrollTop) {   
   t = document.documentElement.scrollTop;     
 } else if (document.body) {         
  t = document.body.scrollTop;      
 } 
 return t; 
}  

function getScrollHeight()  {     
 var h;          
 if (document.documentElement && document.documentElement.scrollTop) {   
   h = document.documentElement.scrollHeight;    
 } else if (document.body) {         
 	h = document.body.scrollHeight;    
 } 
 return h; 
}  

function msgBox(msg,tag){
	var dg=new dialog();
	dg.html="<font color=red style=\" font-family: 宋体; font-size: 10pt; font-style: bold;\">"+msg+"</font><br><br><input type=button onclick='new dialog().close();' value=' O K ' style=\"border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt; font-style: bold;\">";
	dg.width=220;
	dg.height=100;
	dg.title=tag;
	dg.show();    
	optionValid();
}

function ViewDg(msg){
		dg_ajax.html="<div id='MsgView' onclick='new dialog().close();'>"+msg+"&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"image\"  src=\"/images/ccc_03.gif\" onclick='new dialog().close();'/></div>";
		dg_ajax.width=220; dg_ajax.height=30; dg_ajax.show();
}

//提示消息
function viewObj(n,msg,style,valid){
        // alert("Msg"+n);
		var obj = document.getElementById("Msg"+n);
		obj.innerHTML = msg;
		obj.className=style;
		obj.style.display=valid;
}

//检查Email	
function CommonCheckemail(email) {
	var emailStr=email;
	var emailPat=/^(.+)@(.+)$/;
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		 return false;
	}
	return true;
}
//清除错误信息
function disErrorInfo(n){
	var obj = document.getElementById("Msg"+n);
	obj.innerHTML="";
	obj.style.display="none";
}