/*
* Smoothbox by Boris Popoff (http://gueschla.com)
*
* Based on Cody Lindley's Thickbox, MIT License
*
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
window.addEvent('domready',SB_init);SB_WIDTH=0;SB_HEIGHT=0;var SB_doneOnce=0;function SB_init(){$$("a.smoothbox").each(function(el){el.onclick=SB_bind});}
function SB_bind(event){var event=new Event(event);event.preventDefault();this.blur();var caption=this.title||this.name||"";var group=this.rel||false;SB_show(caption,this.href,group);this.onclick=SB_bind;return false;}
function SB_show(caption,url,rel){if(!$("SB_overlay"))
{new Element('iframe').setProperty('id','SB_HideSelect').injectInside(document.body);new Element('div').setProperty('id','SB_overlay').injectInside(document.body);SB_overlaySize();new Element('div').setProperty('id','SB_load').injectInside(document.body);$('SB_load').innerHTML="
";SB_load_position();new PayLoomFx.Style('SB_overlay','opacity',{duration:400,transition:PayLoomFx.Transitions.sineInOut}).start(0,0.6);}
if(!$("SB_load"))
{new Element('div').setProperty('id','SB_load').injectInside(document.body);$('SB_load').innerHTML="";SB_load_position();}
if(!$("SB_window"))
{new Element('div').setProperty('id','SB_window').injectInside(document.body);}
$("SB_overlay").onclick=SB_remove;window.onscroll=SB_positionEffect;var baseURL=url.match(/(.+)?/)[1]||url;var imageURL=/\.(jpe?g|png|gif|bmp)/gi;if(baseURL.match(imageURL)){var dummy={caption:"",url:"",html:""};var prev=dummy,next=dummy,imageCount="";if(rel){function getInfo(image,id,label){return{caption:image.title,url:image.href,html:"ΚΚ"+label+""}}
var imageGroup=[];$$("a.smoothbox").each(function(el){if(el.rel==rel){imageGroup[imageGroup.length]=el;}})
var foundSelf=false;for(var i=0;i");break;}else{prev=getInfo(image,"prev","< Prev");}}}}
imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var x=window.getWidth()-150;var y=window.getHeight()-150;var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;}}
SB_WIDTH=imageWidth+30;SB_HEIGHT=imageHeight+60;$("SB_window").innerHTML+=""+""+caption+"
"+imageCount+prev.html+next.html+"
";$("SB_closeWindowButton").onclick=SB_remove;function buildClickHandler(image){return function(){$("SB_window").remove();new Element('div').setProperty('id','SB_window').injectInside(document.body);SB_show(image.caption,image.url,rel);return false;};}
var goPrev=buildClickHandler(prev);var goNext=buildClickHandler(next);if($('SB_prev')){$("SB_prev").onclick=goPrev;}
if($('SB_next')){$("SB_next").onclick=goNext;}
document.onkeydown=function(event){var event=new Event(event);switch(event.code){case 27:SB_remove();break;case 190:if($('SB_next')){document.onkeydown=null;goNext();}
break;case 188:if($('SB_prev')){document.onkeydown=null;goPrev();}
break;}}
$("SB_ImageOff").onclick=SB_remove;SB_position();SB_showWindow();}
imgPreloader.src=url;}else{var queryString=url.match(/\?(.+)/)[1];var params=SB_parseQuery(queryString);SB_WIDTH=(params['width']*1)+30;SB_HEIGHT=(params['height']*1)+40;var ajaxContentW=SB_WIDTH-30,ajaxContentH=SB_HEIGHT-45;if(url.indexOf('SB_iframe')!=-1){urlNoQuery=url.split('SB_');$("SB_window").innerHTML+="";}else{$("SB_window").innerHTML+="";}
$("SB_closeWindowButton").onclick=SB_remove;if(url.indexOf('SB_inline')!=-1){$("SB_ajaxContent").innerHTML=($(params['inlineId']).innerHTML);SB_position();SB_showWindow();}else if(url.indexOf('SB_iframe')!=-1){SB_position();if(frames['SB_iframeContent']==undefined){$(document).keyup(function(e){var key=e.keyCode;if(key==27){SB_remove()}});SB_showWindow();}}else{var handlerFunc=function(){SB_position();SB_showWindow();};var myRequest=new Ajax(url,{method:'get',update:$("SB_ajaxContent"),onComplete:handlerFunc}).request();}}
window.onresize=function(){SB_position();SB_load_position();SB_overlaySize();}
document.onkeyup=function(event){var event=new Event(event);if(event.code==27){SB_remove();}}}
function SB_showWindow(){if(SB_doneOnce==0){SB_doneOnce=1;var myFX=new PayLoomFx.Style('SB_window','opacity',{duration:250,transition:PayLoomFx.Transitions.sineInOut,onComplete:function(){if($('SB_load')){$('SB_load').remove();}}}).start(0,1);}else{$('SB_window').setStyle('opacity',1);if($('SB_load')){$('SB_load').remove();}}}
function SB_remove(){$("SB_overlay").onclick=null;document.onkeyup=null;document.onkeydown=null;if($('SB_imageOff'))$("SB_imageOff").onclick=null;if($('SB_closeWindowButton'))$("SB_closeWindowButton").onclick=null;if($('SB_prev')){$("SB_prev").onclick=null;}
if($('SB_next')){$("SB_next").onclick=null;}
new PayLoomFx.Style('SB_window','opacity',{duration:250,transition:PayLoomFx.Transitions.sineInOut,onComplete:function(){$('SB_window').remove();}}).start(1,0);new PayLoomFx.Style('SB_overlay','opacity',{duration:400,transition:PayLoomFx.Transitions.sineInOut,onComplete:function(){$('SB_overlay').remove();}}).start(0.6,0);window.onscroll=null;window.onresize=null;$('SB_HideSelect').remove();SB_init();SB_doneOnce=0;return false;}
function SB_position(){$("SB_window").setStyles({width:SB_WIDTH+'px',left:(window.getScrollLeft()+(window.getWidth()-SB_WIDTH)/2)+'px',top:(window.getScrollTop()+(window.getHeight()-SB_HEIGHT)/2)+'px'});}
function SB_positionEffect(){new PayLoomFx.Styles('SB_window',{duration:75,transition:PayLoomFx.Transitions.sineInOut}).start({'left':(window.getScrollLeft()+(window.getWidth()-SB_WIDTH)/2)+'px','top':(window.getScrollTop()+(window.getHeight()-SB_HEIGHT)/2)+'px'});}
function SB_overlaySize(){$("SB_overlay").setStyles({"height":'0px',"width":'0px'});$("SB_HideSelect").setStyles({"height":'0px',"width":'0px'});$("SB_overlay").setStyles({"height":window.getScrollHeight()+'px',"width":window.getScrollWidth()+'px'});$("SB_HideSelect").setStyles({"height":window.getScrollHeight()+'px',"width":window.getScrollWidth()+'px'});}
function SB_load_position(){if($("SB_load")){$("SB_load").setStyles({left:(window.getScrollLeft()+(window.getWidth()-56)/2)+'px',top:(window.getScrollTop()+((window.getHeight()-20)/2))+'px',display:"block"});}}
function SB_parseQuery(query){if(!query)
return{};var params={};var pairs=query.split(/[;&]/);for(var i=0;i