/**
* A media-viewer script for web pages that allows content to be viewed without
* navigating away from the original linking page.
*
* This file is part of Shadowbox.
*
* Shadowbox is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Shadowbox is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Shadowbox. If not, see .
*
* @author Michael J. I. Jackson
* @copyright 2007 Michael J. I. Jackson
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL 3.0
* @version SVN: $Id: shadowbox.js 75 2008-02-21 16:51:29Z mjijackson $
*/
if(typeof Shadowbox=='undefined'){throw'Unable to load Shadowbox, no base library adapter found.';}(function(){var s='1.0';var u={assetURL:'',loadingImage:'images/loading.gif',animate:true,animSequence:'wh',flvPlayer:'flvplayer.swf',overlayColor:'#000',overlayOpacity:0.85,overlayBgImage:'images/overlay-85.png',listenOverlay:true,autoplayMovies:true,showMovieControls:true,resizeDuration:0.35,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:'default',viewportPadding:20,handleLgImages:'resize',initialHeight:160,initialWidth:320,enableKeys:true,keysClose:['c','q',27],keysNext:['n',39],keysPrev:['p',37],onOpen:null,onFinish:null,onChange:null,onClose:null,handleUnsupported:'link',skipSetup:false,text:{cancel:'Cancel',loading:'loading',close:'Close',next:'Next',prev:'Previous',errors:{single:'You must install the {1} browser plugin to view this content.',shared:'You must install both the {1} and {3} browser plugins to view this content.',either:'You must install either the {1} or the {3} browser plugin to view this content.'}},errors:{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'}},skin:{main:''+'',loading:'
'+'{2}',counter:'{0}
',close:'',next:'',prev:''},ext:{img:['png','jpg','jpeg','gif','bmp'],qt:['dv','mov','moov','movie','mp4'],wmp:['asf','wm','wmv'],qtwmp:['avi','mpg','mpeg'],iframe:['asp','aspx','cgi','cfm','htm','html','pl','php','php3','php4','php5','phtml','rb','rhtml','shtml','txt','vbs']}};var v=null;var x=Shadowbox.lib;var y={resize:/(img|swf|flv)/,overlay:/(img|iframe|html|inline)/,swf:/\.swf\s*$/i,flv:/\.flv\s*$/i,domain:/:\/\/(.*?)[:\/]/,inline:/#(.+)$/,rel:/^(light|shadow)box/i,gallery:/^(light|shadow)box\[(.*?)\]/i,unsupported:/^unsupported-(\w+)/,param:/\s*([a-z_]*?)\s*=\s*(.+)\s*/,empty:/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i};var z=[];var A;var B;var C=u.initialHeight;var D=u.initialWidth;var E=0;var F=0;var G;var H=false;var I=false;var J;var K;var L;var M=navigator.userAgent.toLowerCase();var N=document.compatMode=='CSS1Compat',isOpera=M.indexOf("opera")>-1,isIE=M.indexOf('msie')>-1,isIE7=M.indexOf('msie 7')>-1,isBorderBox=isIE&&!N,isSafari=(/webkit|khtml/).test(M),isSafari3=isSafari&&!!(document.evaluate),isGecko=!isSafari&&M.indexOf('gecko')>-1,isWindows=(M.indexOf('windows')!=-1||M.indexOf('win32')!=-1),isMac=(M.indexOf('macintosh')!=-1||M.indexOf('mac os x')!=-1),isLinux=(M.indexOf('linux')!=-1);var O=isIE&&!isIE7;var P=null;if(navigator.plugins&&navigator.plugins.length){var Q=function(a){var b=false;for(var i=0,len=navigator.plugins.length;i-1){b=true;break}}return b};var R=Q('Flip4Mac');var P={fla:Q('Shockwave Flash'),qt:Q('QuickTime'),wmp:!R&&Q('Windows Media'),f4m:R}}else{var Q=function(a){var b=false;try{var c=new ActiveXObject(a);if(c){b=true}}catch(e){}return b};var P={fla:Q('ShockwaveFlash.ShockwaveFlash'),qt:Q('QuickTime.QuickTime'),wmp:Q('wmplayer.ocx'),f4m:false}}var S=function(o,e){for(var p in e)o[p]=e[p];return o};var T=function(a){return typeof a.tagName=='string'&&(a.tagName.toUpperCase()=='A'||a.tagName.toUpperCase()=='AREA')};x.getViewportHeight=function(){var a=window.innerHeight;var b=document.compatMode;if((b||isIE)&&!isOpera){a=N?document.documentElement.clientHeight:document.body.clientHeight}return a};x.getViewportWidth=function(){var a=window.innerWidth;var b=document.compatMode;if(b||isIE){a=N?document.documentElement.clientWidth:document.body.clientWidth}return a};x.getDocumentHeight=function(){var a=N?document.documentElement.scrollHeight:document.body.scrollHeight;return Math.max(a,x.getViewportHeight())};x.getDocumentWidth=function(){var a=N?document.documentElement.scrollWidth:document.body.scrollWidth;return Math.max(a,x.getViewportWidth())};var U=function(a){if(isIE){if(typeof a.style.filter=='string'&&(/alpha/i).test(a.style.filter)){a.style.filter=''}}else{a.style.opacity='';a.style['-moz-opacity']='';a.style['-khtml-opacity']=''}};var V=function(a,b,c,d){if(u.animate){x.setStyle(a,'opacity',0);a.style.visibility='visible';x.animate(a,{opacity:{to:b}},c,function(){if(b==1)U(a);if(typeof d=='function')d()})}else{if(b==1){U(a)}else{x.setStyle(a,'opacity',b)}a.style.visibility='visible';if(typeof d=='function')d()}};var W=function(a,b,c){var d=function(){a.style.visibility='hidden';U(a);if(typeof c=='function')c()};if(u.animate){x.animate(a,{opacity:{to:0}},b,d)}else{d()}};var X=function(a,b){a=x.get(a);if(a.insertAdjacentHTML){a.insertAdjacentHTML('BeforeEnd',b);return a.lastChild}if(a.lastChild){var c=a.ownerDocument.createRange();c.setStartAfter(a.lastChild);var d=c.createContextualFragment(b);a.appendChild(d);return a.lastChild}else{a.innerHTML=b;return a.lastChild}};var Y=function(a,b){a=x.get(a);a.innerHTML=b;return a.firstChild};var Z=function(a){var h=Math.max(a.offsetHeight,a.clientHeight);if(!h){h=parseInt(x.getStyle(a,'height'),10)||0;if(!isBorderBox){h+=parseInt(x.getStyle(a,'padding-top'),10)+parseInt(x.getStyle(a,'padding-bottom'),10)+parseInt(x.getStyle(a,'border-top-width'),10)+parseInt(x.getStyle(a,'border-bottom-width'),10)}}return h};var ba=function(a){var w=Math.max(a.offsetWidth,a.clientWidth);if(!w){w=parseInt(x.getStyle(a,'width'),10)||0;if(!isBorderBox){w+=parseInt(x.getStyle(a,'padding-left'),10)+parseInt(x.getStyle(a,'padding-right'),10)+parseInt(x.getStyle(a,'border-left-width'),10)+parseInt(x.getStyle(a,'border-right-width'),10)}}return w};var bb=function(a){if(y.img.test(a))return'img';var b=a.match(y.domain);var c=b?document.domain==b[1]:false;if(a.indexOf('#')>-1&&c)return'inline';var d=a.indexOf('?');if(d>-1)a=a.substring(0,d);if(y.swf.test(a))return P.fla?'swf':'unsupported-swf';if(y.flv.test(a))return P.fla?'flv':'unsupported-flv';if(y.qt.test(a))return P.qt?'qt':'unsupported-qt';if(y.wmp.test(a)){if(P.wmp){return'wmp'}else if(P.f4m){return'qt'}else{return isMac?(P.qt?'unsupported-f4m':'unsupported-qtf4m'):'unsupported-wmp'}}else if(y.qtwmp.test(a)){if(P.qt){return'qt'}else if(P.wmp){return'wmp'}else{return isMac?'unsupported-qt':'unsupported-qtwmp'}}else if(!c||y.iframe.test(a)){return'iframe'}return'unsupported'};var bc=function(a){var b;if(T(this)){b=this}else{b=x.getTarget(a);while(!T(b)&&b.parentNode){b=b.parentNode}}Shadowbox.open(b);if(A.length)x.preventDefault(a)};var bd=function(a){var b=S({},a);if(!a.gallery){A=[b];B=0}else{A=[];var c,ci;for(var i=0,len=z.length;i'+m+''})}else{r=true}}else if(A[i].type=='inline'){var d=y.inline.exec(A[i].content);if(d){var e;if(e=x.get(d[1])){A[i].content=e.innerHTML}else{throw'No element found with id '+d[1];}}else{throw'No element id found for inline content';}}if(r){A.splice(i,1);if(i1){if(u.continuous){X(c,String.format(u.skin.next,u.text.next));X(c,String.format(u.skin.prev,u.text.prev))}else{if((A.length-1)>B){X(c,String.format(u.skin.next,u.text.next))}if(B>0){X(c,String.format(u.skin.prev,u.text.prev))}}}}if(A.length>1&&u.displayCounter){var d='';if(u.counterType=='skip'){for(var i=0,len=A.length;i'+(i+1)+''}}else{d=(B+1)+' of '+A.length}X(c,String.format(u.skin.counter,d))}};var bf=function(a){var b=Z(x.get('shadowbox_title'));var c=0-Z(x.get('shadowbox_toolbar'));var d=x.get('shadowbox_title_inner');var e=x.get('shadowbox_toolbar_inner');if(u.animate&&a){x.animate(d,{marginTop:{to:b}},0.2);x.animate(e,{marginTop:{to:c}},0.2,a)}else{x.setStyle(d,'marginTop',b+'px');x.setStyle(e,'marginTop',c+'px')}};var bg=function(a){var b=x.get('shadowbox_title_inner');if(u.animate){if(b.innerHTML!=''){x.animate(b,{marginTop:{to:0}},0.35)}x.animate(x.get('shadowbox_toolbar_inner'),{marginTop:{to:0}},0.35,a)}else{if(b.innerHTML!=''){x.setStyle(b,'margin-top','0px')}x.setStyle(x.get('shadowbox_toolbar_inner'),'margin-top','0px');a()}};var bh=function(){J={x:0,y:0,start_x:null,start_y:null}};var bi=function(a){if(a){bh();var b=['position:absolute','cursor:'+(isGecko?'-moz-grab':'move')];b.push(isIE?'background-color:#fff;filter:alpha(opacity=0)':'background-color:transparent');X('shadowbox_body_inner','');x.addEvent(x.get('shadowbox_drag_layer'),'mousedown',bj)}else{var d=x.get('shadowbox_drag_layer');if(d){x.removeEvent(d,'mousedown',bj);x.remove(d)}}};var bj=function(a){J.start_x=a.clientX;J.start_y=a.clientY;K=x.get('shadowbox_content');x.addEvent(document,'mousemove',bl);x.addEvent(document,'mouseup',bk);if(isGecko)x.setStyle(x.get('shadowbox_drag_layer'),'cursor','-moz-grabbing')};var bk=function(){x.removeEvent(document,'mousemove',bl);x.removeEvent(document,'mouseup',bk);if(isGecko)x.setStyle(x.get('shadowbox_drag_layer'),'cursor','-moz-grab')};var bl=function(a){var b=a.clientY-J.start_y;J.start_y=J.start_y+b;J.y=Math.max(Math.min(0,J.y+b),E-C);x.setStyle(K,'top',J.y+'px');var c=a.clientX-J.start_x;J.start_x=J.start_x+c;J.x=Math.max(Math.min(0,J.x+c),F-D);x.setStyle(K,'left',J.x+'px')};var bm=function(){var c=A[B];if(!c)return;be();switch(c.type){case'img':G=new Image();G.onload=function(){var h=c.height?parseInt(c.height,10):G.height;var w=c.width?parseInt(c.width,10):G.width;bp(h,w,function(a){bg(function(){bn({tag:'img',height:a.i_height,width:a.i_width,src:c.content,style:'position:absolute'});if(a.enableDrag&&u.handleLgImages=='drag'){bi(true);x.setStyle(x.get('shadowbox_drag_layer'),{height:a.i_height+'px',width:a.i_width+'px'})}bo()})});G.onload=function(){}};G.src=c.content;break;case'swf':case'flv':case'qt':case'wmp':var d=Shadowbox.movieMarkup(c);bp(d.height,d.width,function(){bg(function(){bn(d);bo()})});break;case'iframe':var h=c.height?parseInt(c.height,10):x.getViewportHeight();var w=c.width?parseInt(c.width,10):x.getViewportWidth();var e={tag:'iframe',name:'shadowbox_content',height:'100%',width:'100%',frameborder:'0',marginwidth:'0',marginheight:'0',scrolling:'auto'};bp(h,w,function(b){bg(function(){bn(e);var a=(isIE)?x.get('shadowbox_content').contentWindow:window.frames['shadowbox_content'];a.location=c.content;bo()})});break;case'html':case'inline':var h=c.height?parseInt(c.height,10):x.getViewportHeight();var w=c.width?parseInt(c.width,10):x.getViewportWidth();var e={tag:'div',cls:'html',html:c.content};bp(h,w,function(){bg(function(){bn(e);bo()})});break;default:throw'Shadowbox cannot open content of type '+c.type;}if(A.length>0){var f=A[B+1];if(!f){f=A[0]}if(f.type=='img'){var g=new Image();g.src=f.href}var i=A[B-1];if(!i){i=A[A.length-1]}if(i.type=='img'){var j=new Image();j.src=i.href}}};var bn=function(a){var b='shadowbox_content';var c=x.get(b);if(c){switch(c.tagName.toUpperCase()){case'OBJECT':var d=A[(a?B-1:B)];if(d.type=='wmp'&&isIE){try{shadowbox_content.controls.stop();shadowbox_content.URL='non-existent.wmv';window.shadowbox_content=function(){}}catch(e){}}else if(d.type=='qt'&&isSafari){try{document.shadowbox_content.Stop()}catch(e){}c.innerHTML=''}setTimeout(function(){x.remove(c)},10);break;case'IFRAME':x.remove(c);if(isGecko)delete window.frames[b];break;default:x.remove(c)}}if(a){if(!a.id)a.id=b;return X('shadowbox_body_inner',Shadowbox.createHTML(a))}return null};var bo=function(){var a=A[B];if(!a)return;bz(function(){bu(true);if(u.onFinish&&typeof u.onFinish=='function'){u.onFinish(a)}})};var bp=function(a,b,c){C=a;D=b;var d=y.resize.test(A[B].type);var e=bq(C,D,d);if(c){var f=function(){c(e)};switch(u.animSequence){case'hw':bs(e.height,e.top,true,function(){bt(e.width,true,f)});break;case'wh':bt(e.width,true,function(){bs(e.height,e.top,true,f)});break;default:bt(e.width,true);bs(e.height,e.top,true,f)}}else{bt(e.width,false);bs(e.height,e.top,false);if(u.handleLgImages=='resize'&&d){var g=x.get('shadowbox_content');if(g){g.height=e.i_height;g.width=e.i_width}}}};var bq=function(a,b,c){if(typeof c=='undefined')c=false;var d=a=parseInt(a);var e=b=parseInt(b);var f=x.get('shadowbox_body');var g=x.getViewportHeight();var h=parseInt(x.getStyle(f,'border-top-width'),10)+parseInt(x.getStyle(f,'border-bottom-width'),10)+parseInt(x.getStyle(f,'margin-top'),10)+parseInt(x.getStyle(f,'margin-bottom'),10)+Z(x.get('shadowbox_title'))+Z(x.get('shadowbox_toolbar'))+(2*u.viewportPadding);if((d+h)>=g){d=g-h}var i=x.getViewportWidth();var j=parseInt(x.getStyle(f,'border-left-width'),10)+parseInt(x.getStyle(f,'border-right-width'),10)+parseInt(x.getStyle(f,'margin-left'),10)+parseInt(x.getStyle(f,'margin-right'),10);var k=j+(2*u.viewportPadding);if((e+k)>=i){e=i-k}var l=false;var m=a;var n=b;var o=u.handleLgImages;if(c&&(o=='resize'||o=='drag')){var p=(a-d)/a;var q=(b-e)/b;if(o=='resize'){if(p>q){e=Math.round((b/a)*d)}else if(q>p){d=Math.round((a/b)*e)}n=e;m=d}else{var r=A[B];if(r)l=r.type=='img'&&(p>0||q>0)}}return{height:d,width:e+j,i_height:m,i_width:n,top:((g-(d+h))/2)+u.viewportPadding,enableDrag:l}};var br=function(){var a=x.get('shadowbox');var b=document.documentElement.scrollTop;var c=b+Math.round((x.getViewportHeight()-(a.offsetHeight||0))/2);x.setStyle(a,'top',c+'px')};var bs=function(a,b,c,d){a=parseInt(a);E=a;var e=x.get('shadowbox_body_inner');if(c&&u.animate){x.animate(e,{height:{to:a}},u.resizeDuration,d)}else{x.setStyle(e,'height',a+'px');if(typeof d=='function')d()}if(O){br();x.addEvent(window,'scroll',br);b+=document.documentElement.scrollTop}var f=x.get('shadowbox');if(c&&u.animate){x.animate(f,{top:{to:b}},u.resizeDuration)}else{x.setStyle(f,'top',b+'px')}};var bt=function(a,b,c){a=parseInt(a);F=a;var d=x.get('shadowbox');if(b&&u.animate){x.animate(d,{width:{to:a}},u.resizeDuration,c)}else{x.setStyle(d,'width',a+'px');if(typeof c=='function')c()}};var bu=function(a){if(!u.enableKeys)return;if(a){document.onkeydown=bw}else{document.onkeydown=''}};var bv=function(a,b,c){return(a.indexOf(b)!=-1||a.indexOf(c)!=-1)};var bw=function(e){var a=e?e.which:event.keyCode;var b=String.fromCharCode(a).toLowerCase();if(bv(u.keysClose,b,a)){Shadowbox.close()}else if(bv(u.keysPrev,b,a)){Shadowbox.previous()}else if(bv(u.keysNext,b,a)){Shadowbox.next()}};var bx=function(a){var b=(a?'visible':'hidden');var c=document.getElementsByTagName('select');for(i=0,len=c.length;i\n'}else{b+='>\n';var d=a.children;if(d){for(var i=0,len=d.length;i\n'}return b};Shadowbox.getPlugins=function(){return P};Shadowbox.getOptions=function(){return u};Shadowbox.getCurrent=function(){return A[B]};Shadowbox.getVersion=function(){return s}})();Array.prototype.indexOf=Array.prototype.indexOf||function(o){for(var i=0,len=this.length;i