(function(){function reply(authorId,commentId,commentBox){var author=MGJS.$(authorId).innerHTML;var insertStr='<a href="#'+commentId+'">@'+author.replace(/\t|\n|\r\n/g,"")+' </a> \n';appendReply(insertStr,commentBox);}
function quote(authorId,commentId,commentBodyId,commentBox){var author=MGJS.$(authorId).innerHTML;var comment=MGJS.$(commentBodyId).innerHTML;var insertStr='<blockquote cite="#'+commentBodyId+'">';insertStr+='\n<strong><a href="#'+commentId+'">'+author.replace(/\t|\n|\r\n/g,"")+'</a> :</strong>';insertStr+=comment.replace(/\t/g,"");insertStr+='</blockquote>\n';insertQuote(insertStr,commentBox);}
function appendReply(insertStr,commentBox){if(MGJS.$(commentBox)&&MGJS.$(commentBox).type=='textarea'){field=MGJS.$(commentBox);}else{alert("The comment box does not exist!");return false;}
if(field.value.indexOf(insertStr)>-1){alert("You've already appended this reply!");return false;}
if(field.value.replace(/\s|\t|\n/g,"")==''){field.value=insertStr;}else{field.value=field.value.replace(/[\n]*$/g,"")+'\n\n'+insertStr;}
field.focus();}
function insertQuote(insertStr,commentBox){if(MGJS.$(commentBox)&&MGJS.$(commentBox).type=='textarea'){field=MGJS.$(commentBox);}else{alert("The comment box does not exist!");return false;}
if(document.selection){field.focus();sel=document.selection.createRange();sel.text=insertStr;field.focus();}else if(field.selectionStart||field.selectionStart=='0'){var startPos=field.selectionStart;var endPos=field.selectionEnd;var cursorPos=startPos;field.value=field.value.substring(0,startPos)
+insertStr
+field.value.substring(endPos,field.value.length);cursorPos+=insertStr.length;field.focus();field.selectionStart=cursorPos;field.selectionEnd=cursorPos;}else{field.value+=insertStr;field.focus();}}
window['MGJS_CMT']={};window['MGJS_CMT']['reply']=reply;window['MGJS_CMT']['quote']=quote;})();;(function(){var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
var GhostlyMenu=Class.create();GhostlyMenu.prototype={initialize:function(target,align,sub){this.obj=cleanWhitespace(target);this.align=align||'left';this.sub=sub||-1;this.menu=this.obj.childNodes;if(this.menu.length<2){return;}
this.title=this.menu[0];this.body=this.menu[1];cleanWhitespace(this.body).lastChild.getElementsByTagName('a')[0].className+=' last';setStyle(this.body,'visibility','hidden');setStyle(this.body,'display','block');addListener(this.obj,'mouseover',bind(this,this.activate),false);addListener(this.obj,'mouseout',bind(this,this.deactivate),false);},activate:function(){if(this.sub==1){var pos=currentOffset(this.title);var top=pos[1]-1;var left=getWidth(this.body)-2;if(this.align=='right'){var left=getWidth(this.body)*(-1);}}else{var pos=cumulativeOffset(this.title);var top=pos[1]+getHeight(this.title);var left=pos[0];if(this.align=='right'){left+=getWidth(this.title)-getWidth(this.body);}}
if(!/current/.test(this.title.className)){this.title.className+=' current';}
setStyle(this.body,'left',left+'px');setStyle(this.body,'top',top+'px');setStyle(this.body,'visibility','visible');},deactivate:function(){this.title.className=this.title.className.replace('current','');var thismenu=this;var tid=setInterval(function(){clearInterval(tid);if(!/current/.test(thismenu.title.className)){setStyle(thismenu.body,'visibility','hidden');}
return false;},400);}}
$A=function(iterable){if(!iterable){return[];}
if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0;i<iterable.length;i++){results.push(iterable[i]);}
return results;}}
bind=function(){var array=this.$A(arguments);var func=array[array.length-1];var method=func,args=array,object=args.shift();return function(){return method.apply(object,args.concat(array));}}
getHeight=function(element){return element.offsetHeight;}
getWidth=function(element){return element.offsetWidth;}
setStyle=function(element,key,value){element.style[key]=value;}
cleanWhitespace=function(list){var node=list.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue)){list.removeChild(node);}
node=nextNode;}
return list;}
currentOffset=function(element){var valueT=element.offsetTop||0;var valueL=element.offsetLeft||0;return[valueL,valueT];}
cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];}
addListener=function(element,name,observer,useCapture){if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}}
function loadMenus(){var align='left';for(var i=0;(a=document.getElementsByTagName('link')[i]);i++){if((a.getAttribute('rel')=='stylesheet')&&(a.getAttribute('href').indexOf('rtl.css')!=-1)){align='right';}}
var subscribe=document.getElementById('subscribe');if(subscribe){new GhostlyMenu(subscribe,align);}
var menubar=document.getElementById('menus');if(menubar){var list=menubar.getElementsByTagName('ul');for(var i=0;i<list.length;i++){var menu=list[i].parentNode;if(menu.parentNode===menubar){new GhostlyMenu(menu,align);}else{new GhostlyMenu(menu,align,1);menu.firstChild.className+=' subtitle';}}}}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",loadMenus,false);}else if(/MSIE/i.test(navigator.userAgent)){document.write('<script id="__ie_onload_for_inove" defer src="javascript:void(0)"></script>');var script=document.getElementById('__ie_onload_for_inove');script.onreadystatechange=function(){if(this.readyState=='complete'){loadMenus();}}}else if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(_timer);loadMenus();}},10);}else{window.onload=function(e){loadMenus();}}})();;(function(){function $(id){return document.getElementById(id);}
function setStyleDisplay(id,status){$(id).style.display=status;}
function goTop(a,t){a=a||0.1;t=t||16;var x1=0;var y1=0;var x2=0;var y2=0;var x3=0;var y3=0;if(document.documentElement){x1=document.documentElement.scrollLeft||0;y1=document.documentElement.scrollTop||0;}
if(document.body){x2=document.body.scrollLeft||0;y2=document.body.scrollTop||0;}
var x3=window.scrollX||0;var y3=window.scrollY||0;var x=Math.max(x1,Math.max(x2,x3));var y=Math.max(y1,Math.max(y2,y3));var speed=1+a;window.scrollTo(Math.floor(x/speed),Math.floor(y/speed));if(x>0||y>0){var f="MGJS.goTop("+a+", "+t+")";window.setTimeout(f,t);}}
function switchTab(showPanels,hidePanels,activeTab,activeClass,fadeTab,fadeClass){$(activeTab).className=activeClass;$(fadeTab).className=fadeClass;var panel,panelList;panelList=showPanels.split(',');for(var i=0;i<panelList.length;i++){var panel=panelList[i];if($(panel)){setStyleDisplay(panel,'block');}}
panelList=hidePanels.split(',');for(var i=0;i<panelList.length;i++){panel=panelList[i];if($(panel)){setStyleDisplay(panel,'none');}}}
function loadCommentShortcut(){$('comment').onkeydown=function(moz_ev){var ev=null;if(window.event){ev=window.event;}else{ev=moz_ev;}
if(ev!=null&&ev.ctrlKey&&ev.keyCode==13){$('submit').click();}}
$('submit').value+=' (Ctrl+Enter)';}
function getElementsByClassName(className,tag,parent){parent=parent||document;var allTags=(tag=='*'&&parent.all)?parent.all:parent.getElementsByTagName(tag);var matchingElements=new Array();className=className.replace(/\-/g,'\\-');var regex=new RegExp('(^|\\s)'+className+'(\\s|$)');var element;for(var i=0;i<allTags.length;i++){element=allTags[i];if(regex.test(element.className)){matchingElements.push(element);}}
return matchingElements;}
window['MGJS']={};window['MGJS']['$']=$;window['MGJS']['setStyleDisplay']=setStyleDisplay;window['MGJS']['goTop']=goTop;window['MGJS']['switchTab']=switchTab;window['MGJS']['loadCommentShortcut']=loadCommentShortcut;window['MGJS']['getElementsByClassName']=getElementsByClassName;})();;eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('V=c(){7.f=2Z;7.b={28:\'d-1e-29\',2a:\'d-30-29\',1D:\'d-1e-\',31:\'d-1e\',2b:\'d-32\',1f:\'d-2c\',1E:\'d-W\',1F:\'d-2d\',2e:\'d-33\',M:\'d-34\',1p:\'d-35\',1G:\'d-36\',1H:\'d-F\',1I:\'d-37\',1J:\'d-38\',1K:\'d-39\',2f:\'d-3a\'};7.q={N:1g,X:1g,l:1g}};V.3b={1h:c(b){7.b=b||7.b;5 N=r.1L(7.b.28);5 X=r.1L(7.b.2a);9(!N||!X){m Y}7.q.N=N.1q(G);7.q.X=X.1q(G);7.q.l=N.1i;7.1M(7.f.3c)},B:c(B){5 3=7;5 w=3.f.1r;w+=\'?2g=d-3d\';w+=\'&B=\'+B;w+=\'&2h=\'+1s.2i(y 1s());3.1N(\'2j\',w,{1O:c(){3.1P(\'3e\');3.2k()},1t:c(Z){5 O=3f(\'(\'+Z+\')\');3.1M(O);3.1P(\'3g\')}})},1M:c(O){5 3=7;9(!O.1j){3.q.l.x=\'<11>\'+3.f.3h+\'</11>\';m Y}5 1Q=3.2l(O.1j);5 1u=3.2m(O.F);9(1u.j>0){1Q+=1u}3.q.l.x=1Q;9(3.f.3i){5 1R=3.q.l.1v(\'11\');1w(5 i=0;i<1R.j;i++){5 2n=1R[i];3.2o({6:2n})}}9(7.f.12){3.2p()}9(1u.j>0){3.2q({6:3.q.l,C:O.F.B})}m G},2l:c(1j){5 l=r.13(\'3j\');1w(5 i=0;i<1j.j;i++){5 6=1j[i];5 h=1g;9(6.t==\'3k\'||6.t==\'3l\'){h=7.2r(6)}z{h=7.2s(6)}9(h){l.1x(h)}}m l.x},2m:c(F){9(!F){m\'\'}5 C=1S(F.B,10);9(C<=1&&!F.2t){m\'\'}5 3=7;5 14=\'<11 D="\'+3.b.1H+\' d-3m">\';9(C>=2){9(C>2){14+=\'<a "E=H" D="\'+3.b.1I+\'">\'+3.f.3n+\'</a>\'}14+=\'<a "E=H" D="\'+3.b.1J+\'">\'+3.f.3o+\'</a>\'}9(F.2t){14+=\'<a "E=H" D="\'+3.b.1K+\'">\'+3.f.3p+\'</a>\'}14+=\'</11>\';m 14},2o:c(k){5 6=k.6;5 3=7;5 n=3.o(3.b.1f,\'P\',6)[0];5 2u=3.o(3.b.1E,\'Q\',6);9(2u.j==1){3.I(n.1i,\'3q\',3.2v,{3:3,6:6});3.I(n.1i,\'3r\',3.2w,{3:3,6:6})}},2q:c(k){5 6=k.6;5 C=k.C;5 3=7;5 1T=3.o(3.b.1I,\'a\',6);9(1T.j==1){3.I(1T[0],\'1k\',c(u){3.B(1)})}5 1U=3.o(3.b.1J,\'a\',6);9(1U.j==1){3.I(1U[0],\'1k\',c(u){3.B(1S(C,10)-1)})}5 1V=3.o(3.b.1K,\'a\',6);9(1V.j==1){3.I(1V[0],\'1k\',c(u){3.B(1S(C,10)+1)})}},2s:c(6){5 A=7.q.N.1q(G);5 1y=7.o(7.b.2b,\'P\',A)[0];5 n=7.o(7.b.1f,\'P\',A)[0];A.J=7.b.1D+6.J;9(6.15.j<=0){6.15=7.f.3s}9(6.1W){5 16=\'\';9(6.17&&6.17.j>0){5 18=\'H\';9(7.f.12&&6.17.1X(7.f.1r)!=0){18+=\' 12\'}16=\'<a D="d-1Y" E="\'+18+\'" 19="\'+6.17+\'">\'+6.15+\'</a>\'}z{16=\'<Q D="d-1Y">\'+6.15+\'</Q>\'}5 2x=\'<a D="d-3t" E="H" 19="\'+6.2y+\'#1e-\'+6.J+\'">\'+6.1Z+\'</a>\';1y.x=7.f.3u.1z(/%3v%/g,16).1z(/%3w%/g,2x)}z{5 16=\'<a D="d-1Y" E="H" 19="\'+6.2y+\'#1e-\'+6.J+\'" 1W="\'+6.1Z+\'">\'+6.15+\'</a>\';1y.x=16}n.x=6.2c;9(6.W){5 W=r.13(\'Q\');W.v=7.b.1E;W.x=\'...\';n.1x(W)}9(6.2z){5 K=r.13(\'3x\');K.v=\'d-K d-\'+7.f.3y;K.3z=7.f.2A;K.3A=7.f.2A;K.3B=\'\';K.2B=6.2z;A.2C(K,1y)}m A},2r:c(6){5 A=7.q.X.1q(G);5 2D=7.o(7.b.2e,\'Q\',A)[0];A.3C(\'J\');5 18=\'H\';9(7.f.12&&6.17.1X(7.f.1r)!=0){18+=\' 12\'}5 1a=r.13(\'a\');1a.E=18;1a.19=6.17;1a.1W=6.1Z;1a.x=6.15;A.1x(1a);2D.x=6.t+\': \';m A},2p:c(){5 l=7.q.l;9(!l.1v){m}5 20=l.1v(\'a\');1w(5 i=0;i<20.j;i++){5 R=20[i];9(R.19&&/12/i.1l(R.E)){7.I(R,\'1k\',7.2E,{R:R})}}},2E:c(u,k){21.2F(k.R.19);9(u.2G){u.2G()}z{u.3D=Y}},2v:c(u,k){5 3=k.3;5 6=k.6;5 n=3.o(3.b.1f,\'P\',6)[0];5 1b=3.o(3.b.M,\'a\',6);9(1b.j==1){3.1m(1b[0])}z{5 1c=r.13(\'a\');1c.E=\'H\';1c.v=3.b.M+\' \'+3.b.1p;3.I(1c,\'1k\',3.2H,{3:3,6:6,S:1c});n.1i.2C(1c,n)}},2w:c(u,k){5 3=k.3;5 6=k.6;5 1b=3.o(3.b.M,\'a\',6);9(1b.j==1){3.1d(1b[0])}},2H:c(u,k){5 3=k.3;5 6=k.6;5 S=k.S;5 1n=3.o(3.b.1F,\'P\',6);5 n=3.o(3.b.1f,\'P\',6)[0];9(1n.j==1&&S.v.1X(3.b.1p)>0){3.1d(n);3.1m(1n[0]);S.v=3.b.M+\' \'+3.b.1G}z 9(1n.j==1){3.1d(1n[0]);3.1m(n);S.v=3.b.M+\' \'+3.b.1p}z{5 h=r.13(\'P\');h.v=3.b.1F;3.1d(h);n.1i.1x(h);5 w=3.f.1r;w+=\'?2g=d-2d\';w+=\'&J=\'+6.J.1z(3.b.1D,\'\');w+=\'&2h=\'+1s.2i(y 1s());3.1N(\'2j\',w,{1t:c(Z){9(Z.j<=0){Z=n.x}h.x=Z;3.1d(n);3.1m(h);S.v=3.b.M+\' \'+3.b.1G}})}},2k:c(){5 22=7.o(7.b.1H,\'11\',7.q.l);9(22.j==1){22[0].x=\'<Q D="\'+7.b.2f+\'">\'+7.f.3E+\'...<Q>\'}},1P:c(2I){7.q.l.23.3F=2I},1d:c(L){L.23.2J=\'3G\'},1m:c(L){L.23.2J=\'\'},o:c(v,24,1A){5 25=(24==\'*\'&&1A.2K)?1A.2K:1A.1v(24);5 26=y 3H();v=v.1z(/\\-/g,\'\\\\-\');5 2L=y 3I(\'(^|\\\\s)\'+v+\'(\\\\s|$)\');5 L;1w(5 i=0;i<25.j;i++){L=25[i];9(2L.1l(L.v)){26.3J(L)}}m 26},2M:c(){2N{p=y 3K()}2O(e){2N{p=y 2P(\'3L.2Q\')}2O(e){p=y 2P(\'3M.2Q\')}}m p},1N:c(t,w,T){5 3=7;5 p=3.2M();p.2R=c(u){3.2S(p,T)};p.2F(t,w,G);p.3N(\'3O-t\',\'3P=3Q-8\');p.3R(1g)},2S:c(p,T){9(T.1O&&p.1o==1){T.1O()}9(T.1t&&(p.1o==4||p.1o==\'27\')){T.1t(p.3S)}},I:c(h,t,U,2T){5 f=2T||{};9(h.1B){h.1B(t,c(u){U(u,f)},Y);m G}z 9(h.2U){h[\'e\'+t+U]=U;h[t+U]=c(){h[\'e\'+t+U](21.3T,f)};h.2U(\'3U\'+t,h[t+U]);m G}m Y}};9(r.1B){r.1B("3V",c(){(y V()).1h()},Y)}z 9(/3W/i.1l(2V.2W)){r.3X(\'<1C J="2X" 3Y 2B="3Z:40(0)"></1C>\');5 1C=r.1L(\'2X\');1C.2R=c(){9(7.1o==\'27\'){(y V()).1h()}}}z 9(/41/i.1l(2V.2W)){5 2Y=42(c(){9(/43|27/.1l(r.1o)){44(2Y);(y V()).1h()}},10)}z{21.45=c(e){(y V()).1h()}}',62,254,'|||_self||var|item|this||if||config|function|rc||param||node||length|args|list|return|itemExcerpt|_getElementsByClassName|xmlHttp|context|document||type|ev|className|url|innerHTML|new|else|itemNode|page|pageNumber|class|rel|navi|true|nofollow|_addListener|id|avatar|element|toggleClass|commentTemp|json|div|span|link|source|actions|listener|RecentComment|ellipsis|pingTemp|false|data||li|external|createElement|code|reviewerName|reviewerLink|reviewerUrl|relTag|href|pingLink|itemToggles|itemToggle|_hide|comment|excerptClass|null|init|parentNode|items|click|test|_show|itemContents|readyState|collapseClass|cloneNode|serverUrl|Date|success|naviCode|getElementsByTagName|for|appendChild|itemInfo|replace|parent|addEventListener|script|itemIdPrefix|ellipsisClass|contentClass|expandClass|naviClass|newestClass|newerClass|olderClass|getElementById|_buildList|_ajax|beforeSend|_changeCursor|listCode|commentItems|parseInt|newestLinks|newerLinks|olderLinks|title|indexOf|reviewer|postTitle|links|window|navis|style|tag|allTags|matchingElements|complete|commentTempId|temp|pingTempId|infoClass|excerpt|content|labelClass|loadingClass|action|_|parse|GET|_loading|_createCommentCode|_createNaviCode|commentItem|_bindCommentAction|_initLinks|_bindNaviAction|_buildPing|_buildComment|more|itemEllipsises|_enterCommnet|_leaveCommnet|postLink|postUrl|avatarImage|avatarSize|src|insertBefore|itemLabel|_bindPopup|open|preventDefault|_toggleComment|status|display|all|regex|_getXmlHttpObject|try|catch|ActiveXObject|XMLHTTP|onreadystatechange|_callback|obj|attachEvent|navigator|userAgent|__ie_onload_for_wp_recentcomment|_timer|rcGlobal|ping|commentClass|info|label|toggle|collapse|expand|newest|newer|older|loading|prototype|initJson|ajax|wait|eval|auto|noCommentsText|showContent|ul|pingback|trackback|clearfix|newestText|newerText|olderText|mouseover|mouseout|anonymous|post|infoTemp|REVIEWER|POST|img|avatarPosition|width|height|alt|removeAttribute|returnValue|loadingText|cursor|none|Array|RegExp|push|XMLHttpRequest|Msxml2|Microsoft|setRequestHeader|Content|charset|UTF|send|responseText|event|on|DOMContentLoaded|MSIE|write|defer|javascript|void|WebKit|setInterval|loaded|clearInterval|onload'.split('|'),0,{}));jQuery(document).ready(function(){var id=/^#comment-/;var at=/^@/;jQuery('#thecomments li p a').each(function(){if(jQuery(this).attr('href').match(id)&&jQuery(this).text().match(at)){jQuery(this).addClass('atreply');}});jQuery('.atreply').hover(function(){jQuery(jQuery(this).attr('href')).clone().hide().insertAfter(jQuery(this).parents('li')).attr('id','').addClass('tip').fadeIn(200);},function(){jQuery('.tip').fadeOut(400,function(){jQuery(this).remove();});});jQuery('.atreply').mousemove(function(e){jQuery('.tip').css({left:(e.clientX+18),top:(e.pageY+18)})});});eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.J.L=5(r){8 1={d:0,A:0,b:"h",v:"N",3:4};6(r){$.D(1,r)}8 m=9;6("h"==1.b){$(1.3).p("h",5(b){8 C=0;m.t(5(){6(!$.k(9,1)&&!$.l(9,1)){$(9).z("o")}j{6(C++>1.A){g B}}});8 w=$.M(m,5(f){g!f.e});m=$(w)})}g 9.t(5(){8 2=9;$(2).c("s",$(2).c("i"));6("h"!=1.b||$.k(2,1)||$.l(2,1)){6(1.u){$(2).c("i",1.u)}j{$(2).K("i")}2.e=B}j{2.e=x}$(2).T("o",5(){6(!9.e){$("<V />").p("X",5(){$(2).Y().c("i",$(2).c("s"))[1.v](1.Z);2.e=x}).c("i",$(2).c("s"))}});6("h"!=1.b){$(2).p(1.b,5(b){6(!2.e){$(2).z("o")}})}})};$.k=5(f,1){6(1.3===E||1.3===4){8 7=$(4).F()+$(4).O()}j{8 7=$(1.3).n().G+$(1.3).F()}g 7<=$(f).n().G-1.d};$.l=5(f,1){6(1.3===E||1.3===4){8 7=$(4).I()+$(4).U()}j{8 7=$(1.3).n().q+$(1.3).I()}g 7<=$(f).n().q-1.d};$.D($.P[\':\'],{"Q-H-7":"$.k(a, {d : 0, 3: 4})","R-H-7":"!$.k(a, {d : 0, 3: 4})","S-y-7":"$.l(a, {d : 0, 3: 4})","q-y-7":"!$.l(a, {d : 0, 3: 4})"})})(W);',62,62,'|settings|self|container|window|function|if|fold|var|this||event|attr|threshold|loaded|element|return|scroll|src|else|belowthefold|rightoffold|elements|offset|appear|bind|left|options|original|each|placeholder|effect|temp|true|of|trigger|failurelimit|false|counter|extend|undefined|height|top|the|width|fn|removeAttr|lazyload|grep|show|scrollTop|expr|below|above|right|one|scrollLeft|img|jQuery|load|hide|effectspeed'.split('|'),0,{}));$(document).ready(function(){$('#popgrin-close').click(function(){$('#popgrin-container').slideUp('normal');});$('#popgrin-insert').click(function(ev){xx=ev.pageX-$('#popgrin-container').width()/2;yy=ev.pageY-$('#popgrin-container').height()/2;$('#popgrin-container').css('top',yy).css('left',xx).slideDown('normal');});});function insertTags(insertStr){var myField;var string=insertStr;insertStr=","+insertStr.replace(/^\s+/,'').replace(/\s+$/,'')+",";if(document.getElementById('tags')&&document.getElementById('tags').type=='text'){myField=document.getElementById('tags');}else{return false;}
if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;var cursorPos=startPos;var re=new RegExp(string+",");myField.value=myField.value+",";if(!myField.value.match(re)){myField.value=myField.value.substring(0,startPos)
+insertStr
+myField.value.substring(endPos,myField.value.length);}
myField.value=myField.value.replace(/\s+,+\s*/g,',').replace(/,+/g,',').replace(/,+\s+,+/g,',').replace(/,+\s*$/g,'').replace(/^\s*,+/g,'');cursorPos+=insertStr.length;myField.focus();myField.selectionStart=cursorPos;myField.selectionEnd=cursorPos;}else{var re=new RegExp(string+",");myField.value=myField.value+",";if(!myField.value.match(re)){myField.value+=insertStr;}
myField.value=myField.value.replace(/\s+,+\s*/g,',').replace(/,+/g,',').replace(/,+\s+,+/g,',').replace(/,+\s*$/g,'').replace(/^\s*,+/g,'');myField.focus();}};$(function(){function addEditor(a,b,c){if(document.selection){a.focus();sel=document.selection.createRange();c?sel.text=b+sel.text+c:sel.text=b;a.focus()}else if(a.selectionStart||a.selectionStart=='0'){var d=a.selectionStart;var e=a.selectionEnd;var f=e;c?a.value=a.value.substring(0,d)+b+a.value.substring(d,e)+c+a.value.substring(e,a.value.length):a.value=a.value.substring(0,d)+b+a.value.substring(e,a.value.length);c?f+=b.length+c.length:f+=b.length-e+d;if(d==e&&c)f-=c.length;a.focus();a.selectionStart=f;a.selectionEnd=f}else{a.value+=b+c;a.focus()}}
var g=document.getElementById('comment')||0;var h={strong:function(){addEditor(g,'<strong>','</strong>')},em:function(){addEditor(g,'<em>','</em>')},del:function(){addEditor(g,'<del>','</del>')},underline:function(){addEditor(g,'<u>','</u>')},quote:function(){addEditor(g,'<blockquote>','</blockquote>')},ahref:function(){var a=prompt('请输入链接地址','http://');var b=prompt('请输入链接描述','');if(a){addEditor(g,'<a target="_blank" href="'+a+'" rel="external">'+b+'</a>','')}},img:function(){var a=prompt('请输入图片地址','http://');if(a){addEditor(g,'<img src="'+a+'" alt="" />','')}},code:function(){addEditor(g,'<code>','</code>')}};window['SIMPALED']={};window['SIMPALED']['Editor']=h});;$(function(){function addEditor(a,b,c){if(document.selection){a.focus();sel=document.selection.createRange();c?sel.text=b+sel.text+c:sel.text=b;a.focus()}else if(a.selectionStart||a.selectionStart=='0'){var d=a.selectionStart;var e=a.selectionEnd;var f=e;c?a.value=a.value.substring(0,d)+b+a.value.substring(d,e)+c+a.value.substring(e,a.value.length):a.value=a.value.substring(0,d)+b+a.value.substring(e,a.value.length);c?f+=b.length+c.length:f+=b.length-e+d;if(d==e&&c)f-=c.length;a.focus();a.selectionStart=f;a.selectionEnd=f}else{a.value+=b+c;a.focus()}}
var g=document.getElementById('comment')||0;var h={strong:function(){addEditor(g,'<strong>','</strong>')},em:function(){addEditor(g,'<em>','</em>')},del:function(){addEditor(g,'<del>','</del>')},underline:function(){addEditor(g,'<u>','</u>')},quote:function(){addEditor(g,'<blockquote>','</blockquote>')},ahref:function(){var a=prompt('请输入链接地址','http://');var b=prompt('请输入链接描述','');if(a){addEditor(g,'<a target="_blank" href="'+a+'" rel="external">'+b+'</a>','')}},img:function(){var a=prompt('请输入图片地址','http://');if(a){addEditor(g,'<img src="'+a+'" alt="" />','')}},code:function(){addEditor(g,'<code>','</code>')}};window['SIMPALED']={};window['SIMPALED']['Editor']=h});;$(document).ready(function(){$('#popgrin-close').click(function(){$('#popgrin-container').slideUp('normal');});$('#popgrin-insert').click(function(ev){xx=ev.pageX-$('#popgrin-container').width()/2;yy=ev.pageY-$('#popgrin-container').height()/2;$('#popgrin-container').css('top',yy).css('left',xx).slideDown('normal');});});function insertEmoticon(insertStr){var myField;if(document.getElementById('comment')&&document.getElementById('comment').type=='textarea'){myField=document.getElementById('comment');}else{return false;}
if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=insertStr;myField.focus();}else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;var cursorPos=startPos;myField.value=myField.value.substring(0,startPos)
+insertStr
+myField.value.substring(endPos,myField.value.length);cursorPos+=insertStr.length;myField.focus();myField.selectionStart=cursorPos;myField.selectionEnd=cursorPos;}else{myField.value+=insertStr;myField.focus();}}
