var note_list=note_str.split("_");var len=note_list.length;var NoteList=[];var crop;for(i=0;i<len;i++){NoteList[i]=note_list[i].split(",")}function onEndCrop(b,a){$("x1").value=b.x1;$("y1").value=b.y1;$("x2").value=b.x2;$("y2").value=b.y2;$("width").value=a.width;$("height").value=a.height}function note(b){if(b){if(b.disabled==true){return}b.disabled=true}if(crop){resetNote()}else{var c=$F("blog_photo_id");var a=$("e_note").innerHTML;crop=new Cropper.Img("photo_"+c,{onEndCrop:onEndCrop,hasTip:true,tipCss:"margin-top:4px;z-index:500;color:#333333;position:absolute;display:none;cursor:auto;",tipHtml:a})}$("tiptext").innerHTML="请在照片中单击并拖动，并选择好友！";Element.show($("notetip1"))}function resetNote(){crop.reset();if(crop.tip){Element.hide(crop.tip)}}function saveNote(a){var d=$F("x1");var h=$F("y1");var c=$F("width");var k=$F("height");d=parseInt(d);h=parseInt(h);c=parseInt(c);k=parseInt(k);var g=$F("blog_photo_id");var f=$("f_cancel");var e=loadBeg(a,f);var b=$CV("mem[]");var j=$("f_tip");if(!b){$T(j,"请选择！");loadEnd(e,f);return false}new Ajax.Request("/photos/save_note",{method:"post",parameters:"x="+d+"&y="+h+"&width="+c+"&height="+k+"&p_id="+g+"&id_names="+encodeURIComponent(b)+TOKEN,onComplete:function(u){setDisabled("mem[]",b,true);loadEnd(e,f);resetNote();var s=b.split("|");var p=s[0];var o=s[1];var l=u.responseText.split("_");var m=l[0];var n=l[1];var t=NoteList.length;var q='<span id="note2_'+t+'">';q+='<a href="'+n+'" class="f12a" target="_blank" onmouseover="noteon('+t+","+g+')" onmouseout="noteout('+t+')">'+o+"</a>";q+='【<a href="javascript:void(0);" onclick="removeNote(this, '+t+", "+m+')" onmouseover="noteon('+t+","+g+')" onmouseout="noteout('+t+')">删除</a>】&nbsp;&nbsp;';q+="</span>";new Insertion.Bottom("notediv2",q);$("tiptext").innerHTML="圈人已成功！请继续圈人，或点击按钮“结束圈人”。";NoteList.push([t,d,h,c,k,o,1,p]);addBorder(t,$("photo_"+g));if($("turn_left")){Element.hide($("turn_left"))}if($("turn_right")){Element.hide($("turn_right"))}}});return false}function noteon(c,b){var a=$("photo_"+b);addBorder(c,a)}function noteout(a){delBorder(a)}function moveonphoto(j,e){j=j||window.event;var a=[Event.pointerX(j),Event.pointerY(j)];var h=Position.cumulativeOffset(e);var d=[0,1].map(function(l){return(a[l]-h[l])});var f=NoteList.length;for(i=0;i<f;i++){var c=parseInt(NoteList[i][1]);var k=parseInt(NoteList[i][2]);var b=c+parseInt(NoteList[i][3]);var g=k+parseInt(NoteList[i][4]);if(c<d[0]&&b>d[0]&&k<d[1]&&g>d[1]){addBorder(i,e)}else{delBorder(i)}}}function mouseCoords(b){var d=$F("blog_photo_id");var c=$("photo_"+d);var a=this.imgWrap,f=Position.cumulativeOffset(a);while(a.nodeName!="BODY"){f[1]-=a.scrollTop||0;f[0]-=a.scrollLeft||0;a=a.parentNode}return curPos={x:b.pointerX(c)-f[0],y:b.pointerY(c)-f[1]}}function addBorder(b,g){var c=NoteList[b];if(parseInt(c[6])==0){delBorder(b);return}if($("note_"+b)){return}var a=$("photo_single");var l=$("notediv1");var d=document.createElement("div");var f=parseInt(c[1])+(parseInt(a.offsetWidth)-parseInt(g.width)-6)/2;var e=parseInt(c[2])+(parseInt(a.offsetHeight)-parseInt(g.height)-6)/2+15;d.style.cssText="position:absolute;display:inline-block;cursor:default;text-align:center;top:"+e+"px;left:"+f+"px;";d.id="note_"+b;var j='<span class="roll_r dib"><span class="roll_pic dib" style="height:'+(c[4]-4)+"px;width:"+(c[3]-4)+'px;"></span></span><br/><br/>';d.innerHTML=j;var h=document.createElement("div");var k=e+parseInt(c[4])+15;h.style.cssText="position:absolute;display:inline-block;cursor:default;text-align:center;top:"+k+"px;left:"+f+"px;";h.id="notename_"+b;j='<span class="p5 bg4e2 cf">'+c[5]+"</span>";h.innerHTML=j;l.appendChild(d);l.appendChild(h);if(h.offsetWidth<parseInt(c[3])){h.style.width=(parseInt(c[3])+4)+"px"}d.onmouseout=function(){delBorder(b)}}function delBorder(a){if($("note_"+a)){Element.remove($("note_"+a));Element.remove($("notename_"+a))}}function removeNote(b,c,a){loadBegBig(b,"24","20");new Ajax.Request("/photos/remove_note",{method:"post",parameters:"n_id="+a+TOKEN,onComplete:function(e){NoteList[c][6]=0;var d=NoteList[c][7]+"|"+NoteList[c][5];setDisabled("mem[]",d,false);loadEnd();Element.remove($("note2_"+c));delBorder(c)}});return false}function endNote(){$("note_btn").disabled=false;crop.remove();if($("notetip1")){Element.hide($("notetip1"))}};