
var g_taghtml="";var clickview=false;function tag()
{if(rotateing)
{return;}
if(tagobj!=null)
{tagobj.reset();}
else
{if(g_taghtml==""){g_taghtml=$("taghtml").innerHTML;$("taghtml").innerHTML="";}
var html=g_taghtml;tagobj=new Cropper.Img('photo1',{onEndCrop:onEndCrop,hasTip:true,tipCss:"width:200px;margin-top:4px;z-index:500;color:#333333;position:absolute;",tipHtml:html});}
if(photo_vuid==photo_puid)
{$("usertagtextdiv").innerHTML='请单击并拖动鼠标圈出您的好友，并输入对方的姓名，此照片就会自动出现在该好友的相册中。';}
else
{$("usertagtextdiv").innerHTML='请单击并拖动鼠标圈出您的好友，并输入对方的姓名，此信息经上传者确认后，这张照片会出现在该好友的相册中。<br />系统会发消息给<a href="/home/?uid='+photo_puid+'" class="sl">'+user_list["_"+photo_puid]["real_name"]+'</a>确认你的圈人请求。';}
$("tagtip").style.display="block";taging=true;resetmask();window.location.hash="#divtop";document.body.onselectstart=function(){return false;};new friendSuggest("tipinput","请输入好友的姓名","");}
function tagclose()
{if(tagobj!=null)
{tagobj.remove();}
$("tagtip").style.display="none";taging=false;resetmask();document.body.onselectstart=function(){};}
function onEndCrop(coords,dimensions)
{$('x1').value=coords.x1;$('y1').value=coords.y1;$('x2').value=coords.x2;$('y2').value=coords.y2;}
function tagdelajaxshow(req)
{var r=req.responseText;if(r==0)
{return false;}
tagclose();var newmark=[];var j=0;var delnum;for(var i=0;i<mark_list[markdata].length;i++)
{if(mark_list[markdata][i].markid==r)
{delnum=i;continue;}
newmark[j]=mark_list[markdata][i];j++;}
mark_list[markdata]=newmark;tagdelborder(delnum);tagtitles();}
function tagaddajaxshow(req)
{if(req.responseText==0)
{return false;}
$("usertagtextdiv").innerHTML='<img src="http://img1.kaixin001.com.cn/i2/photo/success.gif"> 圈人已成功！请继续圈人，或点击按钮“结束圈人”操作';eval("r="+req.responseText);tagobj.reset();var flag=false;for(var i=0;i<mark_list[markdata].length;i++)
{if(mark_list[markdata][i].mark_uid==r.mark_uid&&r.mark_uid!=0)
{mark_list[markdata][i]=r;flag=true;}}
if(false==flag)
{mark_list[markdata][mark_list[markdata].length]=r;}
tagaddborder(mark_list[markdata].length-1);tagtitles();}
function tagaddborder(ordernum,skipReset)
{if(rotateing)
{return;}
var info=mark_list[markdata][ordernum];if($('tagborder'+ordernum))
{return;}
if(1&&'undefined'!=typeof skipReset&&true===skipReset){return;}else{resetmask();}
var tagborder=document.createElement('div');tagborder.style.cssText="position:absolute; z-index:1000;";tagborder.style.left=parseInt((info.x-info.width/2)*$('photo1').width/10000)+"px";tagborder.style.top=parseInt((info.y-info.height/2)*$('photo1').height/10000)+"px";tagborder.style.height=parseInt(info.height*$('photo1').height/10000)+"px";tagborder.style.width=parseInt(info.width*$('photo1').width/10000)+"px";tagborder.id='tagborder'+ordernum;tagborder.innerHTML="<div style=\"width:tagborder.style.width;\"><div style='border:solid #FFFFFF 3px;'><div style='border:solid #D01E3B 3px;width:"
+(parseInt(tagborder.style.width)-12)+"px;height:"
+(parseInt(tagborder.style.height)-12)+"px;'></div></div>";tagborder.innerHTML+="<center><div style=\"z-index:1000; margin-top:5px;border:1px solid #ffffff;background:#D01E3B;color:#ffffff;font: bold 14px;padding:2px;text-align:center;width:"+b_strlen(info.title)+"em;\"><b>"+info.title+"</b></div></center></div>";$('photodiv2').appendChild(tagborder);}
function tagdelborder(ordernum)
{var tagborder=$("tagborder"+ordernum);if(tagborder)
{$('photodiv2').removeChild(tagborder);}}
function imageonclick(evnt)
{if(mark_list[markdata])
{for(var i=0;i<mark_list[markdata].length;i++)
{tagdelborder(i);}}
var photopos1=getpos($("photodiv1"));var photopos2=getpos($("photodiv2"));var x=1;if(evnt)
{x=(parseInt(evnt.clientX)-photopos1.left-photopos2.left)/$("photo1").width;}
if(x>0.5)
{viewnext();}
if(x<=0.5)
{viewprev();}}
function imageonmousemove(evnt)
{var photopos1=getpos($("photodiv1"));var photopos2=getpos($("photodiv2"));var x=y=1;if(evnt)
{x=(parseInt(evnt.clientX)-photopos1.left-photopos2.left)*10000/$("photo1").width;y=(parseInt(evnt.clientY)-photopos1.top-photopos2.top+parseInt(document.body.scrollTop+document.documentElement.scrollTop))*10000/$("photo1").height;}
if(mark_list[markdata])
{for(var i=0;i<mark_list[markdata].length;i++)
{var obj=mark_list[markdata][i];if(parseInt(obj.width)/2+parseInt(obj.x)>x&&parseInt(obj.x)-parseInt(obj.width)/2<x&&parseInt(obj.height)/2+parseInt(obj.y)>y&&parseInt(obj.y)-parseInt(obj.height)/2<y)
{if(1&&true===g_skip_reset){tagaddborder(i,true);}else{tagaddborder(i);}}
else
{tagdelborder(i);}}}
if(evnt)
{nx=(parseInt(evnt.clientX)-photopos1.left-photopos2.left)/$("photo1").width;if(nx>0.5)
{$("photo1").style.cursor="url("+"http://img1.kaixin001.com.cn/i2/photo/right.cur"+"),auto";$("photo1").title="点击跳到下一张>>";}
if(nx<=0.5)
{$("photo1").style.cursor="url("+"http://img1.kaixin001.com.cn/i2/photo/left.cur"+"),auto";$("photo1").title="<<点击跳到上一张";}}
g_skip_reset=false;}
function zoomEx(obj,value,solidwidth)
{if(zoomlevel==0)
{obj.width=$("realwidth").value;obj.height=$("realheight").value;}
else
{if(solidwidth)
{if(value>1)
{if(parseInt(obj.width)*value>solidwidth&&parseInt(obj.width)<solidwidth)
{obj.height=parseInt(solidwidth*parseInt(obj.height)/parseInt(obj.width));obj.width=solidwidth;}
else
{obj.width=parseInt(obj.width)*value;obj.height=parseInt(obj.height)*value;}}
else
{if(parseInt(obj.width)*value<solidwidth&&parseInt(obj.width)>solidwidth)
{obj.height=parseInt(solidwidth*parseInt(obj.height)/parseInt(obj.width));obj.width=solidwidth;}
else
{obj.width=parseInt(obj.width)*value;obj.height=parseInt(obj.height)*value;}}}
else
{obj.width=parseInt(obj.width)*value;obj.height=parseInt(obj.height)*value;}}}
function zoom(value,solidwidth)
{if(value>1)
{zoomlevel+=1;}
else
{zoomlevel-=1;}
var obj=$("photo1");zoomEx(obj,value,solidwidth);var obj=$("photo2");zoomEx(obj,value,solidwidth);resetmask();}
function rotate(value)
{if(taging||!IsIE())
{return;}
rotatevalue=(value+rotatevalue)%4;var obj=$("photo1");if(rotatevalue)
{obj.style.filter="progid:DXImageTransform.Microsoft.BasicImage(   Rotation="+rotatevalue+")";}
else
{obj.style.filter="";}
var obj=$("photo2");if(rotatevalue)
{obj.style.filter="progid:DXImageTransform.Microsoft.BasicImage(   Rotation="+rotatevalue+")";}
else
{obj.style.filter="";}
rotateing=rotatevalue!=0;var v_tmp=$("photodiv4").style.height;$("photodiv4").style.height=parseInt($("photodiv4").style.width)+"px";$("photodiv4").style.width=parseInt(v_tmp)+"px";v_tmp=$("photodiv2").style.height;$("photodiv2").style.height=parseInt($("photodiv2").style.width)+"px";$("photodiv2").style.width=parseInt(v_tmp)+"px";$('photodiv1').style.height=parseInt($('photodiv2').style.height)+"px";$('photodiv3').style.height=parseInt($('photodiv4').style.height)+"px";if($('photo1').style.left!="")
{$('photodiv2').style.left=parseInt($('photo1').style.left)+"px";$('photodiv4').style.left=parseInt($('photo2').style.left)+"px";}
if($('photo1').style.top!="")
{$('photodiv2').style.top=parseInt($('photo1').style.top)+"px";$('photodiv4').style.top=parseInt($('photo2').style.top)+"px";}}
function zp_qp_set()
{if($("zp_lb").style.display=="none")
{partviewmode();}
else
{wholeviewmode();}}
var g_skip_reset;function resetmask()
{if(rotatevalue%2)
{if(taging)
{if(parseInt($('photo1').height)<200)
{$('photodiv2').style.width="200px";$('photodiv4').style.width="200px";}
else
{$('photodiv2').style.width=parseInt($('photo1').height)+"px";$('photodiv4').style.width=parseInt($('photo2').height)+"px";}
$('photodiv2').style.height=(parseInt($('photo1').width)+200)+"px";}
else
{$('photodiv2').style.width=parseInt($('photo1').height)+"px";$('photodiv2').style.height=parseInt($('photo1').width)+"px";$('photodiv4').style.width=parseInt($('photo2').height)+"px";}
$('photodiv4').style.height=parseInt($('photo2').width)+"px";}
else
{if(taging)
{if(parseInt($('photo1').width)<200)
{$('photodiv2').style.width="200px";$('photodiv4').style.width="200px";}
else
{$('photodiv2').style.width=parseInt($('photo1').width)+"px";$('photodiv4').style.width=parseInt($('photo2').width)+"px";}
$('photodiv2').style.height=(parseInt($('photo1').height)+200)+"px";}
else
{$('photodiv2').style.width=parseInt($('photo1').width)+"px";$('photodiv2').style.height=parseInt($('photo1').height)+"px";$('photodiv4').style.width=parseInt($('photo2').width)+"px";}
$('photodiv4').style.height=parseInt($('photo2').height)+"px";}
$('photodiv1').style.height=parseInt($('photodiv2').style.height)+"px";$('photodiv3').style.height=parseInt($('photodiv4').style.height)+"px";if($('photo1').style.left!="")
{$('photodiv2').style.left=parseInt($('photo1').style.left)+"px";$('photodiv4').style.left=parseInt($('photo2').style.left)+"px";}
if($('photo1').style.top!="")
{$('photodiv2').style.top=parseInt($('photo1').style.top)+"px";$('photodiv4').style.top=parseInt($('photo2').style.top)+"px";}
g_skip_reset=true;imageonmousemove();}
function partviewmode()
{var v_maxsize=780;while($("photo1").width>v_maxsize)
{zoom(0.833,v_maxsize);}
$("zp_lb").style.display="block";$("zp_qp").src="http://img1.kaixin001.com.cn/i/zp_qp1_on.gif";if($("zp_m"))
{$("zp_m").className="zp_m";}
$("photodiv1").className="zp_zs2";$('photodiv2').style.textAlign="left";$("photodiv3").className="zp_zs2";$('photodiv4').style.textAlign="left";setCookie("viewmode","part");initloadingdiv();}
function wholeviewmode()
{if(zoomlevel)
{zoomlevel=1;zoom(0.833,0);}
$("zp_lb").style.display="none";$("zp_qp").src="http://img1.kaixin001.com.cn/i/zp_qp2_on.gif";if($("zp_m"))
{$("zp_m").className="zp_m2";}
$("photodiv1").className="zp_zs3";$('photodiv2').style.textAlign="left";$("photodiv3").className="zp_zs3";$('photodiv4').style.textAlign="left";setCookie("viewmode","whole");$("loadingdiv").style.width=$("realwidth").value;$("loadingdiv").style.paddingLeft="0px";}
function photodivonmouseover()
{$("zp_qp").style.visibility="visible";s("zp_qp1");var viewmode=getViewMode();if(viewmode=="part"&&parseInt($("realwidth").value)<791)
{$("zp_qp").style.visibility="hidden";h("zp_qp1");}}
function photodivonmouseout()
{$("zp_qp").style.visibility="hidden";h("zp_qp1");var viewmode=getViewMode();if(viewmode=="part"&&parseInt($("realwidth").value)>=791)
{$("zp_qp").style.visibility="visible";s("zp_qp1");}}
function getViewMode()
{var viewmode=getCookie("viewmode");viewmode=(viewmode!="whole")?"part":viewmode;return viewmode;}
function getPhotoWH(v_width,v_height)
{var a_wh=new Array;a_wh[0]=a_wh[1]=60;v_width=parseInt(v_width);v_height=parseInt(v_height);if(v_width>v_height)
{a_wh[1]=Math.ceil(a_wh[0]*v_height/v_width);}
else
{a_wh[0]=Math.ceil(a_wh[1]*v_width/v_height);}
return a_wh;}
function viewprev()
{clickview=true;var new_pos=(photo_pos+photo_total-1)%photo_total;viewphoto(new_pos);}
function viewnext()
{clickview=true;var new_pos=(photo_pos+1)%photo_total;viewphoto(new_pos);}
var g_loadtimes=0;function onphotoload(v_img)
{if(photo_list&&photo_list[photo_pos]&&photo_list[photo_pos]["small"])
{if(v_img.src==photo_list[photo_pos]["big"])
{var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;if(window.netscape||isOpera)
{g_loadtimes++;if(g_loadtimes>1)
{h("loadingdiv");}}
else
{h("loadingdiv");}}
else
{h("loadingdiv");}}
else
{h("loadingdiv");}
v_img.alt="";}
function initloadingdiv()
{g_loadtimes=0;var pTop=($("realheight").value-42)/2;if(pTop<0)
{pTop=0;}
else if(pTop>200)
{pTop=200;}
if(parseInt($("realwidth").value)>780)
{$("loadingdiv").style.width="780px";}
else
{$("loadingdiv").style.width=$("realwidth").value+"px";}
$("loadingdiv").style.paddingTop=pTop+"px";}
function exif()
{if($('exif').style.display=='')
{$('exif').style.display='none';}
else
{$('exif').style.display='';}}