(function($,undefined){$.jweCore={_ucArr:new Array(),uniCode_blank:function(){var a=999;var html="<div class='uni' lang="+a+" ><img lang="+a+" src='_img/uni/icon/"+a+"."+_extName+"' /></div>";return html},uniCode:function(n){var a=n.toString();var html="<div class='uni' lang="+n+" ><img lang="+n+" src='_img/uni/icon/"+a+"."+_extName+"' /></div>";return html},bgCode:function(n){var html="<img lang="+n+" src='_img/uni/bg/"+n+"."+_bgExtName+"' />";return html},tmpFCode:function(id,v){var html="<div id='"+id+"' class='tmpFlo'><div class='uni' >"+v+"</div></div>";return html},xPCode:function(n){if(n==null)n=Math.floor(Math.random()*_xPicNum)+_xPicBeginNum;var p1=_xPicModel.indexOf("#");var p2=_xPicModel.lastIndexOf("#");var iN=p2+1-p1;var s1=_xPicModel.substring(0,p1);var s2=_xPicModel.substring(p2+1);var s=n.toString();while(s.length<iN)s="0"+s;var html="<img src='_img/"+s1+s+s2+"' />";return html},aStatUni:function(n,code,info){var html="<td class='statUni' lang="+n+" ><div class='infoD'>"+info+"</div>"+code+"</td>";return html},aNewUni:function(n){if(n==null)n=Math.floor(Math.random()*(_UniTypeNumber));var N=this._ucArr[n];return this.uniCode(N)},giMMPanelCode:function(id){var idStr="";if(id!=null&&id!="")idStr="id='"+id+"'";var html="<div class='giMM' "+idStr+"></div>";return html},getSwitcherTD:function(td,sign){var id=td.id;var ss=id.split("_");var r=parseInt(ss[1]);var c=parseInt(ss[2]);if(sign=="up"){r--}else if(sign=="dn"){r++}else if(sign=="lf"){c--}else if(sign=="rt"){c++}else{}var id2=ss[0]+"_"+r+"_"+c;return $("#"+id2)},switch2TDsUni:function(TD1,TD2){var t1=TD1.html();var t2=TD2.html();TD1.html(t2);TD2.html(t1);var o1=TD1.find(".uni:first");var o2=TD2.find(".uni:first");if(o1.length>0)$.jweCtrl.uniEvt(o1);if(o2.length>0)$.jweCtrl.uniEvt(o2)},switch2TDsUni_orgPlace:function(TD1,TD2,chgPos1,chgPos2){this.switch2TDsUni(TD1,TD2);var o1=TD1.find(".uni:first");var o2=TD2.find(".uni:first");$.jweAnimate.reform(o1);$.jweAnimate.reform(o2);var dW=parseInt(TD2.position().left)-parseInt(TD1.position().left);var dH=parseInt(TD2.position().top)-parseInt(TD1.position().top);if(chgPos1)o1.css({left:dW,top:dH});else o1.css({left:0,top:0});if(chgPos2)o2.css({left:-dW,top:-dH});else o2.css({left:0,top:0})},newSkyUniAtTD:function(TD,n){TD.html(this.aNewUni());var hi=parseInt(TD.css("height"))*n;var o=TD.find(".uni:first");o.css({top:-hi});$.jweCtrl.uniEvt(o)},copyUniFromTD:function(TD,TD2){TD2.html(TD.html());var hi=parseInt(TD.position().top)-parseInt(TD2.position().top);var wi=parseInt(TD.position().left)-parseInt(TD2.position().left);var o=TD2.find(".uni:first");o.css({top:hi,left:wi});$.jweCtrl.uniEvt(o)},scoreUni:function(n){var html="<div class='sDiv' id='sDiv"+n+"'>";html+=this.uniCode(n)+"x"+this.scoCode(n);html+="</div>";return html},scoCode:function(n){var html="<span class='scBar' lang="+n+" >0</span>";return html},objPos:function(Obj,x,y){var wi=parseInt(Obj.css("width"));var hi=parseInt(Obj.css("height"));Obj.css({left:parseInt(x)-wi/2,top:parseInt(y)-hi/2})},LoadACharacter:function(Obj,n,ranking){var a;if(_showGirlGroups!=null&&_showGirlGroups[n]!=null){var len=_showGirlGroups[n].length;var rnd=parseInt(Math.floor(Math.random()*len));a=_showGirlGroups[n][rnd]}else{a=n.toString()}var pic=a+"."+_extName;var code="<img src='_img/uni/char/"+pic+"' />";Obj.html(code);$.jweCore.setGirlPosition(Obj,ranking)},aStatGirlImg:function(n){var a;if(_showGirlGroups!=null&&_showGirlGroups[n]!=null){var len=_showGirlGroups[n].length;var rnd=parseInt(Math.floor(Math.random()*len));a=_showGirlGroups[n][rnd]}else{a=n.toString()}var pic=a+"."+_extName;var code="<img src='_img/uni/char/"+pic+"' />";return code},setGirlPosition:function($o,ranking,opc){var x=$.jweCore.getGirlPosition_x(ranking,parseInt($o.css("width")));var z=-ranking+20;var q=ranking/_UniTypeNumber;if(opc==null)opc=1-q*q;$o.css({zIndex:z});$.jweAnimate.objPositionAnim2($o.attr("id"),x,opc)},getGirlPosition_x:function(ranking,charWi){var WI=parseInt($(window).width());var uWi=WI/_UniTypeNumber;var center=ranking*uWi-uWi/2;var x=center-charWi/2;return x}}}(jQuery));