/* jQuery Text Shadow Plug-in
 * Created by Martin Hintzmann 2008 martin [a] hintzmann.dk
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 *
 * Version: 0.2
 * Requires: jQuery 1.2+
 * http://plugins.jquery.com/project/textshadow
 *
 */
(function(a){a.fn.textShadow=function(b){if(a.browser.msie){var c=a.browser.version<7;return this.each(function(){var e=a(this),d=e.textShadowParse(this.currentStyle["text-shadow"]);d=a.extend(d,b);e.textShadowRemove();if(!(d.x==0&&d.y==0&&d.radius==0)){e.css("position")=="static"&&e.css({position:"relative"});e.css({zIndex:"0"});c&&e.css({zoom:"1"});var i=document.createElement("span");a(i).addClass("jQueryTextShadow");a(i).html(e.html());a(i).css({padding:this.currentStyle.padding,width:e.width(),
position:"absolute",zIndex:"-1",color:d.color!=null?d.color:e.css("color"),left:-parseInt(d.radius)+parseInt(d.x)+"px",top:-parseInt(d.radius)+parseInt(d.y)+"px"});if(d.radius!=0)d.opacity!=null?a(i).css("filter","progid:DXImageTransform.Microsoft.Blur(pixelradius="+parseInt(d.radius)+", enabled='true', makeShadow='true', ShadowOpacity="+d.opacity+")"):a(i).css("filter","progid:DXImageTransform.Microsoft.Blur(pixelradius="+parseInt(d.radius)+", enabled='true')");e.append(i)}})}};a.fn.textShadowParse=
function(b){b=String(b).replace(/^\s+|\s+$/gi,"").replace(/\s*!\s*important/i,"").replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g,"($1/$2/$3/$4)").replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g,"($1/$2/$3)");var c={x:0,y:0,radius:0,color:null};if(b.length>1||b[0].toLowerCase()!="none"){b=b.replace(/\//g,",");var e;if(b.match(/(\#[0-9a-f]{6}|\#[0-9a-f]{3}|(rgb|hsb)a?\([^\)]*\)|\b[a-z]+\b)/i)&&(e=RegExp.$1)){c.color=e.replace(/^\s+/,"");b=b.replace(c.color,
"")}b=b.replace(/^\s+|\s+$/g,"").split(/\s+/).map(function(d){return(d||"").replace(/^0[a-z]*$/,"")?d:0});switch(b.length){case 1:c.x=c.y=b[0];break;case 2:c.x=b[0];c.y=b[1];break;case 3:c.x=b[0];c.y=b[1];c.radius=b[2]}if(!c.x&&!c.y&&!c.radius||c.color=="transparent"){c.x=c.y=c.radius=0;c.color=null}}return c};a.fn.textShadowRemove=function(){if(a.browser.msie)return this.each(function(){a(this).children("span.jQueryTextShadow").remove()})}})(jQuery);
if(typeof Array.prototype.map=="undefined")Array.prototype.map=function(a){for(var b=Array(this.length),c=0;c<this.length;c++)b[c]=a(this[c]);return b};
(function(a){a.fn.fancyZoom=function(b){function c(f){if(l)return false;l=true;var k=a(a(this).attr("href")),n=b.height,m=window.innerWidth||window.document.documentElement.clientWidth||window.document.body.clientWidth,q=window.innerHeight||window.document.documentElement.clientHeight||window.document.body.clientHeight,o=window.pageYOffset||window.document.documentElement.scrollTop||window.document.body.scrollTop,r={width:m,height:q,x:window.pageXOffset||window.document.documentElement.scrollLeft||
window.document.body.scrollLeft,y:o};m=(b.width||k.width())+60;q=(n||k.height())+60;n=Math.max(r.height/2-q/2+o,0);r=r.width/2-m/2;o=f.pageY;f=f.pageX;g.attr("curTop",o);g.attr("curLeft",f);g.attr("scaleImg",b.scaleImg?"true":"false");a("#zoom").hide().css({position:"absolute",top:o+"px",left:f+"px",width:"1px",height:"1px"});i();g.hide();b.closeOnClick&&a("#zoom").click(e);if(b.scaleImg){p.html(k.html());a("#zoom_content img").css("width","100%")}else p.html("");a("#zoom").animate({top:n+"px",left:r+
"px",opacity:"show",width:m,height:q},500,null,function(){b.scaleImg!=true&&p.html(k.html());s();g.show();l=false});return false}function e(){if(l)return false;l=true;a("#zoom").unbind("click");i();g.attr("scaleImg")!="true"&&p.html("");g.hide();a("#zoom").animate({top:g.attr("curTop")+"px",left:g.attr("curLeft")+"px",opacity:"hide",width:"1px",height:"1px"},500,null,function(){g.attr("scaleImg")=="true"&&p.html("");s();l=false});return false}function d(f){a("#zoom_table td").each(function(){var m=
a(this).css("background-image").replace(/\.(png|gif|none)\"\)$/,"."+f+'")');a(this).css("background-image",m)});var k=g.children("img"),n=k.attr("src").replace(/\.(png|gif|none)$/,"."+f);k.attr("src",n)}function i(){a.browser.msie&&parseFloat(a.browser.version)>=7&&d("gif")}function s(){a.browser.msie&&a.browser.version>=7&&d("png")}var h=(b=b||{})&&b.directory?b.directory:"images",l=false;if(a("#zoom").length==0){var j=a.browser.msie?"gif":"png";h='<div id="zoom" style="display:none;max-width:100%;max-height:100%"> <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> <tbody> <tr> <td class="tl" style="background:url('+
h+"/tl."+j+') 0 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> <td class="tm" style="background:url('+h+"/tm."+j+') 0 0 repeat-x; height:20px; overflow:hidden;" /> <td class="tr" style="background:url('+h+"/tr."+j+') 100% 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> </tr> <tr> <td class="ml" style="background:url('+h+"/ml."+j+') 0 0 repeat-y; width:20px; overflow:hidden;" /> <td class="mm" style="background:#fff; vertical-align:top; padding:10px;"> <div id="zoom_content"> </div> </td> <td class="mr" style="background:url('+
h+"/mr."+j+') 100% 0 repeat-y; width:20px; overflow:hidden;" /> </tr> <tr> <td class="bl" style="background:url('+h+"/bl."+j+') 0 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> <td class="bm" style="background:url('+h+"/bm."+j+') 0 100% repeat-x; height:20px; overflow:hidden;" /> <td class="br" style="background:url('+h+"/br."+j+') 100% 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> </tr> </tbody> </table> <a href="#" title="Close" id="zoom_close" style="position:absolute; top:0; left:0;"> <img src="'+
h+"/closebox."+j+'" alt="Close" style="border:none; margin:0; padding:0;" /> </a> </div>';a("body").append(h);a("html").click(function(f){a(f.target).parents("#zoom:visible").length==0&&e()});a(document).keyup(function(f){f.keyCode==27&&a("#zoom:visible").length>0&&e()});a("#zoom_close").click(e)}a("#zoom");a("#zoom_table");var g=a("#zoom_close"),p=a("#zoom_content");a("td.ml,td.mm,td.mr");this.each(function(){a(a(this).attr("href")).hide();a(this).click(c)});return this}})(jQuery);
var galleryHolder,galleryHeight=0,activeBox=null;function SetGalleryVars(){galleryHolder=$("#galleryHolder");galleryHolder.height($(window).height()-$("#galleryInfo").position().top-$("#galleryInfo").height()-60);galleryHeight=$("#galleryHolder").height();galleryBoxes=galleryHolder.find("div.galleryBox");var a=$("#galleryHolder > div.galleryBox._activeBox");activeBox=a.length!=0?a:null}function SetupGallery(){ResizeGallery();EnableBoxClicks()}
function ResizeGallery(){SetGalleryVars();ArrangeGallery()}function ArrangeGallery(){var a=0;galleryBoxes.each(function(b){if($(this).hasClass("_activeBox"))a=b*100+"px";else{$(this).css("top",b*100+"px").removeClass("_overflowed");activeBox||$(this).css("display","block");b*100+90>=galleryHeight&&$(this).addClass("_overflowed").css("display","none")}});activeBox&&ArrangeListBox();return a}
function OpenBox(a){a.addClass("_activeBox");$(".morebackbutton").click(function(b){CloseBox(b)}).find("a").text("Back");ResizeGallery();DisableBoxClicks();galleryBoxes.each(function(){!$(this).hasClass("_activeBox")&&!$(this).hasClass("_overflowed")&&$(this).fadeOut(250)});activeBox.find(".date").animate({top:"0px"},250);activeBox.find(".initialImage").animate({top:"-80px"},250);a.find(".listBox").length?DisplayList():activeBox.find(".loader").fadeIn(500,function(){$.ajax({type:"POST",url:"misc/_gallery.php",
data:{galleryAction:"loadYear",targetYear:activeBox.attr("_year")},dataType:"html",contentType:"application/x-www-form-urlencoded; charset=utf-8",success:function(b){activeBox.append(b);DisplayList()}})})}
function DisplayList(){activeBox.animate({top:"0px",height:"100%"},250);activeBox.find(".loader").fadeOut(200);ArrangeListBox();activeBox.find(".listBox").fadeIn(250);$(".controls .left",activeBox).click(function(){ShiftListBox(1)});$(".controls .right",activeBox).click(function(){ShiftListBox(-1)})}
function ArrangeListBox(){$(".listBox > .holder",activeBox).css("left","0px");var a=Math.max(Math.floor((galleryHeight-$(".date",activeBox).height()-$(".listBox > .controls",activeBox).height())/90),1),b=$(".listBox > .holder > a",activeBox).length;b=Math.ceil(b/a);$(".listBox > .holder",activeBox).css({top:$(".date",activeBox).height()+5+"px"});$(".listBox > .holder > a",activeBox).each(function(c){var e=c*90;c=Math.floor(c/a);$(this).css({top:e-a*90*c+"px",left:Math.floor(c*128)+"px"})});SetListBoxInfo(b)}
function SetListBoxInfo(a){$(".listBox > .holder",activeBox).length>0&&$(".info > .currentColumn",activeBox).text(Math.ceil(Math.abs($(".listBox > .holder",activeBox).position().left)/128)+1);if(a!=null){$(".info > .totalColumns",activeBox).text(a);$(".controls",activeBox).data("max",(a-1)*-128);a<2?$(".controls",activeBox).css("display","none"):$(".controls",activeBox).css("display","block")}}
function ShiftListBox(a){a=Math.min(Math.max($(".listBox > .holder",activeBox).position().left+128*a,$(".controls",activeBox).data("max")),0);$(".listBox > .holder",activeBox).clearQueue().animate({left:a},250,function(){SetListBoxInfo()})}
function CloseBox(a){a.preventDefault();activeBox.find(".listBox").fadeOut(250);activeBox.find(".date").animate({top:"50px"},250);activeBox.find(".initialImage").animate({top:"0px"},250);activeBox.animate({top:ArrangeGallery(),height:"80px"},250,function(){galleryBoxes.each(function(){!$(this).hasClass("_activeBox")&&!$(this).hasClass("_overflowed")&&$(this).fadeIn(250)});activeBox.removeClass("_activeBox");activeBox=null;EnableBoxClicks()});$(".morebackbutton").unbind("click").find("a").text("More...");
return false}function EnableBoxClicks(){galleryBoxes.each(function(){$(this).click(function(){OpenBox($(this))})})}function DisableBoxClicks(){galleryBoxes.each(function(){$(this).unbind("click")})}function ReloadImage(){}function ApplyShadows(){$(".calendarbox > .header > .label").textShadow({radius:4});$("#galleryInfo h2").textShadow({radius:4});$(".infoContainer .signup").textShadow({radius:4})}
$(document).ready(function(){ApplyShadows();$(window).resize(function(){ApplyShadows()});$("a.fullspan > table.datebox").click(function(){window.location.href=$(this).parent().attr("href")});$(".pictureHolder > a").fancyZoom({directory:"img/fz",closeOnClick:true,scaleImg:true});$(":text, :password").focus(function(){$(this).val()==$(this).attr("default")&&$(this).val("")});$(":text, :password").blur(function(){$(this).val()==""&&$(this).val($(this).attr("default"))});$("select").siblings(".inputBox").css("display",
"none");$("select").change(function(){$(this).val()=="new"?$(this).siblings(".inputBox").css("display","block"):$(this).siblings(".inputBox").css("display","none").find("input:text").val("")});$(".calendarbox div.header").each(function(){$(this).click(function(){$(this).siblings(".eventList").slideToggle()})});$("#galleryBar").size()>0&&$.ajax({type:"POST",url:"misc/_gallery.php",dataType:"html",contentType:"application/x-www-form-urlencoded; charset=utf-8",success:function(a){$("#galleryBar").append(a);$("#galleryInfo h2").textShadow({radius:3});$(window).resize(function(){ResizeGallery()});SetupGallery()}})});
