
//===============================================================


//下面生成div

var x0=0,y0=0,x1=0,y1=0; 
var offx=6,offy=6; 
var moveable=false; 
var hover='blue',normal='black';//normal边框及其他
var index=100;//z-index; 
var os = null;



//创建一个对象; 
function xWin(id,w,h,tit,msg) 
{ 
this.id = id; 
this.width = w; 
this.height = h; 
this.zIndex = index; 
this.title = tit; 
this.message = msg; 
this.obj = null; 
this.bulid = bulid; 
this.bulid(); 
} 
//初始化; 
function bulid(){ 

var str = "" 
+ "<div id='xMsg" + this.id + "'" 
+ "style='" 
+ "z-index:" + this.zIndex + ";" 
+ "width:" + this.width + "px;" 
//+ "height:" + (this.height+3) + "px;"  
+ "background-color:" + normal + ";" 
+ "color:" + normal + ";" 
+ "font-size:9pt;" 
+ "text-align: left;"
+ "font-family:Tahoma;" 
+ "display:none;" 
+ "position:absolute;" 
+ "cursor:default;" 
+ "border:2px solid " + normal + ";" 
+ "'>" 
+ "<div id='tit"+this.id+"' "
+ "style='" 
+ "background-color:" + normal + ";" 
+ "width:" + (this.width-3) + "px;" 
+ "height:19px;" 
+ "text-align:right;"
+ "color:white;" 
+ "'>" 
+ "<span class='close' style='width:12px;border-width:0px;color:white;' onclick='ShowHide(\""+this.id+"\",null)'>X</span>" 
+ "</div>" 
+ "<div id='msg"+this.id+"' style='" 
+ "width:"+(this.width-8)+"px;" 
//+ "height:" + (this.height-20-4) + "px;" 
+ "background-color:white;" 
+ "line-height:14px;" 
+ "padding:4px;" 
+ "'>" + this.message + "</div>" 
+ "</div>";

//alert(str);
$(str).appendTo("body");

} 




//显示隐藏窗口 
function ShowHide(id,dis){ //null & none	
	//alert(document.getElementById("xMsg"+id));
	var bdisplay = (dis==null)?((document.getElementById("xMsg"+id).style.display=="")?"none":""):dis ;
	document.getElementById("xMsg"+id).style.display = bdisplay;  
}








//=========================================================
//鼠标悬停颜色变换

	var over = "navajowhite";		//鼠标悬停颜色
	var out = "blanchedalmond";	//鼠标离开颜色
	
	function change(id,mark){	//text 原内容 mark标记en为英文，ch为中文
		var div = document.getElementById(id);
		var text = div.innerHTML;
		var t = null;
		var total = "";//最后形式
		if(mark == "en")	//根据不同语言分割字符串
			t = text.split("."); 
		else
			t = text.split("。"); 
		if(mark == "en")
			for(var i = 0 ; i < t.length-1 ; i++){
				total = total + "<span id='"+i+"e' onmouseover='overColor("+i+")' onmouseout='outColor("+i+")'>"+t[i]+"</span>.";
			}
		else
			for(var i = 0 ; i < t.length-1 ; i++){
				total = total + "<span id='"+i+"c' onmouseover='overColor("+i+")' onmouseout='outColor("+i+")'>"+t[i]+"</span>。";	
			}
		//alert(total);
		document.getElementById(id).innerHTML = total;
	}
	
	function overColor(id){	//鼠标悬停背景颜色变换
		var ch = document.getElementById(id+"c");//得到<span>
		var en = document.getElementById(id+"e");
		if(ch){
			ch.style.backgroundColor = over;
		}
		if(en){
			en.style.backgroundColor = over;
		}	
	}
	
	function outColor(id){	//鼠标离开背景颜色还原
		var ch = document.getElementById(id+"c");
		var en = document.getElementById(id+"e");
		if(ch){
			//ch.style.fontSize = "16px";
			ch.style.backgroundColor = out;
		}
		if(en){
			en.style.backgroundColor = out;
			//en.style.fontSize = "16px";
		}
	}







//===========================================================================
//div居中



function setCenter(id){
	var frm = $(id);//设置需要居中的div
	var arrayPageScroll = getPageScroll();
	var arrayPageSize = getPageSize();
	var frmLeft = (arrayPageSize[2] - frm.width()) / 2;
	var frmTop = arrayPageScroll[1] + ((arrayPageSize[3]  - frm.height())/ 4);
	frm.css("left",frmLeft + "px");
	frm.css("top",frmTop + 'px');
}






//问题的关键在于判别不同的游览器
function getPageScroll(){
		var yScroll;

		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			yScroll = document.documentElement.scrollTop;
		} else if (document.body) {
			yScroll = document.body.scrollTop;
		}

		arrayPageScroll = new Array('',yScroll) 
		return arrayPageScroll;
}


