function tab(a,b,c,o) { jquery(a).removeclass(c), o.addclass(c); var ii = jquery(a).index(o); jquery(b).hide(), jquery(b).eq(ii).show(); } function loadchinamap(){ var paper = raphael("chinamapholder", 740, 620);//.transform("s1.5,1.5,300,300"); var world={}; var continentdata; var current=null; for (var continent in chinamap) { continentdata=chinamap[continent]; world[continent] = paper.path(continentdata.path).attr("stroke",continentdata.stroke).attr("stroke-width",continentdata["stroke-width"]).attr("fill",continentdata.fill); $(world[continent][0]).attr({"label-id":continent,"id":continent,"fillhover":continentdata.fillhover,"fillnormal":continentdata.fill,"name-cn":decodeuricomponent(continentdata.name_cn)}); (function(continent){ var pele = continent[0]; pele.style.cursor = "pointer"; $(pele).mousemove(function(event){ var parentoffset = $(".smap").offset(); //console.info(event.pagex,event.pagey); //console.info(parentoffset.top, parentoffset.left); $("#chinamaplabel").css({"top":event.pagey-parentoffset.top-36+"px","left":event.pagex-parentoffset.left-20+"px"}); }); continent.hover(function(){ for (var c in world) { if (world[c]!=continent) { world[c].toback(); } } continent.animate({transform:"s1.02",fill:$(pele).attr("fillhover")},300); $("#chinamaplabel").css({"display":"block"}).children("p.labeltext").text($(pele).attr("name-cn")); },function() { continent.animate({transform:"s1",fill:$(pele).attr("fillnormal")},300); $("#chinamaplabel").css("display","none"); }); })(world[continent]); } } //window.onload = function () { loadchinamap(); //};