// JavaScript Document
var minwidth=910;//msgDiv实际宽度
var msgDivWidth=580;//msgDiv实际宽度
//获取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(baseUrl,imgUrl,title,lng){//标题，内容
		flagshow=true;
		var tempobj1=$id("msgdiv");
		var tempobj2=$id("overdiv");
		var msgobj=this.msgobjname;
		
		/*页面遮照*/
  		tempobj2.style.filter="alpha(opacity=75)";//ie透明
  		tempobj2.style.opacity = 75/100;//css3透明
    	tempobj2.style.backgroundColor = "#000000";
	  	tempobj2.style.display = '';
    	tempobj2.style.zIndex= 100;	
		tempobj2.style.left=0;
		tempobj2.style.top=0;
		tempobj2.style.height=document.documentElement.scrollHeight+"px";			 	 
		if(document.documentElement.clientWidth>minwidth){
			tempobj2.style.width= document.documentElement.clientWidth +"px";
		}else{
			tempobj2.style.width= minwidth +"px";
		}
		/*div*/		
		tempobj1.style.display="none";
    	tempobj1.style.left= (parseInt(tempobj2.style.width)-msgDivWidth)/2+"px";		
    	tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/10)+"px";
		tempobj1.style.display= '';
    	tempobj1.style.zIndex= 200;
		
		if(lng=='en'){
			msg='Close';
		}else if(lng=='cn'){
			msg='关闭';
		}
		
		/*div样式	*/	
    	var OutStr;
		OutStr='<table width="580" border="0" cellspacing="0" cellpadding="0"><tr><td height="12" background="images/all_linebg06.jpg"></td></tr><tr><td><img src="'+baseUrl+''+imgUrl+'" width="580" height="410" /></td></tr><tr><td height="50" background="images/all_linebg07.jpg"><table width="580" border="0" cellspacing="0" cellpadding="0"><tr><td width="14" align="left">&nbsp;</td><td width="15" align="left" valign="middle" ><img src="images/all_square.gif" width="5" height="5" /></td><td width="486" align="left" class="menu_large_info">'+title+'</td><td width="65" align="left" valign="middle"    class="menu_tips" onclick="'+msgobj+'.ok();"><span class="click_hander">'+msg+'</span> <img src="/images/all_close.gif" width="9" height="8" /></td></tr></table></td></tr><tr><td>&nbsp;</td></tr></table>';
    	
    	tempobj1.innerHTML=OutStr;
		
		//点击周围遮照也取消
		tempobj2.style.cursor='pointer';
		tempobj2.onclick=function(){ShowMsgo.ok();};		
	
	}
	this.ok = function()
	{
		flagshow=false;
		$id('msgdiv').style.display='none';
		$id('overdiv').style.display='none';
		this.ok_callback();
	}
	this.cancel=function(){
		flagshow=false;
		$id('msgdiv').style.display='none';
		$id('overdiv').style.display='none';
		this.cancel_callback();
	}
}

var ShowMsgo=new ShowMsg();
//设置对象名,供内部引用
ShowMsgo.msgobjname="ShowMsgo";
//定义回调函数
ShowMsgo.ok_callback=function(){
	//alert("ok");
	}
ShowMsgo.cancel_callback=function(){
	//alert("cancel")
	}

var flagshow=false;	
var flag=true;


//窗口大小改变时，同时改变遮照和div
function resize() 
{ 
	if(flagshow)
	{
		var tempobj1=$id("msgdiv");
		var tempobj2=$id("overdiv");
		tempobj2.style.height=document.documentElement.scrollHeight+"px";	
		if(document.documentElement.clientWidth>minwidth){
			tempobj2.style.width= document.documentElement.clientWidth +"px";
		}else{
			tempobj2.style.width= minwidth +"px";
		}			
    	tempobj1.style.left= ((parseInt(tempobj2.style.width)-msgDivWidth)/2)+"px";
		tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/10)+"px";
	}
}
if(window.attachEvent){
	 window.attachEvent("onresize",   resize);
}else if(window.addEventListener){
	 window.addEventListener('resize',   resize,  false);
}
