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 dellogo()
{openWindow('logo_del_dialog.php?pid='+photo_pid,330,180,'删除照片');}
function dellogo_do(v_pid)
{document.dellogoform.pid.value=v_pid;document.setlogoform.from.value=$("returnlink").href;document.dellogoform.submit();}
function setlogo()
{openWindow('logo_set_dialog.php?pid='+photo_pid,330,180,'设置为当前头像');}
function setlogo_do(v_pid)
{document.setlogoform.pid.value=v_pid;document.dellogoform.from.value=window.location.href;document.setlogoform.submit();}
function logophotoinit()
{var obj=$("photo1");obj.width=$("realwidth").value;obj.height=$("realheight").value;var obj=$("photo2");obj.width=$("realwidth").value;obj.height=$("realheight").value;showLogoMoreInfo();var viewmode=getViewMode();if(viewmode=="part")
{partviewmode();}
else
{wholeviewmode();}
resetmask();photodivonmouseout();logoshowiconlist(photo_puid,photo_pid,photo_pos);}
function logofindpid(v_puid,v_pid)
{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))
{return i;}}
else
{ret=-3;}}
return ret;}
function showLogoMoreInfo()
{PhotoButton_Zan.setAttr(photo_pid,photo_puid,photo_vuid);markdata=photo_pid+"_"+photo_puid;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);}
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":"4","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');});showLogoExifInfo();}
function showLogoExifInfo()
{var pugid=photo_pid+"_"+photo_puid+"_0";if(typeof(exif_list[pugid])=="undefined")
{getLogoGUAInfo("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 logoshowiconlist(v_puid,v_pid,v_start)
{var pos=logofindpid(v_puid,v_pid);if(pos<0)
{if(pos!=-2)
{logoiconlistget(v_start);}
return;}
photo_pos=pos;prev_pos2=(pos+photo_total-2)%photo_total;if(photo_list[prev_pos2]==null)
{logoiconlistget(prev_pos2);return;}
prev_pos=(pos+photo_total-1)%photo_total;if(photo_list[prev_pos]==null)
{logoiconlistget(prev_pos);return;}
next_pos=(pos+1)%photo_total;if(photo_list[next_pos]==null)
{logoiconlistget(next_pos);return;}
next_pos2=(pos+2)%photo_total;if(photo_list[next_pos2]==null)
{logoiconlistget(next_pos2);return;}
var a_wh;$("totaldiv").innerHTML=(photo_pos+1)+'/'+photo_total;if(prev_pos!=photo_pos)
{$("prevnext_button").innerHTML='<div id="prevlinkdiv1" class="prevph2" onmouseover="this.className=\'prevph_hov\';" onmouseout="this.className=\'prevph2\';" onclick="viewprevlogo();"></div><div id="nextlinkdiv1" class="nexvph" onmouseover="this.className=\'nexvph_hov\';" onmouseout="this.className=\'nexvph\';" onclick="viewnextlogo();"></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:viewlogo('+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:viewlogo('+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:viewlogo('+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:viewlogo('+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>';var r_pid=photo_list[photo_pos]["pid"];var r_albumid=photo_list[photo_pos]["albumid"];var r_uid=photo_list[photo_pos]["uid"];}
function logoonclick(evnt)
{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)
{viewnextlogo();}
if(x<=0.5)
{viewprevlogo();}}
function logoiconlistget(v_start)
{var url="/photo/logoiconlist.php";var pars="uid="+photo_uid+"&type="+logo_type+"&start="+(Math.floor(v_start/100)*100);var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){logoiconlistajaxshow(req);}});}
function logoiconlistajaxshow(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)
{viewlogo(g_new_pos);g_new_pos=0;}
logoshowiconlist(photo_puid,photo_pid,(start+100)%photo_total);}
function viewprevlogo()
{viewlogo((photo_pos+photo_total-1)%photo_total);}
function viewnextlogo()
{viewlogo((photo_pos+1)%photo_total);}
function viewlogo(new_pos)
{if(new_pos>=photo_total)
{return;}
if(photo_list[new_pos]==null)
{return;}
photo_pid=parseInt(photo_list[new_pos]["pid"]);photo_puid=parseInt(photo_list[new_pos]["uid"]);photo_pos=parseInt(new_pos);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;$("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>';$("newwindow").href="/photo/showpic.php?url="+encodeURIComponent(photo_list[photo_pos]["big"])+"&title="+encodeURIComponent(photo_list[photo_pos]["title-uri"]);logophotoinit();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 logo_setlogo()
{var str=window.location.href.split("#");window.location="/set/resetlogo.php?id="+encodeURIComponent(photo_list[photo_pos]["pid"])+"&back="+encodeURIComponent(str[0]);}
function getLogoGUAInfo(v_type,v_id)
{var url="/photo/item.php";var pars="type="+v_type+"&id="+v_id+"&rotate="+photo_list[photo_pos]["rotate"];var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){getLogoGUAInfoajaxshow(req);}});}
function getLogoGUAInfoajaxshow(req)
{eval("r="+req.responseText);if(parseInt(r["ret"]))
{return;}
if(r["type"]=="exif")
{exif_list[r["id"]]=r["data"][r["id"]];showLogoExifInfo();return;}
else
{return;}
showLogoMoreInfo();}
