FC.PhotoZoom=Class.create({initialize:function(a){this.doc=document;this.clipNo=a;this.viewSize;this._getSize();this.docWidth=this.doc.documentElement.scrollWidth?this.doc.documentElement.scrollWidth:this.doc.body.scrollWidth;this.img={refSize:{ll:1024,l:800,m:480,s:240},size:{ll:null,l:null,m:null,s:null},currentSize:null};this.img.currentSize=this._fitSize();this.bgLayer=this.doc.createElement("div");this.bgLayer.id="bgLayer";this.bgLayer.style.height=this.doc.all?(this.doc.body.scrollHeight<this.viewSize.height)?this.viewSize.height:this.doc.body.scrollHeight:this.viewSize.height;this.photoScreen=this.doc.createElement("div");this.photoScreen.id="photoScreen";this.photoScreen.innerHTML='<img src="/stc/img/jp/common/spacer.gif" alt="" width="0" height="0" id="screen"/><p id="loading">読み込み中です<br /><img src="/stc/img/jp/common/loading_03.gif" alt="" width="15" height="15"/></p>';this.menu=this.doc.createElement("div");this.menu.id="zoomMenu";this.menu.innerHTML='<p class="logo"><a href="/"><img src="/stc/dt/_common/img/pz_logo_01.gif" width="80" height="21" alt="FlipClip"/></a></p><div id="zoomSize"><div><a href="#" title="Lサイズに変更します" onclick="this.blur(); return FC.photoZoom.set(\'ll\');"><img src="/stc/img/jp/common/spacer.gif" class="L" alt="Lサイズ" width="46" height="21"/></a><a href="#" title="Mサイズに変更します" onclick="this.blur(); return FC.photoZoom.set(\'l\');" ><img src="/stc/img/jp/common/spacer.gif" class="M" alt="Mサイズ" width="46" height="21"/></a><a href="#" title="Sサイズに変更します" onclick="this.blur(); return FC.photoZoom.set(\'m\');" ><img src="/stc/img/jp/common/spacer.gif" class="S" alt="Sサイズ" width="46" height="21"/></a></div></div><p class="close"><a href="#" title="拡大画面を閉じます" onclick="return FC.photoZoom.close();"><img src="/stc/dt/_common/img/pz_close_01.gif" width="17" height="20" alt="閉じる"/></a></p>';this.menu.sizeElement=[];this.bgLayer.onclick=function(){this.close()}.bind(this);this.close();this.doc.body.appendChild(this.bgLayer);this.photoScreen.appendChild(this.menu);this.doc.body.appendChild(this.photoScreen);Event.observe(window,"resize",function(){this._getSize();if(this.doc.all){this.bgLayer.style.height=(this.doc.body.scrollHeight<this.viewSize.height)?this.viewSize.height:this.doc.body.scrollHeight}if(this.img.currentSize!=null){this.photoScreen.style.left=(this.viewSize.width-this.img.refSize[this.img.currentSize])/2+this._scrollValue()+"px"}}.bind(this))},open:function(a){this.set(a||this.img.currentSize);this.bgLayer.style.display="block";this.photoScreen.style.display="block";if(this.doc.body.scrollTop>15||this.doc.documentElement.scrollTop>15){window.scroll(0,0)}return false},close:function(){this.photoScreen.style.display="none";this.bgLayer.style.display="none";return false},set:function(a){$("screen").style.display="none";$("loading").style.marginTop=this.viewSize.height/3+"px";$("loading").style.display="block";$("screen").style.backgroundImage="url("+this._get(a)+")";this._selectedSize(a);return false},_get:function(c){var b=this.img.size[c],a=this.img.refSize[c];getAfter=function(d){this.photoScreen.style.width=a+"px";this.photoScreen.style.height=b.height+"px";this.photoScreen.style.left=(this.viewSize.width-a)/2+this._scrollValue()+"px";$("screen").width=a;$("screen").height=b.height;this.menu.style.width=a+"px";$("loading").style.display="none";$("screen").style.display="inline"}.bind(this);if(this.img.size[c]==null){b=new Image();b.src="/get_clip?clip_no="+this.clipNo+"&size="+c;Event.observe(b,"load",function(){getAfter(c);this.menu.style.display="block"}.bind(this))}else{getAfter(c)}return b.src},_getSize:function(){this.viewSize=this.doc.viewport.getDimensions()},_fitSize:function(){if(this.viewSize.width>this.img.refSize.ll){return"ll"}else{if(this.viewSize.width>this.img.refSize.l){return"l"}else{if(this.viewSize.width>this.img.refSize.m){return"m"}else{return"l"}}}},_scrollValue:function(){var a=this.doc.documentElement.scrollLeft||this.doc.body.scrollLeft;return a},_selectedSize:function(c){var b=this.menu.sizeElement;if(b.length<1){b=$A($("zoomSize").getElementsByTagName("a"))}chk=function(a){switch(a){case"ll":return 0;case"l":return 1;case"m":return 2}};b[chk(this.img.currentSize)].className="";b[chk(c)].className="selected";this.img.currentSize=c}});
