if(typeof Effect=="undefined")throw"lightwindow.js requires including script.aculo.us' effects.js library!";try{document.execCommand("BackgroundImageCache",!1,!0)}catch(e$$5){}var lightwindow=Class.create();
lightwindow.prototype={element:null,contentToFetch:null,windowActive:!1,dataEffects:[],dimensions:{cruft:null,container:null,viewport:{height:null,width:null,offsetTop:null,offsetLeft:null}},pagePosition:{x:0,y:0},pageDimensions:{width:null,height:null},preloadImage:[],preloadedImage:[],galleries:[],resizeTo:{height:null,heightPercent:null,width:null,widthPercent:null,fixedTop:null,fixedLeft:null},scrollbarOffset:18,navigationObservers:{previous:null,next:null},containerChange:{height:0,width:0},
activeGallery:!1,galleryLocation:{current:0,total:0},initialize:function(a){this.options=Object.extend({resizeSpeed:12,contentOffset:{height:20,width:20},dimensions:{image:{height:250,width:250},page:{height:250,width:250},inline:{height:250,width:250},media:{height:250,width:250},external:{height:250,width:250},titleHeight:25},classNames:{standard:"lightwindow",action:"lightwindow_action"},fileTypes:{page:["asp","aspx","cgi","cfm","htm","html","pl","php4","php3","php","php5","phtml","rhtml","shtml",
"txt","vbs","rb"],media:["aif","aiff","asf","avi","divx","m1v","m2a","m2v","m3u","mid","midi","mov","moov","movie","mp2","mp3","mpa","mpa","mpe","mpeg","mpg","mpg","mpga","pps","qt","rm","ram","swf","viv","vivo","wav"],image:["bmp","gif","jpg","png","tiff"]},mimeTypes:{avi:"video/avi",aif:"audio/aiff",aiff:"audio/aiff",gif:"image/gif",bmp:"image/bmp",jpeg:"image/jpeg",m1v:"video/mpeg",m2a:"audio/mpeg",m2v:"video/mpeg",m3u:"audio/x-mpequrl",mid:"audio/x-midi",midi:"audio/x-midi",mjpg:"video/x-motion-jpeg",
moov:"video/quicktime",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp3:"audio/mpeg3",mpa:"audio/mpeg",mpa:"video/mpeg",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"audio/mpeg",mpg:"video/mpeg",mpga:"audio/mpeg",pdf:"application/pdf",png:"image/png",pps:"application/mspowerpoint",qt:"video/quicktime",ram:"audio/x-pn-realaudio-plugin",rm:"application/vnd.rn-realmedia",swf:"application/x-shockwave-flash",tiff:"image/tiff",viv:"video/vivo",vivo:"video/vivo",wav:"audio/wav",wmv:"application/x-mplayer2"},
classids:{mov:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",swf:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",wmv:"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"},codebases:{mov:"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0",swf:"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0",wmv:"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"},viewportPadding:10,EOLASFix:"swf,wmv,fla,flv",overlay:{opacity:0.7,image:"images/black.png",
presetImage:"images/black-70.png"},skin:{main:'<div id="lightwindow_container" ><div id="lightwindow_title_bar" ><div id="lightwindow_title_bar_inner" ><span id="lightwindow_title_bar_title"></span><a id="lightwindow_title_bar_close_link" >sluiten</a></div></div><div id="lightwindow_stage" ><div id="lightwindow_contents" ></div><div id="lightwindow_navigation" ><a href="#" id="lightwindow_previous" ><span id="lightwindow_previous_title"></span></a><a href="#" id="lightwindow_next" ><span id="lightwindow_next_title"></span></a><iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div><div id="lightwindow_galleries"><div id="lightwindow_galleries_tab_container" ><a href="#" id="lightwindow_galleries_tab" ><span id="lightwindow_galleries_tab_span" class="up" >Galleries</span></a></div><div id="lightwindow_galleries_list" ></div></div></div><div id="lightwindow_data_slide" ><div id="lightwindow_data_slide_inner" ><div id="lightwindow_data_details" ><div id="lightwindow_data_gallery_container" ><span id="lightwindow_data_gallery_current"></span> of <span id="lightwindow_data_gallery_total"></span></div><div id="lightwindow_data_author_container" >by <span id="lightwindow_data_author"></span></div></div><div id="lightwindow_data_caption" ></div></div></div></div>',
loading:'<div id="lightwindow_loading" ><img src="images/ajax-loading.gif" alt="loading" /><span>Bezig met laden... <a href="javascript: myLightWindow.deactivate();">Annuleren</a></span><iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe></div>',iframe:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><body>{body_replace}</body></html>',
gallery:{top:'<div class="lightwindow_galleries_list"><h1>{gallery_title_replace}</h1><ul>',middle:"<li>{gallery_link_replace}</li>",bottom:"</ul></div>"}},formMethod:"get",hideFlash:!1,hideGalleryTab:!1,showTitleBar:!0,animationHandler:!1,navigationHandler:!1,transitionHandler:!1,finalAnimationHandler:!1,formHandler:!1,galleryAnimationHandler:!1,showGalleryCount:!0},a||{});this.duration=(11-this.options.resizeSpeed)*0.15;this._setupLinks();this._getScroll();this._getPageDimensions();this._browserDimensions();
this._addLightWindowMarkup(!1);this._setupDimensions();this.buildGalleryList()},activate:function(a,b){this._clearWindowContents(!0);this._addLoadingWindowMarkup();this._setupWindowElements(b);this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements("hidden",!1);this._displayLightWindow("block","hidden");this._setStatus(!0);this._monitorKeyboard(!0);this._prepareIE(!0);this._loadWindow()},deactivate:function(){this.activeGallery=this.windowActive=!1;this.options.hideGalleryTab||
this._handleGalleryAnimation(!1);this.animating=!1;this.element=null;this._displayLightWindow("none","visible");this._clearWindowContents(!1);Effect.Queues.get("lightwindowAnimation").each(function(a){a.cancel()});this._prepareIE(!1);this._setupDimensions();this._toggleTroubleElements("visible",!1);this._monitorKeyboard(!1)},createWindow:function(a){this._processLink($(a))},activateWindow:function(a){this.element=Object.extend({href:null,title:null,author:null,caption:null,rel:null,top:null,left:null,
type:null,showImages:null,height:null,width:null,loadingAnimation:null,iframeEmbed:null,form:null},a||{});this.contentToFetch=this.element.href;this.windowType=this.element.type?this.element.type:this._fileType(this.element.href);this._clearWindowContents(!0);this._addLoadingWindowMarkup();this._getScroll();this._browserDimensions();this._setupDimensions();this._toggleTroubleElements("hidden",!1);this._displayLightWindow("block","hidden");this._setStatus(!0);this._monitorKeyboard(!0);this._prepareIE(!0);
this._loadWindow()},submitForm:function(a){this.options.formHandler?this.options.formHandler(a):this._defaultFormHandler(a)},openWindow:function(a){a=$(a);this.windowActive=!0;this._clearWindowContents(!0);this._addLoadingWindowMarkup();this._setupWindowElements(a);this._setStatus(!0);this._handleTransition()},navigateWindow:function(a){this._handleNavigation(!1);a=="previous"?this.openWindow(this.navigationObservers.previous):a=="next"&&this.openWindow(this.navigationObservers.next)},buildGalleryList:function(){var a=
"",b;for(i in this.galleries)if(typeof this.galleries[i]=="object"){a+=this.options.skin.gallery.top.replace("{gallery_title_replace}",unescape(i));for(j in this.galleries[i])typeof this.galleries[i][j]=="object"&&(b='<a href="#" id="lightwindow_gallery_'+i+"_"+j+'" >'+unescape(j)+"</a>",a+=this.options.skin.gallery.middle.replace("{gallery_link_replace}",b));a+=this.options.skin.gallery.bottom}new Insertion.Top("lightwindow_galleries_list",a);for(i in this.galleries)if(typeof this.galleries[i]==
"object")for(j in this.galleries[i])if(typeof this.galleries[i][j]=="object")Event.observe($("lightwindow_gallery_"+i+"_"+j),"click",this.openWindow.bind(this,this.galleries[i][j][0]),!1),$("lightwindow_gallery_"+i+"_"+j).onclick=function(){return!1}},_setupLinks:function(){$$("."+this.options.classNames.standard).each(function(a){this._processLink(a)}.bind(this))},_processLink:function(a){if(this._fileType(a.getAttribute("href"))=="image"||this._fileType(a.getAttribute("href"))=="media")if(gallery=
this._getGalleryInfo(a.rel))this.galleries[gallery[0]]||(this.galleries[gallery[0]]=[]),this.galleries[gallery[0]][gallery[1]]||(this.galleries[gallery[0]][gallery[1]]=[]),this.galleries[gallery[0]][gallery[1]].push(a);var b=a.getAttribute("href");b.indexOf("?")>-1&&(b=b.substring(0,b.indexOf("?")));b=b.substring(b.indexOf("#")+1);$(b)&&$(b).setStyle({display:"none"});Event.observe(a,"click",this.activate.bindAsEventListener(this,a),!1);a.onclick=function(){return!1}},_setupActions:function(){$$("#lightwindow_container ."+
this.options.classNames.action).each(function(a){Event.observe(a,"click",this[a.getAttribute("rel")].bindAsEventListener(this,a),!1);a.onclick=function(){return!1}}.bind(this))},_addLightWindowMarkup:function(){var a=Element.extend(document.createElement("div"));a.setAttribute("id","lightwindow_overlay");Prototype.Browser.Gecko?a.setStyle({backgroundImage:"url("+this.options.overlay.presetImage+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"}):a.setStyle({opacity:this.options.overlay.opacity,
backgroundImage:"url("+this.options.overlay.image+")",backgroundRepeat:"repeat",height:this.pageDimensions.height+"px"});var b=document.createElement("div");b.setAttribute("id","lightwindow");b.innerHTML=this.options.skin.main;var c=document.getElementsByTagName("body")[0];c.appendChild(a);c.appendChild(b);if($("lightwindow_title_bar_close_link"))Event.observe("lightwindow_title_bar_close_link","click",this.deactivate.bindAsEventListener(this)),$("lightwindow_title_bar_close_link").onclick=function(){return!1};
Event.observe($("lightwindow_previous"),"click",this.navigateWindow.bind(this,"previous"),!1);$("lightwindow_previous").onclick=function(){return!1};Event.observe($("lightwindow_next"),"click",this.navigateWindow.bind(this,"next"),!1);$("lightwindow_next").onclick=function(){return!1};if(!this.options.hideGalleryTab)Event.observe($("lightwindow_galleries_tab"),"click",this._handleGalleryAnimation.bind(this,!0),!1),$("lightwindow_galleries_tab").onclick=function(){return!1};Prototype.Browser.IE?Event.observe(document,
"mousewheel",this._stopScrolling.bindAsEventListener(this),!1):Event.observe(window,"DOMMouseScroll",this._stopScrolling.bindAsEventListener(this),!1);Event.observe(a,"click",this.deactivate.bindAsEventListener(this),!1);a.onclick=function(){return!1}},_addLoadingWindowMarkup:function(){$("lightwindow_contents").innerHTML+=this.options.skin.loading},_setupWindowElements:function(a){this.element=a;this.element.title=a.getAttribute("title");this.element.author=a.getAttribute("author");this.element.caption=
a.getAttribute("caption");this.element.rel=a.getAttribute("rel");this.element.params=a.getAttribute("params");this.contentToFetch=this.element.href;this.windowType=this._getParameter("lightwindow_type")?this._getParameter("lightwindow_type"):this._fileType(this.contentToFetch)},_clearWindowContents:function(a){$("lightwindow_iframe")&&Element.remove($("lightwindow_iframe"));if($("lightwindow_media_primary")){try{$("lightwindow_media_primary").Stop()}catch(b){}Element.remove($("lightwindow_media_primary"))}if($("lightwindow_media_secondary")){try{$("lightwindow_media_secondary").Stop()}catch(c){}Element.remove($("lightwindow_media_secondary"))}this.activeGallery=
!1;this._handleNavigation(this.activeGallery);if(a){$("lightwindow_contents").innerHTML="";$("lightwindow_contents").setStyle({overflow:"hidden"});if(!this.windowActive)$("lightwindow_data_slide_inner").setStyle({display:"none"}),$("lightwindow_title_bar_title").innerHTML="";$("lightwindow_data_slide").setStyle({height:"auto"})}this.resizeTo.height=null;this.resizeTo.width=null},_setStatus:function(a){(this.animating=a)&&Element.show("lightwindow_loading");/MSIE 6./i.test(navigator.userAgent)||this._fixedWindow(a)},
_fixedWindow:function(a){a?this.windowActive?(this._getScroll(),$("lightwindow").setStyle({position:"absolute",top:parseFloat($("lightwindow").getStyle("top"))+this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))+this.pagePosition.x+"px"})):$("lightwindow").setStyle({position:"absolute"}):this.windowActive?(this._getScroll(),$("lightwindow").setStyle({position:"fixed",top:parseFloat($("lightwindow").getStyle("top"))-this.pagePosition.y+"px",left:parseFloat($("lightwindow").getStyle("left"))-
this.pagePosition.x+"px"})):($("lightwindow_iframe")&&this._browserDimensions(),$("lightwindow").setStyle({position:"fixed",top:parseFloat(this._getParameter("lightwindow_top"))?parseFloat(this._getParameter("lightwindow_top"))+"px":this.dimensions.viewport.height/2+"px",left:parseFloat(this._getParameter("lightwindow_left"))?parseFloat(this._getParameter("lightwindow_left"))+"px":this.dimensions.viewport.width/2+"px"}))},_prepareIE:function(a){if(Prototype.Browser.IE){var a=a?"100%":"auto",b=document.getElementsByTagName("body")[0];
document.getElementsByTagName("html")[0].style.height=b.style.height=a}},_stopScrolling:function(a){if(this.animating)a.preventDefault&&a.preventDefault(),a.returnValue=!1},_getScroll:function(){if(typeof window.pageYOffset=="number")this.pagePosition.x=window.pageXOffset,this.pagePosition.y=window.pageYOffset;else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))this.pagePosition.x=document.body.scrollLeft,this.pagePosition.y=document.body.scrollTop;else if(document.documentElement)this.pagePosition.x=
document.documentElement.scrollLeft,this.pagePosition.y=document.documentElement.scrollTop},_setScroll:function(a,b){document.documentElement.scrollLeft=a;document.documentElement.scrollTop=b},_toggleTroubleElements:function(a,b){for(var c=b?$("lightwindow_contents").getElementsByTagName("select"):document.getElementsByTagName("select"),d=0;d<c.length;d++)c[d].style.visibility=a;if(!b){if(this.options.hideFlash){c=document.getElementsByTagName("object");for(d=0;d!=c.length;d++)c[d].style.visibility=
a;c=document.getElementsByTagName("embed");for(d=0;d!=c.length;d++)c[d].style.visibility=a}c=document.getElementsByTagName("iframe");for(d=0;d!=c.length;d++)c[d].style.visibility=a}},_getPageDimensions:function(){var a,b;window.innerHeight&&window.scrollMaxY?(a=document.body.scrollWidth,b=window.innerHeight+window.scrollMaxY):document.body.scrollHeight>document.body.offsetHeight?(a=document.body.scrollWidth,b=document.body.scrollHeight):(a=document.body.offsetWidth,b=document.body.offsetHeight);var c,
d;if(self.innerHeight)c=self.innerWidth,d=self.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)c=document.documentElement.clientWidth,d=document.documentElement.clientHeight;else if(document.body)c=document.body.clientWidth,d=document.body.clientHeight;this.pageDimensions.height=b<d?d:b;this.pageDimensions.width=a<c?c:a},_displayLightWindow:function(a,b){$("lightwindow_overlay").style.display=$("lightwindow").style.display=$("lightwindow_container").style.display=
a;$("lightwindow_overlay").style.visibility=$("lightwindow").style.visibility=$("lightwindow_container").style.visibility=b},_setupDimensions:function(){var a,b;switch(this.windowType){case "page":a=this.options.dimensions.page.height;b=this.options.dimensions.page.width;break;case "image":a=this.options.dimensions.image.height;b=this.options.dimensions.image.width;break;case "media":a=this.options.dimensions.media.height;b=this.options.dimensions.media.width;break;case "external":a=this.options.dimensions.external.height;
b=this.options.dimensions.external.width;break;case "inline":a=this.options.dimensions.inline.height;b=this.options.dimensions.inline.width;break;default:a=this.options.dimensions.page.height,b=this.options.dimensions.page.width}var c=this._getParameter("lightwindow_top")?parseFloat(this._getParameter("lightwindow_top"))+this.pagePosition.y:this.dimensions.viewport.height/2+this.pagePosition.y,d=this._getParameter("lightwindow_left")?parseFloat(this._getParameter("lightwindow_left"))+this.pagePosition.x:
this.dimensions.viewport.width/2+this.pagePosition.x;$("lightwindow").setStyle({top:c+"px",left:d+"px"});$("lightwindow_container").setStyle({height:a+"px",width:b+"px",left:-(b/2)+"px",top:-(a/2)+"px"});$("lightwindow_contents").setStyle({height:a+"px",width:b+"px"})},_fileType:function(a){if(RegExp("[^.].("+this.options.fileTypes.image.join("|")+")s*$","i").test(a))return"image";if(a.indexOf("#")>-1&&document.domain==this._getDomain(a))return"inline";a.indexOf("?")>-1&&(a=a.substring(0,a.indexOf("?")));
var b="unknown",c=RegExp("[^.].("+this.options.fileTypes.page.join("|")+")s*$","i"),d=RegExp("[^.].("+this.options.fileTypes.media.join("|")+")s*$","i");document.domain!=this._getDomain(a)&&(b="external");d.test(a)&&(b="media");if(b=="external"||b=="media")return b;if(c.test(a)||a.substr(a.length-1,a.length)=="/")b="page";return b},_fileExtension:function(a){a.indexOf("?")>-1&&(a=a.substring(0,a.indexOf("?")));for(var b="",c=a.length-1;c>-1;c--){if(a.charAt(c)==".")return b;b=a.charAt(c)+b}},_monitorKeyboard:function(a){document.onkeydown=
a?this._eventKeypress.bind(this):""},_eventKeypress:function(a){a=a==null?event.keyCode:a.which;switch(a){case 27:this.deactivate();break;case 13:return}if(this.animating)return!1;switch(String.fromCharCode(a).toLowerCase()){case "p":this.navigationObservers.previous&&this.navigateWindow("previous");break;case "n":this.navigationObservers.next&&this.navigateWindow("next")}},_getGalleryInfo:function(a){if(!a)return!1;return a.indexOf("[")>-1?[escape(a.substring(0,a.indexOf("["))),escape(a.substring(a.indexOf("[")+
1,a.indexOf("]")))]:!1},_getDomain:function(a){var b=a.indexOf("//")+2,a=a.substring(b,a.length),b=a.indexOf("/"),a=a.substring(0,b);a.indexOf(":")>-1&&(b=a.indexOf(":"),a=a.substring(0,b));return a},_getParameter:function(a,b){if(!this.element)return!1;if(a=="lightwindow_top"&&this.element.top)return unescape(this.element.top);else if(a=="lightwindow_left"&&this.element.left)return unescape(this.element.left);else if(a=="lightwindow_type"&&this.element.type)return unescape(this.element.type);else if(a==
"lightwindow_show_images"&&this.element.showImages)return unescape(this.element.showImages);else if(a=="lightwindow_height"&&this.element.height)return unescape(this.element.height);else if(a=="lightwindow_width"&&this.element.width)return unescape(this.element.width);else if(a=="lightwindow_loading_animation"&&this.element.loadingAnimation)return unescape(this.element.loadingAnimation);else if(a=="lightwindow_iframe_embed"&&this.element.iframeEmbed)return unescape(this.element.iframeEmbed);else if(a==
"lightwindow_form"&&this.element.form)return unescape(this.element.form);else{if(!b)if(this.element.params)b=this.element.params;else return;for(var c,d=b.split(","),e=a+"=",g=e.length,f=0;f<d.length;f++)if(d[f].substr(0,g)==e){c=d[f].split("=")[1];break}return c?unescape(c):!1}},_browserDimensions:function(){Prototype.Browser.IE?(this.dimensions.viewport.height=document.documentElement.clientHeight,this.dimensions.viewport.width=document.documentElement.clientWidth):(this.dimensions.viewport.height=
window.innerHeight,this.dimensions.viewport.width=document.width||document.body.offsetWidth)},_getScrollerWidth:function(){var a=Element.extend(document.createElement("div"));a.setAttribute("id","lightwindow_scroll_div");a.setStyle({position:"absolute",top:"-10000px",left:"-10000px",width:"100px",height:"100px",overflow:"hidden"});var b=Element.extend(document.createElement("div"));b.setAttribute("id","lightwindow_content_scroll_div");b.setStyle({width:"100%",height:"200px"});a.appendChild(b);document.getElementsByTagName("body")[0].appendChild(a);
b=$("lightwindow_content_scroll_div").offsetWidth;a.style.overflow="auto";a=$("lightwindow_content_scroll_div").offsetWidth;Element.remove($("lightwindow_scroll_div"));this.scrollbarOffset=b-a},_addParamToObject:function(a,b,c,d){var e=document.createElement("param");e.setAttribute("value",b);e.setAttribute("name",a);d&&e.setAttribute("id",d);c.appendChild(e);return c},_outerHTML:function(a){if(Prototype.Browser.IE)return a.outerHTML;else{var a=a.cloneNode(!0),b=document.createElement("div");b.appendChild(a);
return b.innerHTML}},_convertToMarkup:function(a,b){var c=this._outerHTML(a).replace("</"+b+">","");if(Prototype.Browser.IE){for(var d=0;d<a.childNodes.length;d++)c+=this._outerHTML(a.childNodes[d]);c+="</"+b+">"}return c},_appendObject:function(a,b,c){if(Prototype.Browser.IE){if(c.innerHTML+=this._convertToMarkup(a,b),this.options.EOLASFix.indexOf(this._fileType(this.element.href))>-1){a=document.getElementsByTagName("object");for(b=0;b<a.length;b++)a[b].getAttribute("data")&&a[b].removeAttribute("data"),
a[b].outerHTML=a[b].outerHTML,a[b].style.visibility="visible"}}else c.appendChild(a)},_appendIframe:function(a){var b=document.createElement("iframe");b.setAttribute("id","lightwindow_iframe");b.setAttribute("name","lightwindow_iframe");b.setAttribute("src","about:blank");b.setAttribute("height","100%");b.setAttribute("width","100%");b.setAttribute("frameborder","0");b.setAttribute("marginwidth","0");b.setAttribute("marginheight","0");b.setAttribute("scrolling",a);this._appendObject(b,"iframe",$("lightwindow_contents"))},
_writeToIframe:function(a){var b=this.options.skin.iframe,b=b.replace("{body_replace}",a);$("lightwindow_iframe").contentWindow?($("lightwindow_iframe").contentWindow.document.open(),$("lightwindow_iframe").contentWindow.document.write(b),$("lightwindow_iframe").contentWindow.document.close()):($("lightwindow_iframe").contentDocument.open(),$("lightwindow_iframe").contentDocument.write(b),$("lightwindow_iframe").contentDocument.close())},_loadWindow:function(){switch(this.windowType){case "image":var a=
0,b=[];this.checkImage=[];this.resizeTo.height=this.resizeTo.width=0;this.imageCount=this._getParameter("lightwindow_show_images")?parseInt(this._getParameter("lightwindow_show_images")):1;if(gallery=this._getGalleryInfo(this.element.rel)){for(a=0;a<this.galleries[gallery[0]][gallery[1]].length;a++)if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][a].href)>-1)break;this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][a-this.imageCount]?this.galleries[gallery[0]][gallery[1]][a-
this.imageCount]:!1;this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][a+this.imageCount]?this.galleries[gallery[0]][gallery[1]][a+this.imageCount]:!1;this.activeGallery=!0}else this.navigationObservers.previous=!1,this.activeGallery=this.navigationObservers.next=!1;for(var c=a;c<a+this.imageCount;c++){if(gallery&&this.galleries[gallery[0]][gallery[1]][c])this.contentToFetch=this.galleries[gallery[0]][gallery[1]][c].href,this.galleryLocation={current:(c+1)/this.imageCount,total:this.galleries[gallery[0]][gallery[1]].length/
this.imageCount},this.galleries[gallery[0]][gallery[1]][c+this.imageCount]?($("lightwindow_next").setStyle({display:"block"}),$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][c+this.imageCount].title):$("lightwindow_next").setStyle({display:"none"}),this.galleries[gallery[0]][gallery[1]][c-this.imageCount]?($("lightwindow_previous").setStyle({display:"block"}),$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][c-this.imageCount].title):$("lightwindow_previous").setStyle({display:"none"});
b[c]=document.createElement("img");b[c].setAttribute("id","lightwindow_image_"+c);b[c].setAttribute("border","0");b[c].setAttribute("src",this.contentToFetch);$("lightwindow_contents").appendChild(b[c]);this.checkImage[c]=new PeriodicalExecuter(function(a){if(!(typeof $("lightwindow_image_"+a).naturalWidth!="undefined"&&$("lightwindow_image_"+a).naturalWidth==0)){this.checkImage[a].stop();var b=$("lightwindow_image_"+a).getHeight();if(b>this.resizeTo.height)this.resizeTo.height=b;this.resizeTo.width+=
$("lightwindow_image_"+a).getWidth();this.imageCount--;$("lightwindow_image_"+a).setStyle({height:"100%"});this.imageCount==0&&this._processWindow()}}.bind(this,c),1)}break;case "media":a=0;this.resizeTo.height=this.resizeTo.width=0;if(gallery=this._getGalleryInfo(this.element.rel)){for(a=0;a<this.galleries[gallery[0]][gallery[1]].length;a++)if(this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][a].href)>-1)break;this.navigationObservers.previous=this.galleries[gallery[0]][gallery[1]][a-
1]?this.galleries[gallery[0]][gallery[1]][a-1]:!1;this.navigationObservers.next=this.galleries[gallery[0]][gallery[1]][a+1]?this.galleries[gallery[0]][gallery[1]][a+1]:!1;this.activeGallery=!0}else this.navigationObservers.previous=!1,this.activeGallery=this.navigationObservers.next=!1;if(gallery&&this.galleries[gallery[0]][gallery[1]][a])this.contentToFetch=this.galleries[gallery[0]][gallery[1]][a].href,this.galleryLocation={current:a+1,total:this.galleries[gallery[0]][gallery[1]].length},this.galleries[gallery[0]][gallery[1]][a+
1]?($("lightwindow_next").setStyle({display:"block"}),$("lightwindow_next_title").innerHTML=this.galleries[gallery[0]][gallery[1]][a+1].title):$("lightwindow_next").setStyle({display:"none"}),this.galleries[gallery[0]][gallery[1]][a-1]?($("lightwindow_previous").setStyle({display:"block"}),$("lightwindow_previous_title").innerHTML=this.galleries[gallery[0]][gallery[1]][a-1].title):$("lightwindow_previous").setStyle({display:"none"});this._getParameter("lightwindow_iframe_embed")?(this.resizeTo.height=
this.dimensions.viewport.height,this.resizeTo.width=this.dimensions.viewport.width):(this.resizeTo.height=this._getParameter("lightwindow_height"),this.resizeTo.width=this._getParameter("lightwindow_width"));this._processWindow();break;case "external":this._appendIframe("auto");this.resizeTo.height=this.dimensions.viewport.height;this.resizeTo.width=this.dimensions.viewport.width;this._processWindow();break;case "page":new Ajax.Request(this.contentToFetch,{method:"get",parameters:"",onComplete:function(a){$("lightwindow_contents").innerHTML+=
a.responseText;this.resizeTo.height=$("lightwindow_contents").scrollHeight+this.options.contentOffset.height;this.resizeTo.width=$("lightwindow_contents").scrollWidth+this.options.contentOffset.width;this._processWindow()}.bind(this)});break;case "inline":a=this.contentToFetch;a.indexOf("?")>-1&&(a=a.substring(0,a.indexOf("?")));a=a.substring(a.indexOf("#")+1);new Insertion.Top($("lightwindow_contents"),$(a).innerHTML);this.resizeTo.height=$("lightwindow_contents").scrollHeight+this.options.contentOffset.height;
this.resizeTo.width=$("lightwindow_contents").scrollWidth+this.options.contentOffset.width;this._toggleTroubleElements("hidden",!0);this._processWindow();break;default:throw"Page Type could not be determined, please amend this lightwindow URL "+this.contentToFetch;}},_resizeWindowToFit:function(){if(this.resizeTo.height+this.dimensions.cruft.height>this.dimensions.viewport.height){var a=this.resizeTo.height/this.resizeTo.width;this.resizeTo.height=this.dimensions.viewport.height-this.dimensions.cruft.height-
2*this.options.viewportPadding;if(this.windowType=="image"||this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed"))this.resizeTo.width=this.resizeTo.height/a,$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px"})}if(this.resizeTo.width+this.dimensions.cruft.width>this.dimensions.viewport.width&&(a=this.resizeTo.width/this.resizeTo.height,this.resizeTo.width=this.dimensions.viewport.width-2*this.dimensions.cruft.width-2*this.options.viewportPadding,this.windowType==
"image"||this.windowType=="media"&&!this._getParameter("lightwindow_iframe_embed")))this.resizeTo.height=this.resizeTo.width/a,$("lightwindow_data_slide_inner").setStyle({height:this.resizeTo.height+"px"})},_presetWindowSize:function(){if(this._getParameter("lightwindow_height"))this.resizeTo.height=parseFloat(this._getParameter("lightwindow_height"));if(this._getParameter("lightwindow_width"))this.resizeTo.width=parseFloat(this._getParameter("lightwindow_width"))},_processWindow:function(){this.dimensions.dataEffects=
[];this.element.caption&&this.element.caption!="null"||this.element.author&&this.element.author!="null"||this.activeGallery&&this.options.showGalleryCount?(this.element.caption&&this.element.caption!="null"?($("lightwindow_data_caption").innerHTML=this.element.caption,$("lightwindow_data_caption").setStyle({display:"block"})):$("lightwindow_data_caption").setStyle({display:"none"}),this.element.author&&this.element.author!="null"?($("lightwindow_data_author").innerHTML=this.element.author,$("lightwindow_data_author_container").setStyle({display:"block"})):
$("lightwindow_data_author_container").setStyle({display:"none"}),this.activeGallery&&this.options.showGalleryCount?($("lightwindow_data_gallery_current").innerHTML=this.galleryLocation.current,$("lightwindow_data_gallery_total").innerHTML=this.galleryLocation.total,$("lightwindow_data_gallery_container").setStyle({display:"block"})):$("lightwindow_data_gallery_container").setStyle({display:"none"}),$("lightwindow_data_slide_inner").setStyle({width:this.resizeTo.width+"px",height:"auto",visibility:"visible",
display:"block"}),$("lightwindow_data_slide").setStyle({height:$("lightwindow_data_slide").getHeight()+"px",width:"1px",overflow:"hidden",display:"block"})):($("lightwindow_data_slide").setStyle({display:"none",width:"auto"}),$("lightwindow_data_slide_inner").setStyle({display:"none",visibility:"hidden",width:this.resizeTo.width+"px",height:"0px"}));this.element.title!="null"?$("lightwindow_title_bar_title").innerHTML=this.element.title:$("lightwindow_title_bar_title").innerHTML="";var a={height:$("lightwindow_container").getHeight(),
width:$("lightwindow_container").getWidth()};$("lightwindow_container").setStyle({height:"auto",width:$("lightwindow_container").getWidth()+this.options.contentOffset.width-(this.windowActive?this.options.contentOffset.width:0)+"px"});var b={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};this.containerChange={height:a.height-b.height,width:a.width-b.width};this.dimensions.container={height:$("lightwindow_container").getHeight(),width:$("lightwindow_container").getWidth()};
this.dimensions.cruft={height:this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.options.contentOffset.height,width:this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.options.contentOffset.width};this._presetWindowSize();this._resizeWindowToFit();this.windowActive||$("lightwindow_container").setStyle({left:-(this.dimensions.container.width/2)+"px",top:-(this.dimensions.container.height/2)+"px"});$("lightwindow_container").setStyle({height:this.dimensions.container.height+
"px",width:this.dimensions.container.width+"px"});this._displayLightWindow("block","visible");this._animateLightWindow()},_animateLightWindow:function(){this.options.animationHandler?this.options.animationHandler().bind(this):this._defaultAnimationHandler()},_handleNavigation:function(a){this.options.navigationHandler?this.options.navigationHandler().bind(this,a):this._defaultDisplayNavigation(a)},_handleTransition:function(){this.options.transitionHandler?this.options.transitionHandler().bind(this):
this._defaultTransitionHandler()},_handleFinalWindowAnimation:function(a){this.options.finalAnimationHandler?this.options.finalAnimationHandler().bind(this,a):this._defaultfinalWindowAnimationHandler(a)},_handleGalleryAnimation:function(a){this.options.galleryAnimationHandler?this.options.galleryAnimationHandler().bind(this,a):this._defaultGalleryAnimationHandler(a)},_defaultDisplayNavigation:function(a){a?$("lightwindow_navigation").setStyle({display:"block",height:$("lightwindow_contents").getHeight()+
"px",width:"100%",marginTop:this.options.dimensions.titleHeight+"px"}):$("lightwindow_navigation").setStyle({display:"none",height:"auto",width:"auto"})},_defaultAnimationHandler:function(){if(this.element.caption||this.element.author||this.activeGallery&&this.options.showGalleryCount)$("lightwindow_data_slide").setStyle({display:"none",width:"auto"}),this.dimensions.dataEffects.push(new Effect.SlideDown("lightwindow_data_slide",{sync:!0}),new Effect.Appear("lightwindow_data_slide",{sync:!0,from:0,
to:1}));$("lightwindow_title_bar_inner").setStyle({height:"0px",marginTop:this.options.dimensions.titleHeight+"px"});this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:!0,style:{height:this.options.dimensions.titleHeight+"px",marginTop:"0px"}}),new Effect.Appear("lightwindow_title_bar_inner",{sync:!0,from:0,to:1}));this.options.hideGalleryTab||(this._handleGalleryAnimation(!1),$("lightwindow_galleries_tab_container").getHeight()==0&&(this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",
{sync:!0,style:{height:"20px",marginTop:"0px"}})),$("lightwindow_galleries").setStyle({width:"0px"})));var a=!1,b=this.dimensions.container.width-$("lightwindow_contents").getWidth()+this.resizeTo.width+this.options.contentOffset.width;b!=$("lightwindow_container").getWidth()&&new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.width/$("lightwindow_contents").getWidth()),{scaleFrom:100*($("lightwindow_contents").getWidth()/($("lightwindow_contents").getWidth()+this.options.contentOffset.width)),
sync:!0,scaleY:!1,scaleContent:!1}),new Effect.Scale("lightwindow_container",100*(b/this.dimensions.container.width),{sync:!0,scaleY:!1,scaleFromCenter:!0,scaleContent:!1})],{duration:this.duration,delay:0.25,queue:{position:"end",scope:"lightwindowAnimation"}});b=this.dimensions.container.height-$("lightwindow_contents").getHeight()+this.resizeTo.height+this.options.contentOffset.height;b!=$("lightwindow_container").getHeight()&&(new Effect.Parallel([new Effect.Scale("lightwindow_contents",100*(this.resizeTo.height/
$("lightwindow_contents").getHeight()),{scaleFrom:100*($("lightwindow_contents").getHeight()/($("lightwindow_contents").getHeight()+this.options.contentOffset.height)),sync:!0,scaleX:!1,scaleContent:!1}),new Effect.Scale("lightwindow_container",100*(b/this.dimensions.container.height),{sync:!0,scaleX:!1,scaleFromCenter:!0,scaleContent:!1})],{duration:this.duration,afterFinish:function(){this.dimensions.dataEffects.length>0&&(this.options.hideGalleryTab||$("lightwindow_galleries").setStyle({width:this.resizeTo.width+
"px"}),new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}}))}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}}),a=!0);!a&&this.dimensions.dataEffects.length>0&&new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,beforeStart:function(){this.options.hideGalleryTab||$("lightwindow_galleries").setStyle({width:this.resizeTo.width+"px"});(this.containerChange.height!=
0||this.containerChange.width!=0)&&new Effect.MoveBy("lightwindow_container",this.containerChange.height,this.containerChange.width,{transition:Effect.Transitions.sinoidal})}.bind(this),afterFinish:function(){this._finishWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultfinalWindowAnimationHandler:function(){this.windowType=="media"||this._getParameter("lightwindow_loading_animation")?(Element.hide("lightwindow_loading"),this._handleNavigation(this.activeGallery),
this._setStatus(!1)):Effect.Fade("lightwindow_loading",{duration:0.75,delay:1,afterFinish:function(){this.windowType!="image"&&this.windowType!="media"&&this.windowType!="external"&&$("lightwindow_contents").setStyle({overflow:"auto"});this._handleNavigation(this.activeGallery);this._defaultGalleryAnimationHandler();this._setStatus(!1)}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultGalleryAnimationHandler:function(a){if(this.activeGallery)$("lightwindow_galleries").setStyle({display:"block",
marginBottom:$("lightwindow_data_slide").getHeight()+this.options.contentOffset.height/2+"px"}),$("lightwindow_navigation").setStyle({height:$("lightwindow_contents").getHeight()-20+"px"});else return $("lightwindow_galleries").setStyle({display:"none"}),$("lightwindow_galleries_tab_container").setStyle({height:"0px",marginTop:"20px"}),$("lightwindow_galleries_list").setStyle({height:"0px"}),!1;if(a)$("lightwindow_galleries_list").getHeight()==0?(a=$("lightwindow_contents").getHeight()*0.8,$("lightwindow_galleries_tab_span").className=
"down"):(a=0,$("lightwindow_galleries_tab_span").className="up"),new Effect.Morph("lightwindow_galleries_list",{duration:this.duration,transition:Effect.Transitions.sinoidal,style:{height:a+"px"},beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})},queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultTransitionHandler:function(){this.dimensions.dataEffects=[];$("lightwindow_data_slide").getStyle("display")!=
"none"&&this.dimensions.dataEffects.push(new Effect.SlideUp("lightwindow_data_slide",{sync:!0}),new Effect.Fade("lightwindow_data_slide",{sync:!0,from:1,to:0}));if(!this.options.hideGalleryTab&&($("lightwindow_galleries").getHeight()!=0&&!this.options.hideGalleryTab&&this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_tab_container",{sync:!0,style:{height:"0px",marginTop:"20px"}})),$("lightwindow_galleries_list").getHeight()!=0))$("lightwindow_galleries_tab_span").className="up",
this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_galleries_list",{sync:!0,style:{height:"0px"},transition:Effect.Transitions.sinoidal,beforeStart:function(){$("lightwindow_galleries_list").setStyle({overflow:"hidden"})},afterFinish:function(){$("lightwindow_galleries_list").setStyle({overflow:"auto"})}}));this.dimensions.dataEffects.push(new Effect.Morph("lightwindow_title_bar_inner",{sync:!0,style:{height:"0px",marginTop:this.options.dimensions.titleHeight+"px"}}),new Effect.Fade("lightwindow_title_bar_inner",
{sync:!0,from:1,to:0}));new Effect.Parallel(this.dimensions.dataEffects,{duration:this.duration,afterFinish:function(){this._loadWindow()}.bind(this),queue:{position:"end",scope:"lightwindowAnimation"}})},_defaultFormHandler:function(a){var a=Event.element(a).parentNode,b=Form.serialize(this._getParameter("lightwindow_form",a.getAttribute("params")));this.options.formMethod=="post"?new Ajax.Request(a.href,{method:"post",postBody:b,onComplete:this.openWindow.bind(this,a)}):this.options.formMethod==
"get"&&new Ajax.Request(a.href,{method:"get",parameters:b,onComplete:this.openWindow.bind(this,a)})},_finishWindow:function(){if(this.windowType=="external")$("lightwindow_iframe").setAttribute("src",this.element.href),this._handleFinalWindowAnimation(1);else{if(this.windowType=="media"){var a=document.createElement("object");a.setAttribute("classid",this.options.classids[this._fileExtension(this.contentToFetch)]);a.setAttribute("codebase",this.options.codebases[this._fileExtension(this.contentToFetch)]);
a.setAttribute("id","lightwindow_media_primary");a.setAttribute("name","lightwindow_media_primary");a.setAttribute("width",this.resizeTo.width);a.setAttribute("height",this.resizeTo.height);a=this._addParamToObject("movie",this.contentToFetch,a);a=this._addParamToObject("src",this.contentToFetch,a);a=this._addParamToObject("controller","true",a);a=this._addParamToObject("wmode","transparent",a);a=this._addParamToObject("cache","false",a);a=this._addParamToObject("quality","high",a);if(!Prototype.Browser.IE){var b=
document.createElement("object");b.setAttribute("type",this.options.mimeTypes[this._fileExtension(this.contentToFetch)]);b.setAttribute("data",this.contentToFetch);b.setAttribute("id","lightwindow_media_secondary");b.setAttribute("name","lightwindow_media_secondary");b.setAttribute("width",this.resizeTo.width);b.setAttribute("height",this.resizeTo.height);b=this._addParamToObject("controller","true",b);b=this._addParamToObject("wmode","transparent",b);b=this._addParamToObject("cache","false",b);b=
this._addParamToObject("quality","high",b);a.appendChild(b)}this._getParameter("lightwindow_iframe_embed")?(this._appendIframe("no"),this._writeToIframe(this._convertToMarkup(a,"object"))):this._appendObject(a,"object",$("lightwindow_contents"))}this._handleFinalWindowAnimation(0)}this._setupActions()}};Event.observe(window,"load",lightwindowInit,!1);var myLightWindow=null;function lightwindowInit(){myLightWindow=new lightwindow};
