// JavaScript Document
var minwidth=1000;//页面实际宽度
var msgDivWidth=890;//msgDiv实际宽度
//获取ID
function ShowMsg(){
	document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\" ><\/div>");

	//回调函数
	this.ok_callback=function(){};
	this.cancel_callback=function(){};
	this.msgobjname=""
	this.show=function(id,lng){//标题，内容
		flagshow=true;
		var tempobj1=$id("detail");
		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.left= (parseInt(tempobj2.style.width)-msgDivWidth)/2+"px";	
    	tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/10)+"px";
		tempobj1.style.visibility='visible';
    	tempobj1.style.zIndex= 200;
		
		$id("detail_box").innerHTML='';
		contant='id='+id+'&lng='+lng+'&show=1&page=1';//post时的传输内容
    	send_request('read.php','post',contant);//接受页面,传输方法get\post,传输内
		
		
		//点击周围遮照也取消
		tempobj2.style.cursor='pointer';
		tempobj2.onclick=function(){ShowMsgo.ok();};		
	
	}
	this.ok = function()
	{
		flagshow=false;
		$id('detail').style.visibility='hidden';
		$id("detail_box").innerHTML='';
		img_stop();
		$id('overdiv').style.display='none';
		this.ok_callback();
	}
	this.cancel=function(){
		flagshow=false;
		$id('detail').style.visibility='hidden';
		$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("detail");
		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);
}