(function(e){function n(f,c){var a=e(c);return a.length<2?a:f.parent().find(c)}function t(f,c){var a=this,l=f.add(a),g=f.children(),k=0,m=c.vertical;j||(j=a);if(g.length>1)g=e(c.items,f);e.extend(a,{getConf:function(){return c},getIndex:function(){return k},getSize:function(){return a.getItems().size()},getNaviButtons:function(){return o.add(p)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(b,d){return a.seekTo(k+
b,d)},next:function(b){return a.move(1,b)},prev:function(b){return a.move(-1,b)},begin:function(b){return a.seekTo(0,b)},end:function(b){return a.seekTo(a.getSize()-1,b)},focus:function(){return j=a},addItem:function(b){b=e(b);if(c.circular){e(".cloned:last").before(b);e(".cloned:first").replaceWith(b.clone().addClass(c.clonedClass))}else g.append(b);l.trigger("onAddItem",[b]);return a},seekTo:function(b,d,h){if(c.circular&&b===0&&k==-1&&d!==0)return a;if(!c.circular&&b<0||b>a.getSize()||b<-1)return a;var i=b;if(b.jquery)b=a.getItems().index(b);else i=a.getItems().eq(b);var q=e.Event("onBeforeSeek");if(!h){l.trigger(q,[b,d]);if(q.isDefaultPrevented()||!i.length)return a}i=m?{top:-i.position().top}:{left:-i.position().left};k=b;j=a;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){l.trigger("onSeek",[b])});return a}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(b,d){e.isFunction(c[d])&&e(a).bind(d,c[d]);a[d]=function(h){e(a).bind(d,h);return a}});if(c.circular){var r=a.getItems().slice(-1).clone().prependTo(g),s=a.getItems().eq(1).clone().appendTo(g);r.add(s).addClass(c.clonedClass);a.onBeforeSeek(function(b,d,h){if(!b.isDefaultPrevented())if(d==-1){a.seekTo(r,h,function(){a.end(0)});return b.preventDefault()}else d==a.getSize()&&a.seekTo(s,h,function(){a.begin(0)})});a.seekTo(0,0)}var o=n(f,c.prev).click(function(){a.prev()}),p=n(f,c.next).click(function(){a.next()});!c.circular&&a.getSize()>1&&a.onBeforeSeek(function(b,d){setTimeout(function(){if(!b.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);p.toggleClass(c.disabledClass,d>=a.getSize()-1)}},1)});c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(b,d){if(c.mousewheel){a.move(d<0?1:-1,c.wheelSpeed||50);return false}});c.keyboard&&e(document).bind("keydown.scrollable",function(b){if(!(!c.keyboard||b.altKey||b.ctrlKey||e(b.target).is(":input")))if(!(c.keyboard!="static"&&j!=a)){var d=b.keyCode;if(m&&(d==38||d==40)){a.move(d==38?-1:1);return b.preventDefault()}if(!m&&(d==37||d==39)){a.move(d==37?-1:1);return b.preventDefault()}}});e(a).trigger("onBeforeSeek",[c.initialIndex])}e.tools=e.tools||{version:"1.2.3"};e.tools.scrollable={conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,wheelSpeed:0}};var j;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new t(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);(function(c){var g=c.tools.scrollable;g.autoscroll={conf:{autoplay:true,interval:3E3,autopause:true}};c.fn.autoscroll=function(d){if(typeof d=="number")d={interval:d};var b=c.extend({},g.autoscroll.conf,d),h;this.each(function(){var a=c(this).data("scrollable");if(a)h=a;var e,i,f=true;a.play=function(){if(!e){f=false;e=setInterval(function(){a.next()},b.interval);a.next()}};a.pause=function(){e=clearInterval(e)};a.stop=function(){a.pause();f=true};b.autopause&&a.getRoot().add(a.getNaviButtons()).hover(function(){a.pause();clearInterval(i)},function(){f||(i=setTimeout(a.play,b.interval))});b.autoplay&&setTimeout(a.play,b.interval)});return b.api?h:this}})(jQuery);;(function($){$.fn.swipe=function(options){var defaults={threshold:{x:200,y:60},swipeLeft:function(){alert('swiped left')},swipeRight:function(){alert('swiped right')},preventDefaultEvents:true};var options=$.extend(defaults,options);if(!this)return false;return this.each(function(){var me=$(this)
var originalCoord={x:0,y:0}
var finalCoord={x:0,y:0}
function touchStart(event){console.log('Starting swipe gesture...')
originalCoord.x=event.targetTouches[0].pageX
originalCoord.y=event.targetTouches[0].pageY}
function touchMove(event){if(defaults.preventDefaultEvents)
event.preventDefault();finalCoord.x=event.targetTouches[0].pageX
finalCoord.y=event.targetTouches[0].pageY}
function touchEnd(event){console.log('Ending swipe gesture...')
var changeY=originalCoord.y-finalCoord.y
if(changeY<defaults.threshold.y&&changeY>(defaults.threshold.y*-1)){changeX=originalCoord.x-finalCoord.x
if(changeX>defaults.threshold.x){options.swipeLeft();}
if(changeX<(defaults.threshold.x*-1)){options.swipeRight();}}}
function touchCancel(event){console.log('Canceling swipe gesture...')}
this.addEventListener("touchstart",touchStart,false);this.addEventListener("touchmove",touchMove,false);this.addEventListener("touchend",touchEnd,false);this.addEventListener("touchcancel",touchCancel,false);});};})(jQuery);;(function($){$.fn.fullscreenResizer=function(options){settings=jQuery.extend({width:1024,height:768,mobileAdustment:false,mobileMinWidth:380,mobileContentSelector:'#container',mobileTweakHeight:93,},options);var setWidth=$(this).attr('width');var setHeight=$(this).attr('height');if(setWidth!=''&&setHeight!=''){var ratio=setHeight/setWidth;}else{var ratio=settings.height/settings.width;}
var browserwidth=$(this).parent().width();var browserheight=$(this).parent().height();if(settings.mobileAdustment==true){if(browserwidth<=settings.mobileMinWidth){browserheight=$(settings.mobileContentSelector).height();browserheight=browserheight+settings.mobileTweakHeight;$(this).parent().height(browserheight);}}
if((browserheight/browserwidth)>ratio){$(this).height(browserheight);$(this).width(browserheight/ratio);}else{$(this).width(browserwidth);$(this).height(browserwidth*ratio);}
$(this).css('left',(browserwidth-$(this).width())/2);$(this).css('top',(browserheight-$(this).height())/2);return this;};})(jQuery);$.fn.vAlign=function(options){settings=jQuery.extend({parent:$(window)},options);return this.each(function(i){var ah=$(this).height();var ph=$(settings.parent).height();var mh=(ph-ah)/2;$(this).css('top',mh);});};$.fn.hAlign=function(options){settings=jQuery.extend({parent:$(window)},options);return this.each(function(i){var Hah=$(this).width();var Hph=$(settings.parent).width();var Hmh=(Hph-Hah)/2;$(this).css('left',Hmh);});};;$(function(){var options={mobileAdustment:false};function sizeSettings(){$('#background img').fullscreenResizer(options);$('#container').vAlign().hAlign();}
sizeSettings();$(window).bind("resize",function(){sizeSettings();});function initSlideshow(){var scrollableopt={keyboard:false,circular:true,speed:800,clickable:true,onBeforeSeek:function(event,i){var imagenumber=this.getIndex();if(imagenumber!==-1){$("#imgdetails").hide();}},onSeek:function(event,i){var imagenumber=this.getIndex();var currentContent=$('#slideshow .items div').eq(imagenumber).children("p").html();if(imagenumber!==-1){$("#imgdetails").html(currentContent).fadeIn(500);}}};var autoopt={interval:10000};$('#slideshow').scrollable(scrollableopt).autoscroll(autoopt).click(function(){$(this).data("scrollable").next();});$("#imgdetails").show();}
$("#background img").attr('src','background/randomimg.php').load(function(){$(this).hide();$("#background").css('visibility','visible');$("#background img").hide().css('visibility','visible').fadeIn(2000,function(){$("#header").hide().css('visibility','visible').fadeIn(1000);$("#slideshow").hide().css('visibility','visible').delay(300).fadeIn(1000);$("#info").hide().css('visibility','visible').delay(600).fadeIn(1000,function(){initSlideshow();});$("#footer").hide().css('visibility','visible').delay(900).fadeIn(1000);});});});
