﻿	var dat=[{id:'1',title:'爱丁堡',html:'一个历史悠久、风景秀丽文化城市，依山傍水，地貌多姿，素有“北方雅典”之称，也是苏格兰',src:'images/intro1.jpg',href:'http://www.china-pt.cn/city/Edinburgh.aspx'},{id:'2',title:'格拉斯哥',html:'格拉斯哥是苏格兰最大的城市，坐落于克莱德河西岸。格拉斯哥人热情好客，幽默风趣，口音浓',src:'images/intro2.jpg',href:'http://www.china-pt.cn/city/Glasgow.aspx'},{id:'3',title:'湖区',html:'湖区位于英格兰西北海岸，1951年被划归为国家公园，是英国最著名的休假地， 被英国人称为',src:'images/intro3.jpg',href:'http://www.china-pt.cn/city/LakeDistrict.aspx'},{id:'4',title:'纽卡斯尔',html:'纽卡斯尔是英格兰北部的政治、商业和文化中心。纽卡斯尔人以其非凡的成就，独特的性格和口',src:'images/intro4.jpg',href:'http://www.china-pt.cn/city/Newcastle.aspx'},{id:'5',title:'贝尔法斯特',html:'贝尔法斯特是北爱尔兰的首府，也是拉根河入海口的重要港口。热情好客是贝尔法斯特人的传统',src:'images/intro5.jpg',href:'http://www.china-pt.cn/city/Belfast.aspx'},{id:'6',title:'约克',html:'约克是仅次于伦敦观光客最多的城市，北约克郡首府，除了旅游胜地，约克还是交通枢纽，教育',src:'images/intro6.jpg',href:'http://www.china-pt.cn/city/York.aspx'},{id:'7',title:'利兹',html:'利兹是约克郡和汉伯（Humber）地区的首府，也是伦敦和东南地区以外经济最发达地区之一。它',src:'images/intro7.jpg',href:'http://www.china-pt.cn/city/Leeds.aspx'},{id:'8',title:'利物浦',html:'利物浦是一个富于创新的城市，孕育了许多世界闻名的艺术家、表演者、喜剧演员、发明家和政',src:'images/intro8.jpg',href:'http://www.china-pt.cn/city/Liverpool.aspx'},{id:'9',title:'曼彻斯特',html:'曼彻斯特是英格兰西北地区的中心城市，也是英国除伦敦以外经济最发达的地区。工业革命发源',src:'images/intro9.jpg',href:'http://www.china-pt.cn/city/Manchester.aspx'},{id:'10',title:'都柏林',html:'都柏林是爱尔兰共和国的首都以及最大的城市，这是一个古色古香、充满诗情画意的田园式都市',src:'images/intro10.jpg',href:'http://www.china-pt.cn/city/Dublin.aspx'},{id:'11',title:'伯明翰',html:'伯明翰是靠贸易起家的城市，从曲别针到小汽车，什么都生产，产量占英国出口总额的1/4。著',src:'images/intro11.jpg',href:'http://www.china-pt.cn/city/Birmingham.aspx'},{id:'12',title:'剑桥',html:'剑桥自古以来就是有名的大学城，20世纪对整个世界产生了巨大影响。城里中世纪的建筑，狭',src:'images/intro12.jpg',href:'http://www.china-pt.cn/city/Cambridge.aspx'},{id:'13',title:'牛津',html:'牛津因闻名于它的世界一流学府的地位和遍布各地的古迹,使它成为人们极度梦想的城市。牛津',src:'images/intro13.jpg',href:'http://www.china-pt.cn/city/Oxford.aspx'},{id:'14',title:'加的夫',html:'加的夫是威尔士的首府，刚刚经历过政治改革。1997年，威尔士举行全民公决，决定成立威尔士',src:'images/intro14.jpg',href:'http://www.china-pt.cn/city/Cardiff.aspx'},{id:'15',title:'伦敦',html:'伦敦是英国的首都也是国际上主要的大都市之一。在伦敦使用的语言种类之多是世界上其它任何',src:'images/intro15.jpg',href:'http://www.china-pt.cn/City/London.aspx'},{id:'16',title:'巴斯',html:'位于英格兰的西南部，城历史悠久，有许多历史名胜被列为世界性遗产，巴斯被誉为英格兰最美',src:'images/intro16.jpg',href:'http://www.china-pt.cn/city/Bath.aspx'},{id:'17',title:'朴茨茅斯',html:'朴次茅斯位于英国南部海岸，是一座美丽的岛屿城市，气候宜人、环境优雅，距离伦敦市中心',src:'images/intro17.jpg',href:'http://www.china-pt.cn/city/Portsmouth.aspx'}];
	var page="intro.html";//more的链接页面
	//获取area的数据
	function getareadata(o)
	{
		var coord=$(o).attr("coords");
		var data=coord.split(",");
		return data;
	}
	$(function(){
	$("#placeintro").hover(function(){},function(){$(this).hide();$(".link1").removeClass('selected')})
	var areas=$("#mymap area");
		areas.each(function(i){
			var $this=this;
			$(this).hover(function(){
			
			$(".link1").eq(i).addClass('selected');
				renderdiv($this,dat[i]);
			},function(){
			})
		})
		$(".link1").each(function(i){
			var $this=this;
			
			$(this).hover(function(){
			$(".link1").removeClass('selected');
			$(this).addClass("selected");
				renderdiv(areas.eq(i)[0],dat[i]);
			},function(){
			})
		})
	})
	//渲染弹出框
	function renderdiv(o,arraydata)
	{
		var placeintro=$("#placeintro");
		var totall=parseInt($("#bgmap").offset().left);
		var totalt=parseInt($("#bgmap").offset().top);
		var data=getareadata(o);
		var left=parseInt(totall+parseInt(data[0]));
		var top=parseInt(totalt+parseInt(data[1]));
		
		if(placeintro[0]!=null)
		{
		$("img",placeintro).attr('src',arraydata.src);
		$("h2 a",placeintro).html("").html(arraydata.title);
		$("p",placeintro).html("").html(arraydata.html);
		$("a",placeintro).attr('href',(arraydata.href));
		var boxw=parseInt($("#placeintro").innerWidth());
		var boxh=parseInt($("#placeintro").innerHeight());
		var postionx=parseInt(left-boxw-10);
		var postiony=parseInt(top-Math.ceil(boxh/2));
		placeintro.css({left:postionx,top:postiony});
		if(placeintro.css("display")=="block")
		{	
			placeintro.hide().fadeIn(500);
		}
		else
		{
			placeintro.fadeIn(500);}
		}
		
	}
	function hidediv()
	{
		$("#placeintro").hide();
	}
