
var cfTPL='<div class="_kxj_cfwrapper comment_area">\n\
                <ul id="_kxj_cf_head_{{=it.objid}}" class="kx_func_bar">\n\
                    <li><a class="sl2 _kxj_fwdtrigger" href="#" name="kxforward" targetid="_kxj_cf_{{=it.objid}}">转发</a></li>\n\
                    <li class="pipeline pipeline_sp"></li>\n\
                    <li><a conflict="_kxj_fwdlist fwd_detail forwardtip" class="sl2 _kxj_cmttrigger" href="#" name="comment" targetid="_kxj_cf_{{=it.objid}}">评论</a></li>\n\
                    <li class="pipeline pipeline_sp"></li>\n\
                    <li><a conflict="fwd_detail _kxj_fwdlist _kxj_fwdbox" class="sl2 _kxj_uptrigger" href="#" name="zan" targetid="_kxj_cf_{{=it.objid}}">赞</a></li>\n\
                </ul>\n\
                <div class="c"></div>\n\
                <div data-comment="{{=it.cfdata}}" autoexpand="{{=it.autoexpand}}" class="_kxj_cfdatadom detail_comment_con" cfheadid="_kxj_cf_head_{{=it.objid}}" id="_kxj_cf_{{=it.objid}}" style="display: block;"></div>\n\
                <script>KxLazyLoad("js/init_forward.js");</script>\n\
            </div>';function delphoto()
{openWindow('myalbum_del_dialog.php?pid='+photo_pid,330,280,'删除照片');}
function delphoto_do(v_pid)
{document.delphotoform.pid.value=v_pid;document.delphotoform.from.value=$("returnlink").href;document.delphotoform.submit();setTimeout(function(){if($j('#picElg')){$j('#picElg').hide();}},500);}
function editphoto()
{openWindow('photo_edit_dialog.php?pid='+photo_pid,460,350,'修改照片标题和属性');}
function editphoto_do(v_pid,v_title,v_albumid)
{var str=window.location.href.split("#");document.editform.from.value=str[0]+"&pid="+photo_pid+"&puid="+photo_puid+"&gid="+photo_gid;document.editform.pid.value=v_pid;document.editform.albumid.value=v_albumid;document.editform.title.value=v_title;document.editform.submit();}
function editphoto_ajax(v_pid,v_title,v_albumid)
{if(photo_last_title==v_title)return;$('inpval').innerHTML=v_title;var url="/photo/photo_edit_ajax.php";var pars="pid="+v_pid+"&title="+v_title+"&albumid="+v_albumid+"&from=photo_zoom";var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){editPhotoAjaxShow(req);}});}
function editPhotoAjaxShow(req)
{var r=req.responseText.evalJSON();if(r.res=='success'&&typeof(r.title)!='undefined')
{photo_last_title=r.title;photo_list[photo_pos]['title']=r.title;}}
function sendtogrpalbum()
{openWindow('sendtogrpalbum_dialog.php?pid='+photo_pid,330,180,'复制到群相册');}
function sharephoto(v_syscode)
{openWindow('sharephoto_dialog.php?type=im&uid='+photo_puid+'&pid='+photo_pid+'&syscode='+v_syscode,460,450,'照片分享');}
function tagaddsubmit()
{if($("tipinput").value.length==0)
{alert("请输入人物的姓名");$("tipinput").focus();return;}
var x1=parseInt($("x1").value);var x2=parseInt($("x2").value);var y1=parseInt($("y1").value);var y2=parseInt($("y2").value);var x=parseInt((10000*(x2+x1)/2)/$("photo1").width);var y=parseInt((10000*(y2+y1)/2)/$("photo1").height);var width=parseInt(10000*(x2-x1)/$("photo1").width);var height=parseInt(10000*(y2-y1)/$("photo1").height);var mark_uid=f_seluid;var title=encodeURIComponent($("tipinput").value);var url="/photo/markadd.php";var pars="x="+x+"&y="+y+"&width="+width+"&height="+height+"&photouid="+photo_puid+"&pid="+photo_pid+"&mark_uid="+mark_uid+"&title="+title;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){tagaddajaxshow(req);}});}
function tagdelsubmit(markid,mark_uid)
{var url="/photo/markdel.php";var pars="markid="+markid+"&pid="+photo_pid+"&mark_uid="+mark_uid;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){tagdelajaxshow(req);}});}
function tagtitles()
{var tagtitles=$j("#tagtitles");if(!tagtitles[0]){return false;}
tagtitles.html("");var html;if(photo_vuid==photo_puid)
{html='<div class="namebk" style="z-index:_ZINDEX_;" onmouseover="tagaddborder(_ORDERNUM_);s(\'tagdel_ORDERNUM_\');" onmouseout="tagdelborder(_ORDERNUM_);h(\'tagdel_ORDERNUM_\');">_TITLE_<div id="tagdel_ORDERNUM_" class="fdname" style="display:none;"><table><tr><td nowrap="nowrap">_TITLE_<a class="fdclo" href="javascript:tagdelsubmit(_MARKID_,\'_MARK_UID_\');">×</a></td></tr></table></div></div>';}
else
{html='<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>';}
var mkey=markdata;for(var i=0;i<mark_list[mkey].length;i++)
{var html2=html;if(mark_list[mkey][i].mark_uid!="0"&&mark_list[mkey][i].mark_uid!="")
{html2=html2.replace(/_TITLE_/g,"<a href=/home/?uid="+mark_list[mkey][i].mark_uid+" class='ct'>"+mark_list[mkey][i].title+"</a>");}
else
{html2=html2.replace(/_TITLE_/g,"<span>"+mark_list[mkey][i].title+"</span>");}
html2=html2.replace(/_ORDERNUM_/g,i);html2=html2.replace(/_ZINDEX_/g,10000-i);html2=html2.replace(/_MARKID_/g,mark_list[mkey][i].markid);html2=html2.replace(/_MARK_UID_/g,mark_list[mkey][i].mark_uid);html2=html2.replace(/_COMMA_/g,i==mark_list[mkey].length-1?"":",");tagtitles.html(tagtitles.html()+html2);}
if(mark_list[mkey].length)
{$("tagframe").style.display="block";}
else
{$("tagframe").style.display="none";}}
function photoinit()
{if(!IsIE())
{h("rotatediv");}
if(photo_gid)
{h("divmark");}
else
{s("divmark");}
var obj=$("photo1");obj.width=$("realwidth").value;obj.height=$("realheight").value;var obj=$("photo2");obj.width=$("realwidth").value;obj.height=$("realheight").value;showPhotoMoreInfo();var viewmode=getViewMode();if(viewmode=="part")
{partviewmode();}
else
{wholeviewmode();}
resetmask();photodivonmouseout();showiconlist(photo_puid,photo_pid,photo_gid,album_id,photo_pos);}
function setPhotoVisitorHtml()
{$j("#photovisitordiv").html(p_visitorlist);$j("#photovisitordiv").show();}
function hidePhotoVisitorHtml()
{p_visitorlist="";$j("#photovisitordiv").hide();}
function setPhotoVnumHtml()
{$j("#photovnumdiv").html('浏览：'+photo_vnum+'次');$j("#photovnumdiv").show();}
function hidePhotoVnumHtml()
{photo_vnum=0;$j("#photovnumdiv").hide();}
function showPhotoVisitorList(photo_pid,photo_puid,initflag)
{hidePhotoVisitorHtml();hidePhotoVnumHtml();if('undefined'==typeof window.g_im_vuid||g_im_vuid<=0){p_visitorlist=''
return;}
var actionVnum='';if(initflag){actionVnum='get';}else{actionVnum='add';}
$j.getJSON("/photo/ajax/photo_visit_load.php?rand="+Math.random(),{'pid':photo_pid,'ouid':photo_puid,'act':actionVnum,'is_audit':is_audit},function(data){var intTotal=data.total;if(intTotal>0){if(data.vnum<0){photo_vnum=p_viewnum;}else{photo_vnum=data.vnum;}
if(photo_vnum>0){p_visitorlist='浏览：'+photo_vnum+'次';setPhotoVisitorHtml();}else{hidePhotoVisitorHtml();}
setPhotoVnumHtml();setTimeout(visitordivClickMore,300);}});}
function visitordivClickMore(){var items_min=6,item_width=25,items_wrap=$j('#photovisitordiv span.view_list_cnt'),btn_more=$j('#photovisitordiv a.btn_arrow'),items_length=items_wrap.find('a').length;if(items_length>items_min){items_wrap.width(item_width*items_min).children('span').width(10000);btn_more.click(function(){$j(this).hide();items_wrap.animate({width:(item_width*items_length)},300);return false;}).css('display','inline-block');}else{items_wrap.width('auto').children('span').width('auto');}}
function showPhotoMoreInfo()
{PhotoButton_Zan.setAttr(photo_pid,photo_puid,photo_vuid);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='<span class="l" style="width: 36px;">专辑：</span><span class="l albumtitlespan"><a href="/group/group.php?gid='+photo_gid+'" title="'+group_list["_"+photo_gid]+'" class="sl">'+group_list["_"+photo_gid]+'</a>群的相册专辑 <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"]+'</span>';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;}
var title=album_list["u_"+photo_puid+"_"+album_id]["title"];title_text=Kx.Utils.splitString(title,12);$("albumtitlediv").innerHTML='<span class="l" style="width: 36px;">专辑：</span><span  class="l albumtitlespan"><a href="/photo/album.php?uid='+photo_puid+'&albumid='+album_id+'" class="sl" title="'+title+'">'+title_text+'</a>('+album_list["u_"+photo_puid+"_"+album_id]["picnum"]+') '+album_list["u_"+photo_puid+"_"+album_id]["privacyicon"]+'</span>';g_is_privacy_pwd=(parseInt(album_list["u_"+photo_puid+"_"+album_id]["privacy"])==2)?"1":"0";}
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='<span class="l" style="width: 36px;">专辑：</span><span  class="l albumtitlespan"><a href="/home/?uid='+photo_puid+'" title="'+user_list["_"+photo_puid]["real_name"]+'" class="sl">'+user_list["_"+photo_puid]["real_name"]+'</a>的专辑<a href="/photo/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"]+'</span>';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);return;}
markdata=photo_pid+"_"+photo_puid+"_"+photo_gid;var photodata=markdata+"_"+photo_pos;var sethash=true;if(back_ajax&&parseInt(back_ajax,10)==1)
{sethash=false;back_ajax=0;}
if(sethash)
{clickDirect(photodata,true);}
tagtitles();if(typeof(user_list["_"+photo_puid])=="undefined")
{getGUAInfo("user","_"+photo_puid);return;}
if(!photo_gid)
{var cfWrapper=$j('.comment_area_photo'),cfDataDOM=cfWrapper.find('._kxj_cfdatadom'),cfData=$j.parseJSON(decodeURIComponent(cfDataDOM.attr('data-comment')||'')),judgeSetting={"vuid":photo_vuid,"owneruid":photo_puid,"type":"1","id":photo_pid,"objid":photo_pid,"comment_right":parseInt(user_list["_"+photo_puid]["comment_right"],10),"forward_right":cfData.forward_right,"comtitle":cfData.comtitle,"title":cfData.title,"isdetail":1,"stage":'detail',"oreal_name":user_list["_"+photo_puid]["real_name"],"objinfo":cfData.objinfo};KxRequire('js/json.js',function(){cfWrapper.html(doT.template(cfTPL)({'objid':photo_pid,'cfdata':encodeURIComponent(JSON.stringify(judgeSetting)),'autoexpand':cfDataDOM.attr('autoexpand')||'cmt'}));Kx.publish('cfdataload');});}
showPhotoExifInfo();}
function showPhotoExifInfo()
{var pugid=photo_pid+"_"+photo_puid+"_"+photo_gid;if(typeof(exif_list[pugid])=="undefined")
{getGUAInfo("exif",pugid);return;}
$("exif").innerHTML='<a class="photoclo" href="javascript:exif();"></a>';var exinfostr="";if(exif_list[pugid]!=""&&exif_list[pugid]["EXIF"]!="0"){if(exif_list[pugid]["Make"]&&exif_list[pugid]["Make"]!=""){exinfostr+='厂商 '+exif_list[pugid]["Make"]+'<br>';}
if(exif_list[pugid]["Model"]&&exif_list[pugid]["Model"]!=""){exinfostr+='型号 '+exif_list[pugid]["Model"]+'<br>';}
if(exif_list[pugid]["DateTimeOriginal"]&&exif_list[pugid]["DateTimeOriginal"]!=""){exinfostr+='日期 '+exif_list[pugid]["DateTimeOriginal"]+'<br>';}
if(exif_list[pugid]["Width"]&&exif_list[pugid]["Width"]!=""){exinfostr+='大小 '+exif_list[pugid]["Width"]+' x '+exif_list[pugid]["Height"]+'<br>';}
if(exif_list[pugid]["FocalLength"]&&exif_list[pugid]["FocalLength"]!=""){exinfostr+='焦距 '+exif_list[pugid]["FocalLength"]+'<br>';}
if(exif_list[pugid]["ApertureValue"]&&exif_list[pugid]["ApertureValue"]!=""){exinfostr+='光圈 '+exif_list[pugid]["ApertureValue"]+'<br>';}
if(exif_list[pugid]["ExposureTime"]&&exif_list[pugid]["ExposureTime"]!=""){exinfostr+='曝光时间 '+exif_list[pugid]["ExposureTime"]+'<br>';}
if(exif_list[pugid]["ISOSpeedRatings"]&&exif_list[pugid]["ISOSpeedRatings"]!=""){exinfostr+='感光度 '+exif_list[pugid]["ISOSpeedRatings"]+'<br>';}
if(exif_list[pugid]["Flash"]&&exif_list[pugid]["Flash"]!=""){exinfostr+='闪光灯 '+exif_list[pugid]["Flash"]+'<br>';}}
if(exinfostr==''){exinfostr='该照片无EXIF信息'}
$("exif").innerHTML+=exinfostr;}
function getGUAInfo(v_type,v_id)
{var url="/photo/item.php";var pars="type="+v_type+"&id="+v_id+"&rotate="+photo_list[photo_pos]["rotate"];if(!window.g_im_vuid)pars+='&uid='+window.photo_uid;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){getGUAInfoajaxshow(req);}});}
function getGUAInfoajaxshow(req)
{eval("r="+req.responseText);if(parseInt(r["ret"]))
{return;}
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;}
else
{return;}
showPhotoMoreInfo();}
function findpid(v_puid,v_pid,v_gid)
{var i;var ret=-1;if(photo_list.length)
{ret=-2;}
for(i=0;i<photo_list.length;i++)
{if(photo_list[i]!=null)
{if(parseInt(photo_list[i]["pid"])==parseInt(v_pid)&&parseInt(photo_list[i]["uid"])==parseInt(v_puid)&&parseInt(photo_list[i]["gid"])==parseInt(v_gid))
{return i;}}
else
{ret=-3;}}
return ret;}
function ClosePhotoEditorTip(){$j.post('/photo/ajax/save_tips.php','tips=1&type=2',function(){$j('#editor_tip').hide();});}
function ShowPhotoEditor(intPUID){window.g_im_vuid=window.g_im_vuid||0;var bool_1=g_im_vuid>0&&g_im_vuid==intPUID;var strWhiteList='|132578|83965253|84755619|51574850|17734641|134815|72800894|100024'
+'|95634617|95859367|98234091|93102416|85829472|||';var bool_2=true;var bool_3=window.enable_photo_editor?parseInt(window.enable_photo_editor,10):0;if(bool_1){if(bool_2||bool_3){$j('#show_editor').show();var boolShowTip=true;var objAllTips=$j('.tips_class');objAllTips.each(function(){var objThiz=$j(this);if('none'!=objThiz.css('display')){boolShowTip=false;}});var objEditorTip=$j('#editor_tip');var intAttrClosed=parseInt(objEditorTip.attr('closed'),10);if(intAttrClosed){boolShowTip=false;}
if(boolShowTip){objEditorTip.show();}}else{$j('#show_editor').hide();}}else{}}
function showiconlist(v_puid,v_pid,v_gid,v_albumid,v_start)
{ShowPhotoEditor(v_puid);var pos=findpid(v_puid,v_pid,v_gid);if(pos<0)
{if(pos!=-2)
{iconlistget(v_albumid,v_start);}
return;}
photo_pos=pos;prev_pos2=(pos+photo_total-2)%photo_total;if(photo_list[prev_pos2]==null)
{iconlistget(v_albumid,prev_pos2);return;}
prev_pos=(pos+photo_total-1)%photo_total;if(photo_list[prev_pos]==null)
{iconlistget(v_albumid,prev_pos);return;}
next_pos=(pos+1)%photo_total;if(photo_list[next_pos]==null)
{iconlistget(v_albumid,next_pos);return;}
next_pos2=(pos+2)%photo_total;if(photo_list[next_pos2]==null)
{iconlistget(v_albumid,next_pos2);return;}
var a_wh;$("totaldiv").innerHTML=(photo_pos+1)+'/'+photo_total;if(prev_pos!=photo_pos)
{$("prevnext_button").innerHTML='<div id="prevlinkdiv1" title="上一张" class="prevph2" onmouseover="this.className=\'prevph_hov\';" onmouseout="this.className=\'prevph2\';" onclick="viewprev();"></div><div id="nextlinkdiv1" class="nexvph" onmouseover="this.className=\'nexvph_hov\';" onmouseout="this.className=\'nexvph\';" title="下一张" onclick="viewnext();"></div>';}
else
{$("prevnext_button").innerHTML='<div id="prevlinkdiv1" class="prevph"></div><div id="nextlinkdiv1" class="nexvph2"></div>';}
var v_html='';if(prev_pos2!=photo_pos&&prev_pos2!=next_pos&&prev_pos2!=prev_pos&&prev_pos2!=next_pos2)
{a_wh=getPhotoWH(photo_list[prev_pos2]["width"],photo_list[prev_pos2]["height"]);v_html+='<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:'+a_wh[0]+'px; height:'+a_wh[1]+'px;background: url('+photo_list[prev_pos2]["small"]+') center no-repeat;"></div>';}
if(prev_pos!=photo_pos&&prev_pos!=next_pos)
{a_wh=getPhotoWH(photo_list[prev_pos]["width"],photo_list[prev_pos]["height"]);v_html+='<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:'+a_wh[0]+'px; height:'+a_wh[1]+'px;background: url('+photo_list[prev_pos]["small"]+') center no-repeat;"></div>';}
a_wh=getPhotoWH(photo_list[photo_pos]["width"],photo_list[photo_pos]["height"]);v_html+='<div style="border:1px solid #999999;margin:5px auto 5px auto; padding:1px;width:'+a_wh[0]+'px; height:'+a_wh[1]+'px;background: url('+photo_list[photo_pos]["small"]+') center no-repeat;"></div>';if(next_pos!=photo_pos)
{a_wh=getPhotoWH(photo_list[next_pos]["width"],photo_list[next_pos]["height"]);v_html+='<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:'+a_wh[0]+'px; height:'+a_wh[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)
{a_wh=getPhotoWH(photo_list[next_pos2]["width"],photo_list[next_pos2]["height"]);v_html+='<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:'+a_wh[0]+'px; height:'+a_wh[1]+'px;background: url('+photo_list[next_pos2]["small"]+') center no-repeat;"></div>';}
$("iconlist").innerHTML=v_html+'<div class="w80">&nbsp;</div>';if(photo_gid)
{h("sharediv");}
else
{var r_pid=photo_list[photo_pos]["pid"];var r_albumid=photo_list[photo_pos]["albumid"];var r_uid=photo_list[photo_pos]["uid"];$("sharelink2").href="javascript:showRepasteDlg('0', 'photo_"+r_uid+"_"+r_pid+"-"+r_albumid+"','"+r_uid+"');";s("sharediv");uplayerData="";h("support_tips");h("support_ok");}}
function showPhotoUpLayer()
{if(photo_pos==undefined||photo_list=="")
{return;}
var up_pid=photo_list[photo_pos]["pid"];var up_uid=photo_list[photo_pos]["uid"];var up_appid=1;showUpLayer(up_appid,up_pid,up_uid);}
function doPhotoAjaxUp()
{if(photo_pos==undefined||photo_list=="")
{return;}
var up_pid=photo_list[photo_pos]["pid"];var up_uid=photo_list[photo_pos]["uid"];var up_appid=1;doAjaxUp(up_appid,up_pid,up_uid);}
function iconlistget(v_albumid,v_start)
{var url="/photo/list.php";var pars="uid="+photo_uid+"&type="+photo_type+"&albumid="+v_albumid+"&start="+(Math.floor(v_start/100)*100);if('undefined'==typeof window.cachePhotoViewGetListAjax){window.cachePhotoViewGetListAjax={};}
if('undefined'==typeof window.cachePhotoViewGetListAjax[pars]){window.cachePhotoViewGetListAjax[pars]=1;}else{return;}
var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){iconlistajaxshow(req);}});}
function iconlistajaxshow(req)
{eval("r="+req.responseText);if(parseInt(r["ret"]))
{return;}
photo_total=parseInt(r["total"]);if(!photo_total)
{return;}
var i;for(i=photo_list.length;i<photo_total;i++)
{photo_list[i]=null;}
var start=parseInt(r["start"]);for(i=0;i<r["list"].length;i++)
{photo_list[i+start]=r["list"][i];}
if(g_new_pos)
{show_next_pic_tag=0;viewphoto(g_new_pos);g_new_pos=0;}
showiconlist(photo_puid,photo_pid,photo_gid,album_id,(start+100)%photo_total);var intNextPos=0;intNextPos=start;KxPhoto.preLoadNextPhoto(photo_list,intNextPos,intNextPos-1,photo_total);KxPhoto.appendPreImage();}
function viewphoto(new_pos)
{if(new_pos>=photo_total)
{return;}
if(photo_list[new_pos]==null)
{return;}
KxPhoto.preLoadNextPhoto(photo_list,new_pos,photo_pos,photo_total);photo_pid=parseInt(photo_list[new_pos]["pid"]);photo_puid=parseInt(photo_list[new_pos]["uid"]);photo_gid=parseInt(photo_list[new_pos]["gid"]);photo_pos=parseInt(new_pos);album_id=parseInt(photo_list[new_pos]["albumid"]);Kx.Utils.writeLog('rs',photo_puid,'front_photo_view');Kx.Utils.writeLog3(photo_pid,'front_photo_view');showPhotoVisitorList(photo_pid,photo_puid);var _img=new Image();photo_list[new_pos]["viewnum"]=parseInt(photo_list[new_pos]["viewnum"],10)+1;var waitpic=new Image();waitpic.onload=function(){$("photo1").src=waitpic.src;$("photo2").src=waitpic.src;}
waitpic.src="http://img1.kaixin001.com.cn/i2/photo/null.gif";markdata="0_0_0";tagobj=null;taging=false;zoomlevel=0;rotatevalue=0;rotateing=false;rotate(0);var p_rotate=parseInt(photo_list[photo_pos]["rotate"]);if(p_rotate==1||p_rotate==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");s("phototitlediv");showExtraInfo(new_pos,showInfo,photo_pid,photo_gid,photo_puid);}
function showInfo(new_pos){if(photo_puid==photo_vuid)
{$("phototitlediv").innerHTML='<span onclick="editil()" class="f13" id="inpval" style="color:#333; cursor:pointer;">'+photo_list[photo_pos]["title"]+'</span><a class="phedit" href="javascript:void(0);" title="编辑照片名称"><img onclick="editil()" src="http://img1.kaixin001.com.cn/i2/photo/phedit.gif"/></a>';$("modify_title").value=photo_list[photo_pos]["title"];}
else
{$("phototitlediv").innerHTML='<span class="f13" id="inpval" style="color:#333;">'+photo_list[photo_pos]["title"]+'</span>';}
photo_last_title=photo_list[photo_pos]["title"];$j("#phototimediv").html('时间：'+photo_list[photo_pos]["ctime"]);setPhotoVisitorHtml();setPhotoVnumHtml();if("undefined"!=typeof(photo_list[photo_pos]["userinfo"]))
{$j("#photouserdiv").html(photo_list[photo_pos]["userinfo"]);}
var pld=$("photolocationdiv");if(photo_list[photo_pos]["location"])
{if(pld)
{pld.innerHTML='<img src="http://img1.kaixin001.com.cn/i/mobile/location.gif" title="发布位置" align="absmiddle" />&nbsp;'+photo_list[photo_pos]["location"]+'&nbsp;&nbsp;';pld.style.display="block";}}
else
{if(pld)
{pld.innerHTML='';pld.style.display="none";}}
if(photo_puid==photo_vuid&&!photo_gid)
{$("rotatediv").style.display="none";s("diveditphoto");s("sendtogrp");$("rotatediv2").style.display="block";s("divdelphoto");s("divlogop");s("divcopyp");s("diveditp");}
else
{$("rotatediv").style.display="inline";h("diveditphoto");h("sendtogrp");$("rotatediv2").style.display="none";h("divdelphoto");h("divlogop");h("divcopyp");h("diveditp");}
$("newwindow").href="/photo/showpic.php?url="+encodeURIComponent(photo_list[photo_pos]["big"])+"&title="+encodeURIComponent(photo_list[photo_pos]["title-uri"]);photoinit();var waitpic2=new Image();waitpic2.onload=function(){$("photo1").src=photo_list[photo_pos]["big"];$("photo2").src=photo_list[photo_pos]["big"];}
waitpic2.src="http://img1.kaixin001.com.cn/i2/photo/null.gif";}
function showExtraInfo(new_pos,showInfo,pid,gid,puid,initflag){if((window.is_star==1||window.is_active==1)&&!initflag){showInfo(new_pos);return false;}else{var data={pid:pid,gid:gid,puid:puid,t:Math.round(Math.random()*100000)}
$j.ajax({url:"/photo/photo_extra_ajax.php",dataType:"json",method:"GET",data:data,success:function(res){var oldcontainer=$j(".phl");var container=$j('<div class="phl" id="p_extra_panel">\
            <div>\
            <div style="display:none;" id="tagframe">\
              <div style="padding-top:3px;" class="l mb5">该照片圈有：</div>\
                                <div class="qrname" id="tagtitles">\
                                </div>\
              <div class="c"></div>\
            </div>\
            <div class="phsrinfo cfix">\
              <div class="info_l">\
               <h3 class="til" id="phototitlediv"></h3><div id="photolocationdiv" style="display:none;"></div>\
               <div style="display:none;" class="newedit" id="editil">\
                 <input type="text" value="" name="" id="modify_title" /></div>\
               <p id="p_desc"><span  id="item_a"></span></p>\
               <div class="far">\
                <a class="sl r" id="item_la" target="_blank" href="" style="display:none"></a>\
               </div>\
              </div>\
              <div class="info_r mt10 randcss">\
               <p id="albumtitlediv"> </p>\
               <div id="phototimediv"></div>\
               <div id="photovisitordiv"></div>\
              </div>\
             </div>\
           </div>');if(res.res=="success"&&(res.content.photoDesc!=""||res.content.linkAddv!=""||res.content.linkName!=""||res.content.itemName!=""||res.content.itemValue!="")){var content={};content=res.content;var linkaddv=content.linkAddv;var addv=Kx.Utils.splitString(linkaddv,20);if(content.photoDesc!=""){container.find("#item_a").html(content.photoDesc);}else{container.find("#p_desc").hide();}
if(linkaddv!=""){var reg=/^mms:\/\/|^http:\/\/|^ftp:\/\/|^https:\/\//g;if(!reg.test(addv)){linkaddv="http://"+linkaddv;}
container.find("#item_la").attr("href",linkaddv).html(content.linkName+"&gt;&gt;").show();}
if(content.itemName!=""||content.itemValue!=""){container.find("#item_la").after("<span>"+content.itemName+"："+content.itemValue+"</span>");}}else{container=$j('<div class="phl" id="p_extra_panel">\
           <div>\
         <div style="display:none;" id="tagframe">\
          <div style="padding-top:3px;" class="l mb5">该照片圈有：</div>\
                            <div class="qrname" id="tagtitles">\
                            </div>\
          <div class="c"></div>\
         </div>\
         <div style="visibility: visible; position: static; overflow: hidden;" class="editbk" id="phototitlediv"></div>\
                        <div id="photolocationdiv" style="display:none;"></div>\
                       <div style="display:none;" class="newedit" id="editil"><input type="text" value="" name="" id="modify_title"></div>\
                        <div class="c"></div>\
         <div style="color:#333; clear:both; margin-top:2px;" class="albumtitle" id="albumtitlediv"> </div>\
         <div style="color:#333; " id="phototimediv"></div>\
         <div style="color:#333; " id="photovisitordiv"></div>\
        </div>\
                   </div>');}
if(initflag){var title=window.photo_last_title;var p_ctime=window.p_ctime;if(photo_puid==photo_vuid)
{container.find("#phototitlediv").html('<span onclick="editil()" class="f13" id="inpval" style="color:#333; cursor:pointer;">'+title+'</span><a class="phedit" href="javascript:void(0);" title="编辑照片名称"><img onclick="editil()" src="http://img1.kaixin001.com.cn/i2/photo/phedit.gif"/></a>');container.find("#modify_title").val(title);}
else
{container.find("#phototitlediv").html('<span class="f13" id="inpval" style="color:#333;">'+title+'</span>');}
container.find("#phototimediv").html('时间：'+p_ctime);}
oldcontainer.replaceWith(container.get(0));showInfo(new_pos);setPhotoVisitorHtml();},error:function(){var container=$j('<div class="phl" id="p_extra_panel">\
          <div>\
        <div style="display:none;" id="tagframe">\
         <div style="padding-top:3px;" class="l mb5">该照片圈有：</div>\
                           <div class="qrname" id="tagtitles">\
                           </div>\
         <div class="c"></div>\
        </div>\
        <div style="visibility: visible; position: static; overflow: hidden;" class="editbk" id="phototitlediv"></div>\
                       <div id="photolocationdiv" style="display:none;"></div>\
                      <div style="display:none;" class="newedit" id="editil"><input type="text" value="" name="" id="modify_title"></div>\
                       <div class="c"></div>\
        <div style="color:#333; clear:both; margin-top:2px;" class="albumtitle" id="albumtitlediv"> </div>\
        <div style="color:#333; " id="phototimediv"></div>\
        <div style="color:#333; " id="photovisitordiv"></div>\
       </div>\
                  </div>');$j(".phl").replaceWith(container.get(0));showInfo(new_pos);setPhotoVisitorHtml();}});}}
function photo_setlogo()
{var str=window.location.href;window.location="/set/logo.php?url="+encodeURIComponent(photo_list[photo_pos]["big"])+"&back="+encodeURIComponent(str);}
function dbrotate(direction)
{if($("realheight").value>780)
{bConf=confirm("该照片高度过大，旋转会对照片尺寸进行压缩。你确定要旋转图片吗？");}
else
{bConf=confirm("你确定要旋转图片吗？");}
if(bConf)
{var url="/photo/rotate.php";var pars="direction="+direction+"&pid="+photo_pid;var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){dbrotateajaxshow(req);}});}}
function dbrotateajaxshow(req)
{eval("r="+req.responseText);if(parseInt(r["ret"]))
{return;}
var pos=findpid(photo_vuid,parseInt(r["pid"]),0);if(pos<0)
{return;}
photo_list[pos]["rotate"]=parseInt(r["rotate"]);photo_list[pos]["big"]=r["big"];photo_list[pos]["small"]=r["small"];if(pos==photo_pos)
{viewphoto(pos);}}
function CKxPhotoPreLoad(){this.nextPhotoSrc='';this.preload_is_bind=false;this.objLoadCache={};this.objImageCache={};var strUA=(navigator.userAgent+'').toLowerCase();this.isSafari=strUA.indexOf('applewebkit')!=-1&&strUA.indexOf('safari')!=-1;}
CKxPhotoPreLoad.prototype={setNextPhoto:function(strNextSrc){this.nextPhotoSrc=strNextSrc;var objMainPhoto=$j('#photo1');if(!this.preload_is_bind){var Thiz=this;objMainPhoto.bind('load',function(){Thiz.executeOnLoad.call(Thiz);});this.preload_is_bind=true;}},preLoadNextPhoto:function(arrPhotoList,intPos,intLastPos,intTotal){var intDiff=intPos-intLastPos;if(1==intDiff||intDiff*-1==intTotal-1){var intNextPos=(intPos+1)%intTotal;}else if(-1==intDiff||intDiff==intTotal-1){var intNextPos=(intPos+intTotal-1)%intTotal;}else{return;}
var objNextInfo=typeof arrPhotoList[intNextPos]=='undefined'?{}:arrPhotoList[intNextPos];if('undefined'!=typeof objNextInfo['big']){this.setNextPhoto(objNextInfo['big']);}},executeOnLoad:function(){var strSrc=this.nextPhotoSrc;if(!this.isSafari&&'undefined'==typeof this.objLoadCache[strSrc]){this.objLoadCache[strSrc]=true;return;}
var Thiz=this;setTimeout(function(){if(0){var od=new Date();var sec=od.getMilliseconds();document.title+=' | ExeBind-'+sec;}
Thiz.appendPreImage();},100);},appendPreImage:function(){var strSrc=this.nextPhotoSrc;if('undefined'!=typeof this.objImageCache[strSrc]){return;}
this.objImageCache[strSrc]=true;var strPreImageID='photo_preload_image';var objPreImage=$j('#'+strPreImageID);if(objPreImage[0]){objPreImage[0].parentNode.removeChild(objPreImage[0]);}
var strImageTag='<div style="width:1px;height:0px;overflow:hidden;" id="'
+strPreImageID+'" ><img src="'
+strSrc+'"  width="1" height="1" /></div>';$j('#photodiv2').append(strImageTag);}};var KxPhoto=new CKxPhotoPreLoad();(function(){var $=$j;var ThumbnailScroll={timer:null,threshold:25,speed:2,dist:0,init:function(selector,speed){if(speed){this.speed=speed;}
var ins=this;$(selector).mouseenter(function(){var el=this;ins.dist=$(el).height()-$(el).parent().height();if(ins.dist<=ins.threshold)return;$(el).animate({marginTop:'-'+ins.dist+'px'},'slow');}).mouseout(function(){$(this).stop();var mt=ins.getMarginTop(this);if(mt<=-ins.dist){$(this).animate({marginTop:'0px'},'fast');}})},getMarginTop:function(el){el=$(el);return parseFloat(el.css('margin-top'));}};$(document).ready(function(){ThumbnailScroll.init('.imgcontainer img');});})();
