
var xmlHttp;var g_image_x='';var g_image_y='';var frameWidth=166;var frameHeight=166;var tagging=false;var cur_img_name='';var tagframe_x0=0,tagframe_y0=0,tagframe_x1=0,tagframe_y1=0;var moveable=false;var tagframe_top=0,tagselector_top=0,tagresize_top=0;var curTagPeople=1;function tagPhoto(type){tagging=true;removeNodeById('tag_div');if($("userlist")&&type==1){$("namelabel").style.display="none";$("wu_name").style.display="none";$("userlist").style.display="";}else{$("wu_name").style.display="";$("namelabel").innerHTML="输入标记内容";$("userlist").style.display="none";}
if(type==1){curTagPeople=1;$('photoTagConfirmMsg_manTip').innerHTML="点击照片中的人脸，设标记，完成后请确定！";$('photoTagConfirm_manTip').style.display='';$('photoTagConfirm_thingTip').style.display='none';effect=new Effect.Highlight('photoTagConfirm_manTip',{duration:2.0});}else{curTagPeople=0;$('photoTagConfirmMsg_thingTip').innerHTML="点击照片中的景物，设标记，完成后请确定！";$('photoTagConfirm_manTip').style.display='none';$('photoTagConfirm_thingTip').style.display='';effect=new Effect.Highlight('photoTagConfirm_thingTip',{duration:2.0});}}
function updateFrame(image,imageMouseX,imageMouseY){g_image_x=activeImageMouseX;g_image_y=activeImageMouseY;imageMinX=findX(image);imageMinY=findY(image);imageMaxX=imageMinX+image.width;imageMaxY=imageMinY+image.height;frameX=findX(image)+imageMouseX;frameY=findY(image)+imageMouseY;if(frameX<imageMinX+(frameWidth/2))
frameX=imageMinX+(frameWidth/2);if(frameY<imageMinY+(frameHeight/2))
frameY=imageMinY+(frameHeight/2);if(frameX>imageMaxX-(frameWidth/2))
frameX=imageMaxX-(frameWidth/2);if(frameY>imageMaxY-(frameHeight/2))
frameY=imageMaxY-(frameHeight/2);var tagMinX=frameX-(frameWidth/2)-8;var tagMinY=frameY-(frameHeight/2)-8;$('tagframe').style.left=tagMinX+"px";$('tagframe').style.top=tagMinY<0?0:tagMinY+"px";tagframe_top=tagMinY<0?0:tagMinY;if(imageMouseX<300){if($('selector'))$('selector').style.left=(tagMinX+frameWidth+16+20)+"px";}else{if($('selector'))$('selector').style.left=(tagMinX-240)+"px";}
if($('selector'))$('selector').style.top=tagMinY<0?0:tagMinY+"px";tagselector_top=tagMinY<0?0:tagMinY;if(document.body.scrollTop!=0){tagframe_top+=document.body.scrollTop;tagselector_top+=document.body.scrollTop;}
if($('selector'))$('selector').style.display='';if(curTagPeople==1)
if($('name'))$('name').select();else
if($('wu_name'))$('wu_name').select();$('tagframe').style.display='';if($('tag_div'))$('tag_div').style.display='none';}
var dragFlag=0;var ie=(navigator.appVersion.indexOf("MSIE")!=-1);var ff=(navigator.userAgent.indexOf("Firefox")!=-1);var xx,yy;function startDrag(e){Event.observe(document.body||window,'mousemove',drag.bindAsEventListener(this));var theEvent=window.event||arguments.callee.caller.arguments[0];var tagframe=$('tagframe');tagframe_x0=theEvent.clientX;tagframe_y0=theEvent.clientY;tagframe_x1=parseInt(tagframe.offsetLeft);tagframe_y1=parseInt(tagframe.offsetTop);selector_x0=theEvent.clientX;selector_y0=theEvent.clientY;moveable=true;tagFrame_scrollVar=document.body.scrollTop;if(is_ie&&is_ie<7){tagFrame_scrollVar=0;}
if(ff){xx=document.documentElement.scrollLeft+theEvent.layerX;yy=document.documentElement.scrollTop+theEvent.layerY;if(document.documentElement.scrollTop>0){yy=theEvent.layerY-document.documentElement.scrollTop;}
if(document.documentElement.scrollLeft>0){xx=theEvent.layerX-document.documentElement.scrollLeft;}}
if(ie){xx=document.documentElement.scrollLeft+theEvent.offsetX;yy=document.documentElement.scrollTop+theEvent.offsetY;if(document.documentElement.scrollTop>0){yy=theEvent.offsetY-document.documentElement.scrollTop;}
if(document.documentElement.scrollLeft>0){xx=theEvent.offsetX-document.documentElement.scrollLeft;}}}
function drag(e){var theEvent=window.event||arguments.callee.caller.arguments[0];if(moveable){var image=$('myphoto');var tagframe=$('tagframe');if($('selector'))$('selector').style.display='none';var tagFrameLeft=theEvent.clientX-xx-8;var tagFrameTop=theEvent.clientY-yy-8;var imageX=findX(image);var imageY=findY(image);if(tagFrameLeft<imageX){tagFrameLeft=imageX;}else if(tagFrameLeft+frameWidth>imageX+image.width){tagFrameLeft=imageX+image.width-frameWidth;}
if(tagFrameTop<(imageY-tagFrame_scrollVar)){tagFrameTop=imageY-tagFrame_scrollVar}else if(tagFrameTop+frameHeight>(imageY+image.height-tagFrame_scrollVar)){tagFrameTop=imageY+image.height-tagFrame_scrollVar-frameHeight;}
tagframe.style.left=tagFrameLeft+"px";tagframe.style.top=tagFrameTop+"px";updateMoveDiv();if($('selector'))$('selector').style.left=theEvent.clientX-xx+"px";if($('selector'))$('selector').style.top=theEvent.clientY-yy+"px";if(is_ie)document.selection.empty();else window.getSelection().removeAllRanges();}}
function stopDrag(e){var theEvent=window.event||arguments.callee.caller.arguments[0];if(moveable){if(tagging){image=$('myphoto');var tagframe=$('tagframe');tagframe.style.left=theEvent.clientX-xx+"px";tagframe.style.top=theEvent.clientY-yy+"px";activeImageMouseX=parseInt(tagframe.style.left)+(frameWidth/2)-findX(image);activeImageMouseY=parseInt(tagframe.style.top)+(frameHeight/2)-findY(image)+tagFrame_scrollVar;updateFrame(image,activeImageMouseX,activeImageMouseY);updateMoveDiv();if(curTagPeople==1){if($('name'))$('name').focus();if($('name'))$('name').select();}else{if($('wu_name'))$('wu_name').focus();if($('wu_name'))$('wu_name').select();}}
moveable=false;}}
function cancelHit(){hide('selector','tagframe');}
function hide(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);if(element&&element.style)element.style.display='none';}
$("size_4").style.display="none";return false;}
function tagHit(){if(curTagPeople==1){if($('name')&&$('name').value=='')return false;}else{if($('wu_name')&&$('wu_name').value=='')return false;}
var url="/ajax/photoalbum.php";var par=new Array();var iamges=$("myphoto");if(g_image_x<(frameWidth/2)){g_image_x=(frameWidth/2);}
if(g_image_x>iamges.width-(frameWidth/2)){g_image_x=iamges.width-(frameWidth/2);}
if(g_image_y<(frameHeight/2)){g_image_y=(frameHeight/2);}
if(this.g_image_y>(iamges.height-frameHeight/2)){this.g_image_y=(iamges.height-frameHeight/2);}
pars="act=addTag";par.push(pars);pars="photoId="+photoId;par.push(pars);pars="tagged_id="+tagged_id;par.push(pars);pars="x="+g_image_x;par.push(pars);pars="y="+g_image_y;par.push(pars);pars="width="+frameWidth;par.push(pars);pars="height="+frameHeight;par.push(pars);if(curTagPeople==1){if(isnull('name'))return;pars="tagValue="+encodeURIComponent($('name').value);}else{if(isnull('wu_name'))return;pars="tagValue="+encodeURIComponent($('wu_name').value);}
par.push(pars);pars="ifpeople="+curTagPeople;par.push(pars);pars=par.join("&");$("size_4").style.display="none";var tipId=curTagPeople==true?"_manTip":"_thingTip";if($('photoTagConfirmMsg'+tipId))$('photoTagConfirmMsg'+tipId).innerHTML="<font color=green>保存中...</font>";new Ajax.Request(url,{method:'post',parameters:pars,onComplete:function(e){tagHitState(e)}});}
function tagHitState(e){var tmp=e.responseText;tmp=eval("("+tmp+")");var tipId=curTagPeople==1?"_manTip":"_thingTip";if(tmp.rtn_code=="nosession"){login_user_ajax();}else if(tmp.rtn_code=="1"){if(tmp.ifowner=="1"){if($('photoTagConfirmMsg'+tipId))$('photoTagConfirmMsg'+tipId).innerHTML="<font color=red>标记成功!结束标记请点击“确定”。</font>";tag_info=eval(tmp.taglist)
if(tag_info[0]['id']){showTags();}}else{if($('photoTagConfirmMsg'+tipId))$('photoTagConfirmMsg'+tipId).innerHTML="<font color=red>标记成功，等待照片拥有者审核!</font>";}}else{if($('photoTagConfirmMsg'+tipId))$('photoTagConfirmMsg'+tipId).innerHTML="<font color=red>标记失败!</font>";}
if($('photoTagConfirmMsg'+tipId))
effect=new Effect.Highlight('photoTagConfirm'+tipId,{duration:2.0});if($('tagframe'))$('tagframe').style.display='none';if($('selector'))$('selector').style.display='none';if(curTagPeople==1){if($("name"))$("name").value='';}else{if($("wu_name"))$("wu_name").value='';}
unSelectFriend();}
function changeCursorStyle(event,image){var event=window.event||event;activeImageMouseX=mousePosX(event)-findX(image);activeImageMouseY=mousePosY(event)-findY(image);if(activeImageMouseX<image.width/2){if(!image.style.cursor.match("pre"))
image.style.cursor='url("'+static_url_prefix+'/images/common/prev.cur"), pointer';image.title='点击查看上一张图片';}
else if(activeImageMouseX>image.width/2){if(!image.style.cursor.match("next"))
image.style.cursor='url("'+static_url_prefix+'/images/common/next.cur"), pointer';image.title='点击查看下一张图片';}}
function findTag(event,image){if(tagging==true){image.style.cursor="pointer";image.title='';return;}
if(is_ie&&document.readyState!="complete")return;changeCursorStyle(event,image);removeNodeById('tag_div');activeImageMouseX=mousePosX(event)-findX(image);activeImageMouseY=mousePosY(event)-findY(image);cur_tag_num=-1;flag=-1;for(i=0;i<tag_info.length;i++){temp_distance_x=Math.abs(tag_info[i]['x']-activeImageMouseX);temp_distance_y=Math.abs(tag_info[i]['y']-activeImageMouseY);temp_distance_sum=temp_distance_x+temp_distance_y;if(temp_distance_x<88&&temp_distance_y<88){flag++;if(flag==0)min_distance_sum=temp_distance_sum;if(temp_distance_sum<=min_distance_sum){min_distance_sum=temp_distance_sum;cur_tag_num=i;}}}
if(cur_tag_num>=0){var tagTextContent=tag_info[cur_tag_num]['tagged_text'];if(tag_info[cur_tag_num]['ofuser']!=G_USERID&&tagTextContent=="")return;tag_div=document.createElement('div');tag_div.style.position='absolute';tag_div.style.width="auto";tag_div.style.borderWidth='1px';tag_div.style.padding='5px';tag_div.style.fontColor='#000';tag_div.style.fontWeight='bold';tag_div.style.backgroundColor='#ffffcc';tag_div.style.display='';tag_div.style.textAlign='center';tag_div.style.left=findX(image)+parseInt(tag_info[cur_tag_num]['x'])+"px";tag_div.style.top=findY(image)+parseInt(tag_info[cur_tag_num]['y'])-document.body.scrollTop+"px";tag_div.setAttribute('id',"tag_div");document.body.appendChild(tag_div);if(tagTextContent==""){tag_div.innerHTML="<p><a id='"+tag_info[cur_tag_num]['tagged_id']+"_taggedNameUrl' href='javascript:albumCls.taggedName(\""+tag_info[cur_tag_num]['id']+"\");' class='font_black_a'>给TA命名</a></p>";}else{if(tag_info[cur_tag_num]['tagged_id']=="")
var linkUrl="/modules/photoalbum.php?act=showtaggeds&uid="+tag_info[cur_tag_num]['ofuser']+"&ifself=1&taggedtext="+encodeURI(tag_info[cur_tag_num]['tagged_text']);else
var linkUrl="/modules/photoalbum.php?act=showtaggeds&uid="+tag_info[cur_tag_num]['ofuser']+"&ifself=1&taggedid="+tag_info[cur_tag_num]['tagged_id'];tag_div.innerHTML="<p><a href='"+linkUrl+"'>"+tagTextContent+"</a></p>";}}}
function doneTagging(){if($('selector'))$('selector').style.display='none';$('tagframe').style.display='none';$('size_4').style.display='none';$('photoTagConfirm_manTip').style.display="none";$('photoTagConfirm_thingTip').style.display="none";tagging=false;}
function showTagArea(m){if(tagging==true)return;var image=$('myphoto');var imageLeft=findX(image);var imageTop=findY(image);tempLeft=parseInt(tag_info[m]['x'])+imageLeft-Math.ceil(tag_info[m]['width'])/2;tempTop=parseInt(tag_info[m]['y'])+imageTop-Math.ceil(tag_info[m]['height'])/2;if(tempLeft>(image.width+imageLeft-Math.ceil(tag_info[m]['width'])/2)){tempLeft=imageLeft+image.width-Math.ceil(tag_info[m]['width'])/2;}
if(tempLeft<imageLeft){tempLeft=imageLeft;}
if(tempTop>(image.height+imageTop-Math.ceil(tag_info[m]['height'])/2)){tempTop=imageTop+image.height-Math.ceil(tag_info[m]['height'])/2;}
if(tempTop<imageTop){tempTop=imageTop;}
$('tagframe').style.left=(tempLeft-10)+'px';$('tagframe').style.top=(tempTop-10-document.body.scrollTop)+'px';$('tagframe').style.width=tag_info[m]['width']+'px';$('tagframe').style.height=tag_info[m]['height']+'px';$("tagframeinside").style.width=(tag_info[m]['width']-10)+"px";$("tagframeinside").style.height=(tag_info[m]['height']-10)+"px";$('tagframe').style.display='';}
function showConfirmTagArea(tagid,x,y,ow,oh){if(ow==""||oh==""){return;}
var tagframeConst=46;var image=$("tagimg_"+tagid);var imageLeft=findX(image);var imageTop=findY(image);var taginfoTop=0;var recUp=0;var recRight=0;var recDown=0;var recLeft=0;var xratelength=0;var yratelength=0;var rate=0;if(ow>oh){rate=image.width/ow;x=x*rate;yratelength=(image.height-parseInt(oh*rate))/2
y=y*rate+yratelength;}else{rate=image.height/oh;y=y*rate;xratelength=(image.width-parseInt(ow*rate))/2
x=x*rate+xratelength;}
tempLeft=parseInt(x)-tagframeConst/2;tempTop=parseInt(y)-tagframeConst/2;taginfoTop=tempTop+tagframeConst+1;taginfoLeft=tempLeft;if(tempLeft>(image.width-tagframeConst)){tempLeft=image.width-tagframeConst;taginfoTop=tempTop-14;}
if(tempLeft<xratelength){taginfoLeft=tempLeft=xratelength;}
if(tempTop>(image.height-tagframeConst)){tempTop=image.height-tagframeConst;taginfoTop=tempTop-14;}
if(tempTop<yratelength){tempTop=yratelength;taginfoTop=tempTop+tagframeConst+1}
$('tagframe_'+tagid).style.left=parseInt(tempLeft)+"px";$('tagframe_'+tagid).style.top=parseInt(tempTop)+"px";recUp=tempTop;recRight=tempLeft+tagframeConst;recDown=tempTop+tagframeConst;recLeft=tempLeft;if(recUp<0){recUp=0;}
if(recRight<0){recRight=0;}
if(recDown<0){recDown=0;}
if(recLeft<0){recLeft=0;}
$('covertag_'+tagid).style.clip="rect("+recUp+"px,"+recRight+"px,"+recDown+"px,"+recLeft+"px)"
$('tagframe_'+tagid).style.display='';$('covertag_'+tagid).style.left=0;$('covertag_'+tagid).style.Top=0;$('taginfo_'+tagid).style.left=parseInt(taginfoLeft)+"px";$('taginfo_'+tagid).style.top=parseInt(taginfoTop)+"px";$('taginfo_'+tagid).style.display='';}
function hiddenTagArea(){if(tagging==true){return;}
$('tagframe').style.display='none';resetframe();}
function showTags(){var m=0;var tagHtml_man='';var tagHtml_thing='';if(!tag_info[0]['id']){$('photoTags_manArea').innerHTML='';$('photoTags_thingArea').innerHTML='';return;}
var len=tag_info.length;for(m=0;m<len;m++){if(tag_info[m]['tagged_text']=="")continue;if(tag_info[m]['ifpeople']=="1")tagHtml=tagHtml_man;else tagHtml=tagHtml_thing;if(tagHtml!='')tagHtml+='|&nbsp;&nbsp;';tagHtml+='<span onmouseover="showTagArea('+m+');" onmouseout="hiddenTagArea();">';if(tag_info[m]['tagged_id']!=''&&tag_info[m]['tagged_id']!='0')tagHtml+='<a class="more" href="/modules/space.php?uid='+tag_info[m]['tagged_id']+'">'+tag_info[m]['tagged_text']+'</a>';else tagHtml+='<span class="more">'+tag_info[m]['tagged_text']+'</span>';tagHtml+='</span>&nbsp;&nbsp;';if(isMyPage==0||loginUserId==accessUserId)tagHtml+='(<span style="cursor:pointer" onclick="removeTag('+m+');" >删除标记</span>)&nbsp;&nbsp;</span>';if(tag_info[m]['ifpeople']=="1")tagHtml_man=tagHtml;else tagHtml_thing=tagHtml;}
$('photoTags_manArea').innerHTML=tagHtml_man;$('photoTags_thingArea').innerHTML=tagHtml_thing;}
function removeTag(m){pop_w=new Popup({contentType:3,isReloadOnClose:true,width:250,height:80});pop_w.setContent("title","提示信息");pop_w.setContent("confirmCon","你确实要删除该标记吗？");pop_w.setContent("callBack",removeTagPro);pop_w.setContent("parameter",{m:m});pop_w.build();pop_w.show();}
function removeTagPro(parameter){pop_w.close();pop_w=new Popup({contentType:2,isReloadOnClose:false,width:200,height:50});pop_w.setContent("title","删除标记");pop_w.setContent("contentHtml","<div style='margin-top:35px;margin-bottom:40px;margin-left:20px;font-size:14px'>正在删除,请稍候...</div>");pop_w.build();pop_w.show();var url="/ajax/photoalbum.php";var par=new Array();m=parameter["m"];pars="act=delTag";par.push(pars);pars="tagId="+tag_info[m]['id'];par.push(pars);pars="photoId="+photoId;par.push(pars);pars="ofuserid="+tag_info[m]['ofuser'];par.push(pars);pars=par.join("&");new Ajax.Request(url,{method:'post',parameters:pars,onComplete:function(e){var allcon=e.responseText;pop_w.setContent("contentHtml","<div style='margin-top:35px;margin-bottom:40px;margin-left:20px;font-size:14px'>操作成功!</div>");tag_info=eval(allcon);showTags();$('tagframe').style.display='none';if($('selector'))$('selector').style.display='none';pop_w.reBuild();pop_w.show();setTimeout("pop_w.close()",1000);}});}
var phototagid;var confirmTagflag;function confirmTag(tagid,flag)
{confirmTagflag=flag;phototagid=tagid;o_pop=new Popup({contentType:2,isReloadOnClose:false,width:300,height:120});o_pop.setContent("title","友情提示");o_pop.setContent("contentHtml","<div style='margin-top:35px;margin-bottom:40px;margin-left:20px;font-size:14px'>正在操作，请稍候……</div>");o_pop.build();o_pop.show();var url="/ajax/photoalbum.php";var par=new Array();pars="act=confirmTag";par.push(pars);pars="tagid="+tagid;par.push(pars);pars="flag="+flag;par.push(pars);pars=par.join("&");new Ajax.Request(url,{method:'post',parameters:pars,onComplete:confirmTagDone});}
function confirmTagDone(e){var tmp=eval("("+e.responseText+")");if(tmp.rtn_code=="nosession"){login_user_ajax();}else if(tmp.rtn_code=="1"){if(confirmTagflag=="1"){document.getElementById("confirm_button_"+phototagid).innerHTML="<span style='color:#008800;font-weight:bold;'>标记已确认！</span>";}else{document.getElementById("confirm_button_"+phototagid).innerHTML="<span style='color:red;font-weight:bold;'>标记已拒绝！</span>";}
effect=new Effect.Highlight("tagid_"+phototagid,{duration:2.0});o_pop.close();}else{o_pop.setContent("contentHtml","<div style='margin-top:35px;margin-bottom:40px;margin-left:20px;font-size:14px'>操作失败,请稍后再试!</div>");o_pop.setContent("time_out",1000);o_pop.reBuild();o_pop.show();}}
var oldpos=null;var newpos=null;var isresize="0";var width=frameWidth;var height=frameHeight;function startchange(e){oldpos=getMousePos(e);isresize="1";width=frameWidth;height=frameHeight;if($('selector'))$("selector").style.display='none';document.onmousemove=changebox;document.onmouseup=stopchange;document.onselectstart=function(){return false};}
function stopchange(e){isresize="0";width=0;height=0;var pos=getPos($("tagframe"));if($('selector'))$("selector").style.left=(pos.x+frameWidth+20)+"px";if($('selector'))$("selector").style.top=pos.y+"px";if($('selector'))$("selector").style.display='';document.onmousemove=null;document.onmouseup=null;document.onselectstart=function(){return true}}
function get_scroll(o){var of=new Array();var x=0;var y=0;if(o.parentNode!=null)
{var par=o.parentNode
while(par!=document.body)
{x+=par.scrollLeft;y+=par.scrollTop;par=par.parentNode;}}
return{left:x,top:y};}
function getPos(e){var left=0;var top=0;var scrolls=get_scroll(e);while(e.offsetParent){left+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);e=e.offsetParent;}
left+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);top+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);left=left-scrolls.left;top=top-scrolls.top;return{x:left,y:top};}
function getMousePos(e){var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX){posx=e.pageX;posy=e.pageY;}
else if(e.clientX&&document.body.scrollLeft){posx=e.clientX+document.body.scrollLeft;posy=e.clientY+document.body.scrollTop;}
else if(e.clientX&&document.documentElement.scrollLeft){posx=e.clientX+document.documentElement.scrollLeft;posy=e.clientY+document.documentElement.scrollTop;}
else if(e.clientX){posx=e.clientX;posy=e.clientY;}
return{x:posx,y:posy};}
function changebox(e){if(isresize!="1"){return;}
newpos=getMousePos(e);var imgpos=getPos($("myphoto"));var ismoved=0;var img=$("myphoto");var maxh=img.height;var maxw=img.width;if(oldpos!=null){if(oldpos.x>=newpos.x&&newpos.x>imgpos.x){if(frameWidth>20){var temp=oldpos.x-newpos.x;$("tagframe").style.width=width-temp+"px";frameWidth=width-temp;$("tagframeinside").style.width=(width-temp-10)+"px";ismoved=1;}}else{if(frameWidth<maxw-10&&newpos.x<(imgpos.x+maxw)){var temp=newpos.x-oldpos.x;$("tagframe").style.width=(width+temp)+"px";frameWidth=width+temp;$("tagframeinside").style.width=(width+temp-10)+"px";ismoved=1;}}
if(oldpos.y>=newpos.y&&newpos.y>imgpos.y){if(frameHeight>20){var temph=oldpos.y-newpos.y;$("tagframe").style.height=(height-temph)+"px";frameHeight=height-temph;$("tagframeinside").style.height=(height-temph-10)+"px";ismoved=1;}}else{if(frameHeight<maxh-10&&newpos.y<(imgpos.y+maxh)){var temph=newpos.y-oldpos.y;$("tagframe").style.height=(height+temph)+"px";frameHeight=height+temph;$("tagframeinside").style.height=(height+temph-10)+"px";ismoved=1;}}
if(ismoved==1){$("size_4").style.left=newpos.x+"px";$("size_4").style.top=newpos.y+"px";g_image_x=parseInt($("tagframe").style.left)+(frameWidth/2)-findX(img)+8;g_image_y=parseInt($("tagframe").style.top)+(frameHeight/2)-findY(img)+8;updateMoveDiv();}}else{tagging=true;}
if(is_ie)document.selection.empty();else window.getSelection().removeAllRanges();}
function updateMoveDiv(){$("size_4").style.display="";var pos=getPos($("tagframe"));$("size_4").style.top=(pos.y+frameHeight+10)+"px";$("size_4").style.left=(pos.x+frameWidth+10)+"px";tagresize_top=pos.y+frameHeight+10;if(document.body.scrollTop!=0){tagresize_top+=document.body.scrollTop;}}
function resetframe(){frameWidth=165;frameHeight=165;var pos=getPos($("myphoto"));$("tagframe").style.left=(pos.x+10)+'px';$("tagframe").style.top=(pos.y+10)+'px';$("tagframe").style.height="165px";$("tagframe").style.width="165px";$("tagframeinside").style.width="160px";$("tagframeinside").style.height="160px";}