function getPageSize(){
		
		var xScroll, yScroll;
	
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ 
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { 
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		if (self.innerHeight) {	
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { 
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { 
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}

		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}

		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
}




		
		
		






//list页面操作js
//=====================================================================================

function opertion(id){
			
			id = "#"+id;
			var which = $(id).attr("accesskey")+$("#lang").val();	
			//alert(which);
			$(".alert_content").load('learning/files/'+which+'.asp',function(){ //加载正文	
					//alert('html..');
					$.getScript('learning/files/'+which+".js",function(){	//加载js文件
						//alert('script..');
						//这一步时所有内容都已加载完毕
						setCenter(".alert");
						jQuery(".popUp,.alert").show();//两个层显示
					});			  			   			     
			});
		}




jQuery(function($) {	
	

		jQuery("#close").click(function(){
			$("div[@id*=xMsg]").hide();
			jQuery(".popUp,.alert").hide();
			
		});

		jQuery(".close_image").click(function(){		//这里应该将这些元素销毁，而不是单纯地隐藏
			 
			 
			 //根据名称获得所有解释框div元素，隐藏
			 //找所有有id属性的div，如果值包含xMsg的就是匹配元素			 
			 $("div[@id*=xMsg]").hide();
			 jQuery(".popUp,.alert").hide();
		});
					
		

		/*
		 *	gene_therapy链接点击事件
		 */		
			
		 jQuery("#gene_therapy").click(function(){	//鼠标鼠标单击事件
			
			//通过文章名+语言得到具体哪篇文章	
			opertion("gene_therapy");
		 });			
				
		 jQuery("#prison").click(function(){
			opertion("prison");
		 
		 });		 

		 jQuery("#rent").click(function(){
			opertion("rent");
		 
		 });

		jQuery("#earthquake").click(function(){
			opertion("earthquake");
		 
		 });

		 jQuery("#message").click(function(){
			opertion("message");
		 
		 });

		 jQuery("#cyclone").click(function(){
			opertion("cyclone");
		 
		 });

		 
		jQuery("#volcano").click(function(){
			opertion("volcano");
		 
		 });

		 jQuery("#crash").click(function(){
			opertion("crash");
		 
		 });

		 
		jQuery("#suspect").click(function(){
			opertion("suspect");
		 
		 });

		 jQuery("#bee").click(function(){
			opertion("bee");
		 
		 });

		
		jQuery("#accident").click(function(){
			opertion("accident");
		 
		});

		
		jQuery("#acccause").click(function(){
			opertion("acccause");
		 
		});

	
		jQuery("#women").click(function(){
			opertion("women");
		 
		});

		jQuery("#mistake").click(function(){
			opertion("mistake");
		 
		});

		jQuery("#lesbian").click(function(){
			opertion("lesbian");
		 
		});

		
		jQuery("#oilprice").click(function(){
			opertion("oilprice");
		 
		})

			
		jQuery("#shock").click(function(){
			opertion("shock");
		 
		})

			
		jQuery("#cgame").click(function(){
			opertion("cgame");
		 
		})
		
		jQuery("#farm").click(function(){
			opertion("farm");
		 
		})

		jQuery("#fire").click(function(){
			opertion("fire");
		 
		})

		jQuery("#fat").click(function(){
			opertion("fat");
		 
		})

		jQuery("#animal").click(function(){
			opertion("animal");
		 
		})
		
		jQuery("#control").click(function(){
			opertion("control");
		 
		})

		jQuery("#runaway").click(function(){
			opertion("runaway");
		 
		})
			
		jQuery("#family").click(function(){
			opertion("family");
		 
		})
		
		jQuery("#disaster").click(function(){
			opertion("disaster");
		 
		})
		
		jQuery("#oak").click(function(){
			opertion("oak");
		 
		})
		
		jQuery("#complaint").click(function(){
			opertion("complaint");
		 
		})
			
		
		jQuery("#flood").click(function(){
			opertion("flood");
		 
		})

		jQuery("#recovery").click(function(){
			opertion("recovery");
		 
		})
		
		jQuery("#pollution").click(function(){
			opertion("pollution");
		 
		})

		jQuery("#landing").click(function(){
			opertion("landing");
		 
		})

		jQuery("#kill").click(function(){
			opertion("kill");
		 
		})

		jQuery("#cost").click(function(){
			opertion("cost");
		 
		})	

		jQuery("#save").click(function(){
			opertion("save");
		 
		})

		jQuery("#alcohol").click(function(){
			opertion("alcohol");
		 
		})
			
		
	
		jQuery("#blasted").click(function(){
			opertion("blasted");
		 
		})

			
				
		jQuery("#Airreport").click(function(){
			opertion("Airreport");
		 
		})
		
		
		jQuery("#lonely").click(function(){
			opertion("lonely");
		 
		})

		jQuery("#fugu").click(function(){
			opertion("fugu");
		 
		})

		jQuery("#emergency").click(function(){
			opertion("emergency");
		 
		})

			
		
		jQuery("#murder").click(function(){
			opertion("murder");
		 
		})
			
		
		jQuery("#disturb").click(function(){
			opertion("disturb");
		 
		})

		jQuery("#checkin").click(function(){
			opertion("checkin");
		 
		})

		jQuery("#economy").click(function(){
			opertion("economy");
		 
		})
		
		jQuery("#awkward").click(function(){
			opertion("awkward");
		 
		})

		jQuery("#thief").click(function(){
			opertion("thief");
		 
		})
		
		jQuery("#moms").click(function(){
			opertion("moms");
		 
		})

		jQuery("#flood1").click(function(){
			opertion("flood1");
		 
		})

		jQuery("#marriage").click(function(){
			opertion("marriage");
		 
		})

		jQuery("#salmon").click(function(){
			opertion("salmon");
		 
		})

		jQuery("#strike").click(function(){
			opertion("strike");
		 
		})

		jQuery("#survey").click(function(){
			opertion("survey");
		 
		})

		jQuery("#plague").click(function(){
			opertion("plague");
		 
		})

		jQuery("#dying").click(function(){
			opertion("dying");
		 
		})

		jQuery("#travel").click(function(){
			opertion("travel");
		 
		})

		jQuery("#flying").click(function(){
			opertion("flying");
		 
		})
			

		jQuery("#attacked").click(function(){
			opertion("attacked");
		 
		})



		jQuery("#fire1").click(function(){
			opertion("fire1");
		 
		})

		jQuery("#npolo").click(function(){
			opertion("npolo");
		 
		})

					
		jQuery("#cling").click(function(){
			opertion("cling");
		 
		})	

			
		jQuery("#shopping").click(function(){
			opertion("shopping");
		 
		})
			
			
});





