/*! * Shadowbox.js, version 3.0.3 * http://shadowbox-js.com/ * * Copyright 2007-2010, Michael J. I. Jackson * 2010-03-10 00:00:00 +0000 */ (function(window, undefined) { var S={version:"3.0.3"};var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")>-1||ua.indexOf("win32")>-1){S.isWindows=true}else{if(ua.indexOf("macintosh")>-1||ua.indexOf("mac os x")>-1){S.isMac=true}else{if(ua.indexOf("linux")>-1){S.isLinux=true}}}S.isIE=ua.indexOf("msie")>-1;S.isIE6=ua.indexOf("msie 6")>-1;S.isIE7=ua.indexOf("msie 7")>-1;S.isGecko=ua.indexOf("gecko")>-1&&ua.indexOf("safari")==-1;S.isWebKit=ua.indexOf("applewebkit/")>-1;var inlineId=/#(.+)$/,galleryName=/^(light|shadow)box\[(.*?)\]/i,inlineParam=/\s*([a-z_]*?)\s*=\s*(.+)\s*/,fileExtension=/[0-9a-z]+$/i,scriptPath=/(.+\/)shadowbox\.js/i;var open=false,initialized=false,lastOptions={},slideDelay=0,slideStart,slideTimer;S.current=-1;S.dimensions=null;S.ease=function(a){return 1+Math.pow(a-1,3)};S.errorInfo={fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}};S.gallery=[];S.onReady=noop;S.path='http://www.town.wassamu.hokkaido.jp/industrial-development/files/shadowbox-js/src/';S.player=null;S.playerId="sb-player";S.options={animate:true,animateFade:true,autoplayMovies:true,continuous:false,enableKeys:true,flashParams:{bgcolor:"#000000",allowfullscreen:true},flashVars:{},flashVersion:"9.0.115",handleOversize:"resize",handleUnsupported:"link",onChange:noop,onClose:noop,onFinish:noop,onOpen:noop,showMovieControls:true,skipSetup:false,slideshowDelay:0,viewportPadding:20};S.getCurrent=function(){return S.current>-1?S.gallery[S.current]:null};S.hasNext=function(){return S.gallery.length>1&&(S.current!=S.gallery.length-1||S.options.continuous)};S.isOpen=function(){return open};S.isPaused=function(){return slideTimer=="pause"};S.applyOptions=function(a){lastOptions=apply({},S.options);apply(S.options,a)};S.revertOptions=function(){apply(S.options,lastOptions)};S.init=function(c,f){if(initialized){return}initialized=true;if(S.skin.options){apply(S.options,S.skin.options)}if(c){apply(S.options,c)}if(!S.path){var e,b=document.getElementsByTagName("script");for(var d=0,a=b.length;dm){o=m-i}var c=2*k+a;if(f+c>n){f=n-c}var b=(j-o)/j,l=(d-f)/d,g=(b>0||l>0);if(h&&g){if(b>l){f=Math.round((d/j)*o)}else{if(l>b){o=Math.round((j/d)*f)}}}S.dimensions={height:o+e,width:f+a,innerHeight:o,innerWidth:f,top:Math.floor((m-(o+i))/2+k),left:Math.floor((n-(f+c))/2+k),oversized:g};return S.dimensions};S.makeGallery=function(e){var a=[],d=-1;if(typeof e=="string"){e=[e]}if(typeof e.length=="number"){each(e,function(g,h){if(h.content){a[g]=h}else{a[g]={content:h}}});d=0}else{if(e.tagName){var b=S.getCache(e);e=b?b:S.makeObject(e)}if(e.gallery){a=[];var f;for(var c in S.cache){f=S.cache[c];if(f.gallery&&f.gallery==e.gallery){if(d==-1&&f.content==e.content){d=a.length}a.push(f)}}if(d==-1){a.unshift(e);d=0}}else{a=[e];d=0}}each(a,function(g,h){a[g]=apply({},h)});return[a,d]};S.makeObject=function(d,c){var e={content:d.href,title:d.getAttribute("title")||"",link:d};if(c){c=apply({},c);each(["player","title","height","width","gallery"],function(f,g){if(typeof c[g]!="undefined"){e[g]=c[g];delete c[g]}});e.options=c}else{e.options={}}if(!e.player){e.player=S.getPlayer(e.content)}var a=d.getAttribute("rel");if(a){var b=a.match(galleryName);if(b){e.gallery=escape(b[2])}each(a.split(";"),function(f,g){b=g.match(inlineParam);if(b){e[b[1]]=b[2]}})}return e};S.getPlayer=function(c){if(c.indexOf("#")>-1&&c.indexOf(document.location.href)==0){return"inline"}var d=c.indexOf("?");if(d>-1){c=c.substring(0,d)}var b,a=c.match(fileExtension);if(a){b=a[0].toLowerCase()}if(b){if(S.img&&S.img.ext.indexOf(b)>-1){return"img"}if(S.swf&&S.swf.ext.indexOf(b)>-1){return"swf"}if(S.flv&&S.flv.ext.indexOf(b)>-1){return"flv"}if(S.qt&&S.qt.ext.indexOf(b)>-1){if(S.wmp&&S.wmp.ext.indexOf(b)>-1){return"qtwmp"}else{return"qt"}}if(S.wmp&&S.wmp.ext.indexOf(b)>-1){return"wmp"}}return"iframe"};function filterGallery(){var d=S.errorInfo,e=S.plugins,g,h,l,c,k,b,j,a;for(var f=0;f'+sprintf(S.lang.errors[k],b)+""}else{h=true}}else{if(g.player=="inline"){c=inlineId.exec(g.content);if(c){j=get(c[1]);if(j){g.content=j.innerHTML}else{h=true}}else{h=true}}else{if(g.player=="swf"||g.player=="flv"){a=(g.options&&g.options.flashVersion)||S.options.flashVersion;if(S.flash&&!S.flash.hasFlashPlayerVersion(a)){g.width=310;g.height=177}}}}if(h){S.gallery.splice(f,1);if(f0?f-1:f}}--f}}}function listenKeys(a){if(!S.options.enableKeys){return}(a?addEvent:removeEvent)(document,"keydown",handleKey)}function handleKey(c){if(c.metaKey||c.shiftKey||c.altKey||c.ctrlKey){return}var b=keyCode(c),a;switch(b){case 81:case 88:case 27:a=S.close;break;case 37:a=S.previous;break;case 39:a=S.next;break;case 32:a=typeof slideTimer=="number"?S.pause:S.play;break}if(a){preventDefault(c);a()}}function load(i){listenKeys(false);var h=S.getCurrent();var e=(h.player=="inline"?"html":h.player);if(typeof S[e]!="function"){throw"unknown player "+e}if(i){S.player.remove();S.revertOptions();S.applyOptions(h.options||{})}S.player=new S[e](h,S.playerId);if(S.gallery.length>1){var f=S.gallery[S.current+1]||S.gallery[0];if(f.player=="img"){var d=new Image();d.src=f.content}var g=S.gallery[S.current-1]||S.gallery[S.gallery.length-1];if(g.player=="img"){var c=new Image();c.src=g.content}}S.skin.onLoad(i,waitReady)}function waitReady(){if(!open){return}if(typeof S.player.ready!="undefined"){var a=setInterval(function(){if(open){if(S.player.ready){clearInterval(a);a=null;S.skin.onReady(show)}}else{clearInterval(a);a=null}},10)}else{S.skin.onReady(show)}}function show(){if(!open){return}S.player.append(S.skin.body,S.dimensions);S.skin.onShow(finish)}function finish(){if(!open){return}if(S.player.onLoad){S.player.onLoad()}S.options.onFinish(S.getCurrent());if(!S.isPaused()){S.play()}listenKeys(true)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b,c){var a=this.length>>>0;c=c||0;if(c<0){c+=a}for(;c-1;S.plugins={fla:names.indexOf("Shockwave Flash")>-1,qt:names.indexOf("QuickTime")>-1,wmp:!f4m&&names.indexOf("Windows Media")>-1,f4m:f4m}}else{var detectPlugin=function(a){var b;try{b=new ActiveXObject(a)}catch(c){}return !!b};S.plugins={fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),qt:detectPlugin("QuickTime.QuickTime"),wmp:detectPlugin("wmplayer.ocx"),f4m:false}};var relAttr=/^(light|shadow)box/i,expando="shadowboxCacheKey",cacheKey=1;S.cache={};S.select=function(b){var c=[];if(!b){var a;each(document.getElementsByTagName("a"),function(f,g){a=g.getAttribute("rel");if(a&&relAttr.test(a)){c.push(g)}})}else{var e=b.length;if(e){if(typeof b=="string"){if(S.find){c=S.find(b)}}else{if(e==2&&typeof b[0]=="string"&&b[1].nodeType){if(S.find){c=S.find(b[0],b[1])}}else{for(var d=0;d{1} を追加する必要があります。',shared:'このコンテンツを表示するにはプラグイン {1}{3} を追加する必要があります。',either:'このコンテンツを表示するにはプラグイン {1} または {3} を追加する必要があります。'}};S.html=function(a,b){this.obj=a;this.id=b;this.height=a.height?parseInt(a.height,10):300;this.width=a.width?parseInt(a.width,10):500};S.html.prototype={append:function(a,b){var c=document.createElement("div");c.id=this.id;c.className="html";c.innerHTML=this.obj.content;a.appendChild(c)},remove:function(){var a=get(this.id);if(a){remove(a)}}};var pre,proxyId="sb-drag-proxy",dragData,dragProxy,dragTarget;function resetDrag(){dragData={x:0,y:0,startX:null,startY:null}}function updateProxy(){var a=S.dimensions;apply(dragProxy.style,{height:a.innerHeight+"px",width:a.innerWidth+"px"})}function enableDrag(){resetDrag();var a=["position:absolute","cursor:"+(S.isGecko?"-moz-grab":"move"),"background-color:"+(S.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");S.appendHTML(S.skin.body,'
');dragProxy=get(proxyId);updateProxy();addEvent(dragProxy,"mousedown",startDrag)}function disableDrag(){if(dragProxy){removeEvent(dragProxy,"mousedown",startDrag);remove(dragProxy);dragProxy=null}dragTarget=null}function startDrag(b){preventDefault(b);var a=getPageXY(b);dragData.startX=a[0];dragData.startY=a[1];dragTarget=get(S.player.id);addEvent(document,"mousemove",positionDrag);addEvent(document,"mouseup",endDrag);if(S.isGecko){dragProxy.style.cursor="-moz-grabbing"}}function positionDrag(f){var a=S.player,g=S.dimensions,d=getPageXY(f);var c=d[0]-dragData.startX;dragData.startX+=c;dragData.x=Math.max(Math.min(0,dragData.x+c),g.innerWidth-a.width);var b=d[1]-dragData.startY;dragData.startY+=b;dragData.y=Math.max(Math.min(0,dragData.y+b),g.innerHeight-a.height);apply(dragTarget.style,{left:dragData.x+"px",top:dragData.y+"px"})}function endDrag(){removeEvent(document,"mousemove",positionDrag);removeEvent(document,"mouseup",endDrag);if(S.isGecko){dragProxy.style.cursor="-moz-grab"}}S.img=function(b,c){this.obj=b;this.id=c;this.ready=false;var a=this;pre=new Image();pre.onload=function(){a.height=b.height?parseInt(b.height,10):pre.height;a.width=b.width?parseInt(b.width,10):pre.width;a.ready=true;pre.onload=null;pre=null};pre.src=b.content};S.img.ext=["bmp","gif","jpg","jpeg","png"];S.img.prototype={append:function(b,e){var c=document.createElement("img");c.id=this.id;c.src=this.obj.content;c.style.position="absolute";var a,d;if(e.oversized&&S.options.handleOversize=="resize"){a=e.innerHeight;d=e.innerWidth}else{a=this.height;d=this.width}c.setAttribute("height",a);c.setAttribute("width",d);b.appendChild(c)},remove:function(){var a=get(this.id);if(a){remove(a)}disableDrag();if(pre){pre.onload=null;pre=null}},onLoad:function(){var a=S.dimensions;if(a.oversized&&S.options.handleOversize=="drag"){enableDrag()}},onWindowResize:function(){var d=S.dimensions;switch(S.options.handleOversize){case"resize":var a=get(this.id);a.height=d.innerHeight;a.width=d.innerWidth;break;case"drag":if(dragTarget){var c=parseInt(S.getStyle(dragTarget,"top")),b=parseInt(S.getStyle(dragTarget,"left"));if(c+this.height=f){clearInterval(b);b=null;i(c,j);if(n){n()}}else{i(c,k+g((e-d)/h)*l)}},10)}function setSize(){container.style.height=S.getWindowSize("Height")+"px";container.style.width=S.getWindowSize("Width")+"px"}function setPosition(){container.style.top=document.documentElement.scrollTop+"px";container.style.left=document.documentElement.scrollLeft+"px"}function toggleTroubleElements(a){if(a){each(visibilityCache,function(b,c){c[0].style.visibility=c[1]||""})}else{visibilityCache=[];each(S.options.troubleElements,function(c,b){each(document.getElementsByTagName(b),function(d,e){visibilityCache.push([e,e.style.visibility]);e.style.visibility="hidden"})})}}function toggleNav(c,a){var b=get("sb-nav-"+c);if(b){b.style.display=a?"":"none"}}function toggleLoading(a,f){var e=get("sb-loading"),c=S.getCurrent().player,d=(c=="img"||c=="html");if(a){S.setOpacity(e,0);e.style.display="block";var b=function(){S.clearOpacity(e);if(f){f()}};if(d){animate(e,"opacity",1,S.options.fadeDuration,b)}else{b()}}else{var b=function(){e.style.display="none";S.clearOpacity(e);if(f){f()}};if(d){animate(e,"opacity",0,S.options.fadeDuration,b)}else{b()}}}function buildBars(m){var f=S.getCurrent();get("sb-title-inner").innerHTML=f.title||"";var n,j,b,o,k;if(S.options.displayNav){n=true;var l=S.gallery.length;if(l>1){if(S.options.continuous){j=k=true}else{j=(l-1)>S.current;k=S.current>0}}if(S.options.slideshowDelay>0&&S.hasNext()){o=!S.isPaused();b=!o}}else{n=j=b=o=k=false}toggleNav("close",n);toggleNav("next",j);toggleNav("play",b);toggleNav("pause",o);toggleNav("previous",k);var a="";if(S.options.displayCounter&&S.gallery.length>1){var l=S.gallery.length;if(S.options.counterType=="skip"){var e=0,d=l,c=parseInt(S.options.counterLimit)||0;if(c2){var g=Math.floor(c/2);e=S.current-g;if(e<0){e+=l}d=S.current+(c-g);if(d>l){d-=l}}while(e!=d){if(e==l){e=0}a+='"}}else{a=[S.current+1,S.lang.of,l].join(" ")}}get("sb-counter").innerHTML=a;m()}function showBars(d){var a=get("sb-title-inner"),c=get("sb-info-inner"),b=0.35;a.style.visibility=c.style.visibility="";if(a.innerHTML!=""){animate(a,"marginTop",0,b)}animate(c,"marginTop",0,b,d)}function hideBars(c,i){var g=get("sb-title"),a=get("sb-info"),d=g.offsetHeight,e=a.offsetHeight,f=get("sb-title-inner"),h=get("sb-info-inner"),b=(c?0.35:0);animate(f,"marginTop",d,b);animate(h,"marginTop",e*-1,b,function(){f.style.visibility=h.style.visibility="hidden";i()})}function adjustHeight(a,d,b,f){var e=get("sb-wrapper-inner"),c=(b?S.options.resizeDuration:0);animate(wrapper,"top",d,c);animate(e,"height",a,c,f)}function adjustWidth(a,d,b,e){var c=(b?S.options.resizeDuration:0);animate(wrapper,"left",d,c);animate(wrapper,"width",a,c,e)}function setDimensions(i,c){var e=get("sb-body-inner"),i=parseInt(i),c=parseInt(c),b=wrapper.offsetHeight-e.offsetHeight,a=wrapper.offsetWidth-e.offsetWidth,g=overlay.offsetHeight,h=overlay.offsetWidth,f=parseInt(S.options.viewportPadding)||20,d=(S.player&&S.options.handleOversize!="drag");return S.setDimensions(i,c,g,h,b,a,f,d)}var K={};K.markup='';K.options={animSequence:"sync",counterLimit:10,counterType:"default",displayCounter:true,displayNav:true,fadeDuration:0.35,initialHeight:160,initialWidth:320,modal:false,overlayColor:"#000",overlayOpacity:0.5,resizeDuration:0.35,showOverlay:true,troubleElements:["select","object","embed","canvas"]};K.init=function(){S.appendHTML(document.body,sprintf(K.markup,S.lang));K.body=get("sb-body-inner");container=get("sb-container");overlay=get("sb-overlay");wrapper=get("sb-wrapper");if(!supportsFixed){container.style.position="absolute"}if(!supportsOpacity){var c,a,b=/url\("(.*\.png)"\)/;each(pngIds,function(e,f){c=get(f);if(c){a=S.getStyle(c,"backgroundImage").match(b);if(a){c.style.backgroundImage="none";c.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+a[1]+",sizingMethod=scale);"}}})}var d;addEvent(window,"resize",function(){if(d){clearTimeout(d);d=null}if(open){d=setTimeout(K.onWindowResize,10)}})};K.onOpen=function(a,c){doWindowResize=false;container.style.display="block";setSize();var b=setDimensions(S.options.initialHeight,S.options.initialWidth);adjustHeight(b.innerHeight,b.top);adjustWidth(b.width,b.left);if(S.options.showOverlay){overlay.style.backgroundColor=S.options.overlayColor;S.setOpacity(overlay,0);if(!S.options.modal){addEvent(overlay,"click",S.close)}overlayOn=true}if(!supportsFixed){setPosition();addEvent(window,"scroll",setPosition)}toggleTroubleElements();container.style.visibility="visible";if(overlayOn){animate(overlay,"opacity",S.options.overlayOpacity,S.options.fadeDuration,c)}else{c()}};K.onLoad=function(b,a){toggleLoading(true);while(K.body.firstChild){remove(K.body.firstChild)}hideBars(b,function(){if(!open){return}if(!b){wrapper.style.visibility="visible"}buildBars(a)})};K.onReady=function(d){if(!open){return}var b=S.player,c=setDimensions(b.height,b.width);var a=function(){showBars(d)};switch(S.options.animSequence){case"hw":adjustHeight(c.innerHeight,c.top,true,function(){adjustWidth(c.width,c.left,true,a)});break;case"wh":adjustWidth(c.width,c.left,true,function(){adjustHeight(c.innerHeight,c.top,true,a)});break;default:adjustWidth(c.width,c.left,true);adjustHeight(c.innerHeight,c.top,true,a)}};K.onShow=function(a){toggleLoading(false,a);doWindowResize=true};K.onClose=function(){if(!supportsFixed){removeEvent(window,"scroll",setPosition)}removeEvent(overlay,"click",S.close);wrapper.style.visibility="hidden";var a=function(){container.style.visibility="hidden";container.style.display="none";toggleTroubleElements(true)};if(overlayOn){animate(overlay,"opacity",0,S.options.fadeDuration,a)}else{a()}};K.onPlay=function(){toggleNav("play",false);toggleNav("pause",true)};K.onPause=function(){toggleNav("pause",false);toggleNav("play",true)};K.onWindowResize=function(){if(!doWindowResize){return}setSize();var a=S.player,b=setDimensions(a.height,a.width);adjustWidth(b.width,b.left);adjustHeight(b.innerHeight,b.top);if(a.onWindowResize){a.onWindowResize()}};S.skin=K;// expose window['Shadowbox'] = S; })(window);