
function popviewImgLoad(){pViewArr=new Array();var tempSrc=this.src;var tmepImgSize={'WIDTH':this.offsetWidth,'HEIGHT':this.offsetHeight};document.body.removeChild(this);var html='';if($('photoViewer')){$('photoViewer').remove();}
var div=null;if(!div){div=document.createElement('div');div.id='photoViewer';div.style.display='';document.body.appendChild(div);new Draggable(div,{starteffect:null,endeffect:null});}
var bodySize=UtnWbs.getBody();var top=0,left=0;tempTop=0;imageWidth=0;imageHeight=0;maxWidth=0;maxHeight=0;scrollBarX=false;scrollBarY=false;var reductionWidth=0;reductionHeight=0;reductionCheck=false;var addWidth=16;var addHeight=23;if(bodySize.height<995){addHeight+=20;}
if(tmepImgSize.WIDTH+(addWidth+10)>=bodySize.width){maxWidth=bodySize.width-10;reductionWidth=bodySize.width-10-addWidth;reductionCheck=true;}else{reductionWidth=tmepImgSize.WIDTH;if(tmepImgSize.WIDTH+addWidth<250){maxWidth=250;}else{maxWidth=tmepImgSize.WIDTH+addWidth;}}
if(this.fileOrigin!=null&&this.fileOrigin!=''){html+='<span id="pViewLink" style="white-space:nowrap">この写真は '+this.fileOrigin+' からです。</span>';}
html+='<div class="clear" style="cursor:move;">';html+=' <div class="logo_l"></div>';html+=' <div id="pViewhBarWidth" class="logo_c" style="width:'+(maxWidth-94)+'px; text-align:center">';html+='  <img src="http://image.utravelnote.com/images/note/bg/photo_v/photo_v_close.gif" alt="" onclick="closePopview();" />';html+=' </div>';html+=' <div class="logo_r"></div>';html+='</div>';html+='<div id="pViewbBarWidth" class="bd_l clear" style="width:'+(maxWidth-3)+'px;">';html+='  <div id="photoViewerImg" class="bd_c" style="width:'+(maxWidth-6)+'px;">';html+='   <div id="pViewbInner">';html+='    <div id="oriImgViewBtn" class="oriImgViewBtnOff" onclick="pViewLargeImg(\''+tempSrc+'\');" onmouseover="this.className=\'oriImgViewBtnOn\';" onmouseout="this.className=\'oriImgViewBtnOff\';"></div> ';html+='    <img id="pViewImage" src="'+tempSrc+'" alt="" onclick="closePopview();" class="curP" />';html+='    <p id="pViewPhotoTitle_'+this.photoSeq+'" class="bold"></p>';html+='    <p id="pViewPhotoDesc_'+this.photoSeq+'"></p>';if(this.fileOrigin!=null&&this.fileOrigin!=''){html+='   <p style="text-align:right; white-space:nowrap">この写真は <a href="'+this.fileOrigin+'" target="_blank" class="viewer">'+this.fileOrigin+'</a> からです。</p>';}
html+='   </div>';html+='  </div>';html+='  <div id="pViewbBarRight" class="bd_r" style="height:'+tmepImgSize.HEIGHT+'px;"></div>';html+='</div>';html+='<div class="ft_l"></div>';html+='<div id="pViewfBarWidth" class="ft_c" style="width:'+(maxWidth-6)+'px;"></div>';html+='<div class="ft_r"></div>';div.innerHTML=html;if(tmepImgSize.WIDTH+(addWidth+10)<bodySize.width){var haba=5;if(this.fileOrigin!=null&&this.fileOrigin!=''){var pViewLinkDimen=$('pViewLink').getDimensions();if(haba<=pViewLinkDimen.width){haba=pViewLinkDimen.width;}}
if(maxWidth<haba){$('pViewhBarWidth').style.width=(haba-69)+'px';$('pViewbBarWidth').style.width=(haba+22)+'px';$('photoViewerImg').style.width=(haba+19)+'px';$('pViewfBarWidth').style.width=(haba+19)+'px';}}
var pViewbBarHeight=$('pViewbInner').getHeight();var pViewbBarHeightDiffer=pViewbBarHeight-tmepImgSize.HEIGHT;if(pViewbBarHeight+(addHeight+10)>=bodySize.height){maxHeight=bodySize.height-10;reductionHeight=bodySize.height-10-addHeight;reductionCheck=true;}else{maxHeight=pViewbBarHeight+addHeight;reductionHeight=tmepImgSize.HEIGHT;}
if(reductionCheck){var thumbWidth=0;thumbHeight=0;var ratioWidth=reductionWidth/tmepImgSize.WIDTH;var ratioHeight=(reductionHeight-pViewbBarHeightDiffer)/tmepImgSize.HEIGHT;if(ratioWidth==ratioHeight){thumbWidth=parseInt(tmepImgSize.WIDTH*ratioWidth);thumbHeight=parseInt(tmepImgSize.HEIGHT*ratioHeight);}else if(ratioWidth>ratioHeight){thumbWidth=parseInt(tmepImgSize.WIDTH*ratioHeight);thumbHeight=parseInt(tmepImgSize.HEIGHT*ratioHeight);}else if(ratioWidth<ratioHeight){thumbWidth=parseInt(tmepImgSize.WIDTH*ratioWidth);thumbHeight=parseInt(tmepImgSize.HEIGHT*ratioWidth);}
$('pViewImage').style.width=thumbWidth+'px';$('pViewImage').style.height=thumbHeight+'px';if(haba<thumbWidth+addWidth){haba=thumbWidth+addWidth;maxWidth=haba+22;$('pViewhBarWidth').style.width=(haba-69)+'px';$('pViewbBarWidth').style.width=(haba+22)+'px';$('photoViewerImg').style.width=(haba+19)+'px';$('pViewfBarWidth').style.width=(haba+19)+'px';}
$('pViewbBarRight').style.height=(thumbHeight+pViewbBarHeightDiffer)+'px';}else{$('pViewbBarRight').style.height=(maxHeight-addHeight)+'px';}
if($('pViewLink'))$('pViewLink').remove();div.style.display='none';left=(Math.floor(bodySize.width/2)-Math.floor((maxWidth)/2));tempTop=(Math.floor(bodySize.height/2)-Math.floor((maxHeight)/2));if(tempTop>50){top=(50+bodySize.top);}else{top=(tempTop+bodySize.top);}
div.style.left=left+'px';div.style.top=top+'px';new Effect.Grow(div,{});if(reductionCheck){$('oriImgViewBtn').style.display='block';}}
function closePopview(){var pvi=$('photoViewerImg');if(pvi.style.overflowX=='scroll'){pvi.style.overflowX=='hidden';}
if(pvi.style.overflowY=='scroll'){pvi.style.overflowY=='hidden';}
UtnLayer.changeDocumentWheel(pvi);$('photoViewer').remove();}
function popview(obj,fileSrc,fileOrigin,photoSeq){if(typeof(obj.src)=='undefined'){}else{if(obj.src!=null&&obj.src!=''){fileSrc=obj.src;}else{return false;}}
fileSrc=fileSrc.replace(/_layer/g,'');fileSrc=fileSrc.replace(/480x360_/g,'');fileSrc=fileSrc.replace(/170x170_/g,'');fileSrc=fileSrc.replace(/115x115_/g,'');fileSrc=fileSrc.replace(/84x84_/g,'');fileSrc=fileSrc.replace(/55x55_/g,'');fileSrc=fileSrc.replace(/url\('/g,'');fileSrc=fileSrc.replace(/url\(/g,'');fileSrc=fileSrc.replace(/'\)/g,'');fileSrc=fileSrc.replace(/\)/g,'');if(fileSrc.indexOf('.utravelnote.com')==-1){fileSrc='http://image.utravelnote.com'+fileSrc;}
if(parseInt(photoSeq)>0){var postData='photoSeq='+photoSeq;UtnAjax.action('/note/noteBackAct.php','getPhotoDesc',postData,setPhotoDesc);}
var tempImg=document.body.appendChild(document.createElement('img'));tempImg.photoSeq=photoSeq;tempImg.fileOrigin=fileOrigin;tempImg.style.visible='hidden';tempImg.onload=popviewImgLoad;tempImg.src=fileSrc;}
var objsetPhotoDescInt=null;var photoDescJson=null;function setPhotoDesc(oriReq){objsetPhotoDescInt=null;photoDescJson=null;var oJson=eval('('+oriReq.responseText+')');if(objsetPhotoDescInt==null){photoDescJson=oJson.json;objsetPhotoDescInt=setInterval(setPhotoDescInt,100);}}
var objresizePViewInt=null;function setPhotoDescInt(){if(photoDescJson!=null&&objsetPhotoDescInt!=null){if($('pViewPhotoTitle_'+photoDescJson.PHOTO_SEQ)){if(photoDescJson.PHOTO_TITLE!=null){$('pViewPhotoTitle_'+photoDescJson.PHOTO_SEQ).innerHTML=photoDescJson.PHOTO_TITLE;}
if(photoDescJson.PHOTO_DESC!=null){$('pViewPhotoDesc_'+photoDescJson.PHOTO_SEQ).innerHTML=photoDescJson.PHOTO_DESC;}
photoDescJson=null;clearInterval(objsetPhotoDescInt);objsetPhotoDescInt=null;objresizePViewInt=setInterval(resizePView,100);}}}
function resizePView(){var pViewbBarHeight=$('pViewbInner').getHeight();if(pViewbBarHeight>0){$('pViewbBarRight').style.height=(pViewbBarHeight)+'px';clearInterval(objresizePViewInt);objresizePViewInt=null;}}
function pViewLargeImg(src){UtnWbs.openWindow(src,'pViewLargeImg',1000,700,'yes');}