function delphoto(){openWindow("myalbum_del_dialog.php?pid="+photo_pid,330,280,"\u5220\u9664\u7167\u7247")}function delphoto_do(a){document.delphotoform.pid.value=a;document.delphotoform.from.value=$("returnlink").href;document.delphotoform.submit()}function editphoto(){openWindow("photo_edit_dialog.php?pid="+photo_pid,460,350,"\u4fee\u6539\u7167\u7247\u6807\u9898\u548c\u5c5e\u6027")}
function editphoto_do(a,c,d){var b=window.location.href.split("#");document.editform.from.value=b[0]+"&pid="+photo_pid+"&puid="+photo_puid+"&gid="+photo_gid;document.editform.pid.value=a;document.editform.albumid.value=d;document.editform.title.value=c;document.editform.submit()}function sendtogrpalbum(){openWindow("sendtogrpalbum_dialog.php?pid="+photo_pid,330,180,"\u590d\u5236\u5230\u7fa4\u76f8\u518c")}
function sharephoto(a){openWindow("sharephoto_dialog.php?type=im&uid="+photo_puid+"&pid="+photo_pid+"&syscode="+a,460,450,"\u7167\u7247\u5206\u4eab")}
function tagaddsubmit(){if($("tipinput").value.length==0){alert("\u8bf7\u8f93\u5165\u4eba\u7269\u7684\u59d3\u540d");$("tipinput").focus()}else{var a=parseInt($("x1").value),c=parseInt($("x2").value),d=parseInt($("y1").value),b=parseInt($("y2").value),e=parseInt(1E4*(c+a)/2/$("photo1").width),f=parseInt(1E4*(b+d)/2/$("photo1").height);a=parseInt(1E4*(c-a)/$("photo1").width);d=parseInt(1E4*(b-d)/$("photo1").height);b=f_seluid;c=encodeURIComponent($("tipinput").value);new Ajax.Request("/photo/markadd.php",
{method:"post",parameters:"x="+e+"&y="+f+"&width="+a+"&height="+d+"&photouid="+photo_puid+"&pid="+photo_pid+"&mark_uid="+b+"&title="+c,onComplete:function(g){tagaddajaxshow(g)}})}}function tagdelsubmit(a,c){new Ajax.Request("/photo/markdel.php",{method:"post",parameters:"markid="+a+"&pid="+photo_pid+"&mark_uid="+c,onComplete:function(d){tagdelajaxshow(d)}})}
function tagtitles(){$("tagtitles").innerHTML="";var a;a=photo_vuid==photo_puid?'<div class="zp_bqr_w" style="z-index:_ZINDEX_;" onmouseover="tagaddborder(_ORDERNUM_);s(\'tagdel_ORDERNUM_\');" onmouseout="tagdelborder(_ORDERNUM_);h(\'tagdel_ORDERNUM_\');">_TITLE_<div id="tagdel_ORDERNUM_" class="zp_bqr_n"><table><tr><td nowrap="nowrap">_TITLE_[<a href="javascript:tagdelsubmit(_MARKID_,\'_MARK_UID_\');" class="gbh">\u00d7</a>]</td></tr></table></div></div><div class="l">_COMMA_</div>':'<div class="zp_bqr_w" style="z-index:_ZINDEX_;" onmouseover="tagaddborder(_ORDERNUM_);s(\'tagdel_ORDERNUM_\');" onmouseout="tagdelborder(_ORDERNUM_);h(\'tagdel_ORDERNUM_\');">_TITLE_<div id="tagdel_ORDERNUM_" class="zp_bqr_n"><table><tr><td nowrap="nowrap">_TITLE_</td></tr></table></div></div><div class="l">_COMMA_</div>';
for(var c=markdata,d=0;d<mark_list[c].length;d++){var b=a;b=mark_list[c][d].mark_uid!="0"&&mark_list[c][d].mark_uid!=""?b.replace(/_TITLE_/g,"<a href=/home/?uid="+mark_list[c][d].mark_uid+" class=sl>"+mark_list[c][d].title+"</a>"):b.replace(/_TITLE_/g,mark_list[c][d].title);b=b.replace(/_ORDERNUM_/g,d);b=b.replace(/_ZINDEX_/g,1E4-d);b=b.replace(/_MARKID_/g,mark_list[c][d].markid);b=b.replace(/_MARK_UID_/g,mark_list[c][d].mark_uid);b=b.replace(/_COMMA_/g,d==mark_list[c].length-1?"":",");$("tagtitles").innerHTML+=
b}if(mark_list[c].length)$("tagframe").style.display="block";else $("tagframe").style.display="none"}
function photoinit(){IsIE()||h("rotatediv");photo_gid?h("divmark"):s("divmark");var a=$("photo1");a.width=$("realwidth").value;a.height=$("realheight").value;a=$("photo2");a.width=$("realwidth").value;a.height=$("realheight").value;showPhotoMoreInfo();getViewMode()=="part"?partviewmode():wholeviewmode();resetmask();photodivonmouseout();showiconlist(photo_puid,photo_pid,photo_gid,album_id,photo_pos)}
function showPhotoMoreInfo(){tagclose();tagtitles();$("albumtitlediv").innerHTML="";$("usertagtextdiv").innerHTML="";$("exif").innerHTML="";if(photo_gid){if(typeof group_list["_"+photo_gid]=="undefined"){getGUAInfo("group","_"+photo_gid);return}if(typeof album_list["g_"+photo_gid+"_"+album_id]=="undefined"){getGUAInfo("album","g_"+photo_gid+"_"+album_id);return}$("albumtitlediv").innerHTML='\u4e13\u8f91\uff1a<a href="/group/group.php?gid='+photo_gid+'" title="'+group_list["_"+photo_gid]+'" class="sl">'+
group_list["_"+photo_gid]+'</a>\u7fa4\u7684\u76f8\u518c\u4e13\u8f91 <a href="/group/album.php?gid='+photo_gid+"&albumid="+album_id+'" class="sl" title="'+album_list["g_"+photo_gid+"_"+album_id].title+'">'+album_list["g_"+photo_gid+"_"+album_id]["title-short"]+"</a>("+album_list["g_"+photo_gid+"_"+album_id].picnum+") "+album_list["g_"+photo_gid+"_"+album_id].privacyicon;g_is_privacy_pwd="0"}else{if(photo_uid==photo_puid){if(typeof album_list["u_"+photo_puid+"_"+album_id]=="undefined"){getGUAInfo("album",
"u_"+photo_puid+"_"+album_id);return}$("albumtitlediv").innerHTML='\u4e13\u8f91\uff1a<a href="album.php?uid='+photo_puid+"&albumid="+album_id+'" class="sl" title="'+album_list["u_"+photo_puid+"_"+album_id].title+'">'+album_list["u_"+photo_puid+"_"+album_id]["title-short"]+"</a>("+album_list["u_"+photo_puid+"_"+album_id].picnum+") "+album_list["u_"+photo_puid+"_"+album_id].privacyicon}else{if(typeof user_list["_"+photo_puid]=="undefined"){getGUAInfo("user","_"+photo_puid);return}if(typeof album_list["u_"+
photo_puid+"_"+album_id]=="undefined"){getGUAInfo("album","u_"+photo_puid+"_"+album_id);return}$("albumtitlediv").innerHTML='\u4e13\u8f91\uff1a<a href="/home/?uid='+photo_puid+'" title="'+user_list["_"+photo_puid].real_name+'" class="sl">'+user_list["_"+photo_puid].real_name+'</a>\u7684\u4e13\u8f91<a href="album.php?uid='+photo_puid+"&albumid="+album_id+'" class="sl" title="'+album_list["u_"+photo_puid+"_"+album_id].title+'">'+album_list["u_"+photo_puid+"_"+album_id]["title-short"]+"</a>("+album_list["u_"+
photo_puid+"_"+album_id].picnum+") "+album_list["u_"+photo_puid+"_"+album_id].privacyicon}g_is_privacy_pwd=parseInt(album_list["u_"+photo_puid+"_"+album_id].privacy)==2?"1":"0"}if(photo_vuid!=photo_puid)if(typeof user_list["_"+photo_puid]=="undefined"){getGUAInfo("user","_"+photo_puid);return}if(typeof mark_list[photo_pid+"_"+photo_puid+"_"+photo_gid]=="undefined")getGUAInfo("mark",photo_pid+"_"+photo_puid+"_"+photo_gid);else{markdata=photo_pid+"_"+photo_puid+"_"+photo_gid;var a=markdata+"_"+photo_pos,
c=true;if(back_ajax&&parseInt(back_ajax,10)==1){c=false;back_ajax=0}c&&clickDirect(a,true);tagtitles();if(typeof user_list["_"+photo_puid]=="undefined")getGUAInfo("user","_"+photo_puid);else{if(!photo_gid){$("comment_div").innerHTML="";Kx.Comment("comment_div").show({vuid:photo_vuid,owneruid:photo_puid,type:"1",id:photo_pid,oreal_name:user_list["_"+photo_puid].real_name,comment_right:parseInt(user_list["_"+photo_puid].comment_right)},"comment_head")}showPhotoExifInfo()}}}
function showPhotoExifInfo(){var a=photo_pid+"_"+photo_puid+"_"+photo_gid;if(typeof exif_list[a]=="undefined")getGUAInfo("exif",a);else{$("exif").innerHTML="";if(exif_list[a]!=""&&exif_list[a].EXIF!="0"){if(exif_list[a].Make&&exif_list[a].Make!="")$("exif").innerHTML+="\u5382\u5546 "+exif_list[a].Make+"<br>";if(exif_list[a].Model&&exif_list[a].Model!="")$("exif").innerHTML+="\u578b\u53f7 "+exif_list[a].Model+"<br>";if(exif_list[a].DateTimeOriginal&&exif_list[a].DateTimeOriginal!="")$("exif").innerHTML+=
"\u65e5\u671f "+exif_list[a].DateTimeOriginal+"<br>";if(exif_list[a].Width&&exif_list[a].Width!="")$("exif").innerHTML+="\u5927\u5c0f "+exif_list[a].Width+" x "+exif_list[a].Height+"<br>";if(exif_list[a].FocalLength&&exif_list[a].FocalLength!="")$("exif").innerHTML+="\u7126\u8ddd "+exif_list[a].FocalLength+"<br>";if(exif_list[a].ApertureValue&&exif_list[a].ApertureValue!="")$("exif").innerHTML+="\u5149\u5708 "+exif_list[a].ApertureValue+"<br>";if(exif_list[a].ExposureTime&&exif_list[a].ExposureTime!=
"")$("exif").innerHTML+="\u66dd\u5149\u65f6\u95f4 "+exif_list[a].ExposureTime+"<br>";if(exif_list[a].ISOSpeedRatings&&exif_list[a].ISOSpeedRatings!="")$("exif").innerHTML+="\u611f\u5149\u5ea6 "+exif_list[a].ISOSpeedRatings+"<br>";if(exif_list[a].Flash&&exif_list[a].Flash!="")$("exif").innerHTML+="\u95ea\u5149\u706f "+exif_list[a].Flash+"<br>"}if($("exif").innerHTML=="")$("exif").innerHTML="\u8be5\u7167\u7247\u65e0EXIF\u4fe1\u606f"}}
function getGUAInfo(a,c){new Ajax.Request("/photo/item.php",{method:"post",parameters:"type="+a+"&id="+c+"&rotate="+photo_list[photo_pos].rotate,onComplete:function(d){getGUAInfoajaxshow(d)}})}
function getGUAInfoajaxshow(a){eval("r="+a.responseText);if(!parseInt(r.ret)){if(r.type=="group")group_list[r.id]=r.data[r.id];else if(r.type=="user")user_list[r.id]=r.data[r.id];else if(r.type=="album")album_list[r.id]=r.data[r.id];else if(r.type=="mark")mark_list[r.id]=r.data[r.id];else{if(r.type=="exif"){exif_list[r.id]=r.data[r.id];showPhotoExifInfo()}return}showPhotoMoreInfo()}}
function findpid(a,c,d){var b,e=-1;if(photo_list.length)e=-2;for(b=0;b<photo_list.length;b++)if(photo_list[b]!=null){if(parseInt(photo_list[b].pid)==parseInt(c)&&parseInt(photo_list[b].uid)==parseInt(a)&&parseInt(photo_list[b].gid)==parseInt(d))return b}else e=-3;return e}
function showiconlist(a,c,d,b,e){a=findpid(a,c,d);if(a<0)a!=-2&&iconlistget(b,e);else{photo_pos=a;prev_pos2=(a+photo_total-2)%photo_total;if(photo_list[prev_pos2]==null)iconlistget(b,prev_pos2);else{prev_pos=(a+photo_total-1)%photo_total;if(photo_list[prev_pos]==null)iconlistget(b,prev_pos);else{next_pos=(a+1)%photo_total;if(photo_list[next_pos]==null)iconlistget(b,next_pos);else{next_pos2=(a+2)%photo_total;if(photo_list[next_pos2]==null)iconlistget(b,next_pos2);else{$("totaldiv").innerHTML=photo_pos+
1+"/"+photo_total;if(prev_pos!=photo_pos){$("prevlinkdiv").innerHTML='<a href="javascript:viewprev();" class="sl" title="\u4e0a\u4e00\u5f20">\u4e0a\u4e00\u5f20</a>';$("nextlinkdiv").innerHTML='<a href="javascript:viewnext();" class="sl" title="\u4e0b\u4e00\u5f20">\u4e0b\u4e00\u5f20</a>'}else{$("prevlinkdiv").innerHTML="";$("nextlinkdiv").innerHTML=""}e="";if(prev_pos2!=photo_pos&&prev_pos2!=next_pos&&prev_pos2!=prev_pos&&prev_pos2!=next_pos2){b=getPhotoWH(photo_list[prev_pos2].width,photo_list[prev_pos2].height);
e+='<div class="zp_r_on" onclick="javascript:tagclose();viewphoto('+prev_pos2+');" onmouseover="this.className=\'zp_r_on\';" onmouseout="this.className=\'zp_r_on\';" style="width:'+b[0]+"px; height:"+b[1]+"px;background: url("+photo_list[prev_pos2].small+') center no-repeat;"></div>'}if(prev_pos!=photo_pos&&prev_pos!=next_pos){b=getPhotoWH(photo_list[prev_pos].width,photo_list[prev_pos].height);e+='<div class="zp_r_on" onclick="javascript:tagclose();viewphoto('+prev_pos+');" onmouseover="this.className=\'zp_r_on\';" onmouseout="this.className=\'zp_r_on\';" style="width:'+
b[0]+"px; height:"+b[1]+"px;background: url("+photo_list[prev_pos].small+') center no-repeat;"></div>'}b=getPhotoWH(photo_list[photo_pos].width,photo_list[photo_pos].height);e+='<div style="border:1px solid #999999;margin:5px auto 5px auto; padding:1px;width:'+b[0]+"px; height:"+b[1]+"px;background: url("+photo_list[photo_pos].small+') center no-repeat;"></div>';if(next_pos!=photo_pos){b=getPhotoWH(photo_list[next_pos].width,photo_list[next_pos].height);e+='<div class="zp_r_on" onclick="javascript:tagclose();viewphoto('+
next_pos+');" onmouseover="this.className=\'zp_r_on\';" onmouseout="this.className=\'zp_r_on\';" style="width:'+b[0]+"px; height:"+b[1]+"px;background: url("+photo_list[next_pos].small+') center no-repeat;"></div>'}if(next_pos2!=photo_pos&&next_pos2!=next_pos&&next_pos2!=prev_pos){b=getPhotoWH(photo_list[next_pos2].width,photo_list[next_pos2].height);e+='<div class="zp_r_on" onclick="javascript:tagclose();viewphoto('+next_pos2+');" onmouseover="this.className=\'zp_r_on\';" onmouseout="this.className=\'zp_r_on\';" style="width:'+
b[0]+"px; height:"+b[1]+"px;background: url("+photo_list[next_pos2].small+') center no-repeat;"></div>'}$("iconlist").innerHTML=e+'<div class="w80">&nbsp;</div>';if(photo_gid)h("sharediv");else{b=photo_list[photo_pos].pid;e=photo_list[photo_pos].albumid;a=photo_list[photo_pos].uid;$("sharelink2").href="javascript:showRepasteDlg('0', 'photo_"+a+"_"+b+"-"+e+"','"+a+"');";s("sharediv");uplayerData="";h("support_tips");h("support_ok")}}}}}}}
function showPhotoUpLayer(){photo_pos==undefined||photo_list==""||showUpLayer(1,photo_list[photo_pos].pid,photo_list[photo_pos].uid)}function doPhotoAjaxUp(){photo_pos==undefined||photo_list==""||doAjaxUp(1,photo_list[photo_pos].pid,photo_list[photo_pos].uid)}function iconlistget(a,c){new Ajax.Request("/photo/list.php",{method:"post",parameters:"uid="+photo_uid+"&type="+photo_type+"&albumid="+a+"&start="+Math.floor(c/100)*100,onComplete:function(d){iconlistajaxshow(d)}})}
function iconlistajaxshow(a){eval("r="+a.responseText);if(!parseInt(r.ret))if(photo_total=parseInt(r.total)){for(a=photo_list.length;a<photo_total;a++)photo_list[a]=null;var c=parseInt(r.start);for(a=0;a<r.list.length;a++)photo_list[a+c]=r.list[a];if(g_new_pos){viewphoto(g_new_pos);g_new_pos=0}showiconlist(photo_puid,photo_pid,photo_gid,album_id,(c+100)%photo_total)}}
function viewphoto(a){if(!(a>=photo_total))if(photo_list[a]!=null){photo_pid=parseInt(photo_list[a].pid);photo_puid=parseInt(photo_list[a].uid);photo_gid=parseInt(photo_list[a].gid);photo_pos=parseInt(a);album_id=parseInt(photo_list[a].albumid);var c=new Image;c.onload=function(){$("photo1").src=c.src;$("photo2").src=c.src};c.src="http://img1.kaixin001.com.cn/i2/photo/null.gif";markdata="0_0_0";tagobj=null;taging=false;rotatevalue=zoomlevel=0;rotateing=false;rotate(0);a=parseInt(photo_list[photo_pos].rotate);
if(a==1||a==3){$("realwidth").value=photo_list[photo_pos].height;$("realheight").value=photo_list[photo_pos].width}else{$("realwidth").value=photo_list[photo_pos].width;$("realheight").value=photo_list[photo_pos].height}initloadingdiv();s("loadingdiv");$("phototitlediv").innerHTML='<strong class="f13" style="color:#333;">'+photo_list[photo_pos].title+"</strong>";$("phototimediv").innerHTML="\u65f6\u95f4\uff1a"+photo_list[photo_pos].ctime;if(photo_puid==photo_vuid&&!photo_gid){$("displaydiv1").style.display=
"inline";$("rotatediv").style.display="none";s("diveditphoto");s("sendtogrp");$("rotatediv2").style.display="inline";s("divdelphoto")}else{$("displaydiv1").style.display="none";$("rotatediv").style.display="inline";h("diveditphoto");h("sendtogrp");$("rotatediv2").style.display="none";h("divdelphoto")}$("newwindow").href="/photo/showpic.php?url="+encodeURIComponent(photo_list[photo_pos].big)+"&title="+encodeURIComponent(photo_list[photo_pos]["title-uri"]);photoinit();a=new Image;a.onload=function(){$("photo1").src=
photo_list[photo_pos].big;$("photo2").src=photo_list[photo_pos].big};a.src="http://img1.kaixin001.com.cn/i2/photo/null.gif"}}function photo_setlogo(){var a=window.location.href.split("#");window.location="/set/logo.php?url="+encodeURIComponent(photo_list[photo_pos].big)+"&back="+encodeURIComponent(a[0])}
function dbrotate(a){(bConf=$("realheight").value>780?confirm("\u8be5\u7167\u7247\u9ad8\u5ea6\u8fc7\u5927\uff0c\u65cb\u8f6c\u4f1a\u5bf9\u7167\u7247\u5c3a\u5bf8\u8fdb\u884c\u538b\u7f29\u3002\u4f60\u786e\u5b9a\u8981\u65cb\u8f6c\u56fe\u7247\u5417\uff1f"):confirm("\u4f60\u786e\u5b9a\u8981\u65cb\u8f6c\u56fe\u7247\u5417\uff1f"))&&new Ajax.Request("/photo/rotate.php",{method:"post",parameters:"direction="+a+"&pid="+photo_pid,onComplete:function(c){dbrotateajaxshow(c)}})}
function dbrotateajaxshow(a){eval("r="+a.responseText);if(!parseInt(r.ret)){a=findpid(photo_vuid,parseInt(r.pid),0);if(!(a<0)){photo_list[a].rotate=parseInt(r.rotate);photo_list[a].big=r.big;photo_list[a].small=r.small;a==photo_pos&&viewphoto(a)}}};
