// jCarousel Lite 1.0.1 - http://www.gmarwaha.com/jquery/jcarousellite/

(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

/* ====== END ======= */




/* jQuery Captify Plugin
* Copyright (C) 2008 Brian Reavis
* Licenced under the MIT license
* $Date: 2008-2-27 [Fri, 27 Feb 2009] $
*/
jQuery.fn.extend({captify:function(a){var a=$.extend({speedOver:"fast",speedOut:"normal",hideDelay:500,animation:"slide",prefix:"",opacity:"0.35",className:"caption-bottom",position:"bottom",spanWidth:"100%"},a);$(this).each(function(){var b=this;$(this).load(function(){$this=b;if(this.hasInit){return false}this.hasInit=true;var d=false;var m=false;var g=$("#"+$(this).attr("rel"));var f=!g.length?$(this).attr("alt"):g.html();g.remove();var h=this.parent&&this.parent.tagName=="a"?this.parent:$(this);var c=h.wrap("<div></div>").parent();c.css({overflow:"hidden",padding:0,fontSize:0.1});c.addClass("caption-wrapper");c.width($(this).width());c.height($(this).height());$.map(["top","right","bottom","left"],function(p){c.css("margin-"+p,$(b).css("margin-"+p));$.map(["style","width","color"],function(q){var r="border-"+p+"-"+q;c.css(r,$(b).css(r))})});$(b).css({border:"0 none"});var o=$("div:last",c.append("<div></div>")).addClass(a.className);var l=$("div:last",c.append("<div></div>")).addClass(a.className).append(a.prefix).append(f);$("*",c).css({margin:0}).show();var j=jQuery.browser.msie?"static":"relative";o.css({zIndex:1,position:j,opacity:a.animation=="fade"?0:a.opacity,width:a.spanWidth});if(a.position=="bottom"){var k=parseInt(o.css("border-top-width").replace("px",""))+parseInt(l.css("padding-top").replace("px",""))-1;l.css("paddingTop",k)}l.css({position:j,zIndex:2,background:"none",border:"0 none",opacity:a.animation=="fade"?0:1,width:a.spanWidth});o.width(l.outerWidth());o.height(l.height());var n=(a.position=="bottom"&&jQuery.browser.msie)?-4:0;var i=(a.position=="top")?{hide:-$(b).height()-o.outerHeight()-1,show:-$(b).height()}:{hide:0,show:-o.outerHeight()+n};l.css("marginTop",-o.outerHeight());o.css("marginTop",i[a.animation=="fade"||a.animation=="always-on"?"show":"hide"]);var e=function(){if(!d&&!m){var p=a.animation=="fade"?{opacity:0}:{marginTop:i.hide};o.animate(p,a.speedOut);if(a.animation=="fade"){l.animate({opacity:0},a.speedOver)}}};if(a.animation!="always-on"){$(this).hover(function(){m=true;if(!d){var p=a.animation=="fade"?{opacity:a.opacity}:{marginTop:i.show};o.animate(p,a.speedOver);if(a.animation=="fade"){l.animate({opacity:1},a.speedOver/2)}}},function(){m=false;window.setTimeout(e,a.hideDelay)});$("div",c).hover(function(){d=true},function(){d=false;window.setTimeout(e,a.hideDelay)})}});if(this.complete||this.naturalWidth>0){$(b).trigger("load")}})}});

/* ====== END ======= */





// bigTarget.js - A jQuery Plugin for click expanding area
// Version 1.0.1
// Written by Leevi Graham - Technical Director - Newism Web Design & Development
// http://newism.com.au
// Notes: Tooltip code from fitted.js - http://www.trovster.com/lab/plugins/fitted/
/*
(function($){$.fn.bigTarget=function(options){debug(this);var opts=$.extend({},$.fn.bigTarget.defaults,options);return this.each(function(){var $a=$(this);var href=$a.attr("href");var title=$a.attr("title");var o=$.meta?$.extend({},opts,$a.data()):opts;$a.parents(o.clickZone).hover(function(){$h=$(this);$h.addClass(o.hoverClass);if(typeof o.title!="undefined"&&o.title===true&&title!=""){$h.attr("title",title)}},function(){$h.removeClass(o.hoverClass);if(typeof o.title!="undefined"&&o.title===true&&title!=""){$h.removeAttr("title")}}).click(function(){if(getSelectedText()==""){if($a.is("[rel*=external]")){window.open(href);return false}else{window.location=href}}})})};function debug($obj){if(window.console&&window.console.log){window.console.log("bigTarget selection count: "+$obj.size())}}function getSelectedText(){if(window.getSelection){return window.getSelection().toString()}else{if(document.getSelection){return document.getSelection()}else{if(document.selection){return document.selection.createRange().text}}}}$.fn.bigTarget.defaults={hoverClass:"hover",clickZone:"li:eq(0)",title:true}})(jQuery);

/* ====== END ======= */



/*
 * jQuery Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * written by Alen Grakalic (http://cssglobe.com)
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 */
 this.tooltip=function(){xOffset=-10;yOffset=12;$("a.tooltip").hover(function(e){this.t=this.title;this.title="";$("body").append("<p id='tooltip'>"+this.t+"</p>");$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast")},function(){this.title=this.t;$("#tooltip").remove()});$("a.tooltip, #sidebar h2 a").mousemove(function(e){$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px")})};$(document).ready(function(){tooltip()});

/* ====== END ======= */





/* Copyright (c) 2008 Brian Beck (exogen@gmail.com)
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 * Version: 1.0
 *
 * Requires:
 *   jQuery 1.2+
 *   Dimensions (http://plugins.jquery.com/project/dimensions)
 */

(function($){$.extend({ahover:{version:1,defaults:{toggleSpeed:75,toggleEffect:"both",hoverEffect:null,moveSpeed:250,easing:"swing",className:"ahover"},effects:{width:{width:0},height:{height:0},both:{width:0,height:0}}}});$.fn.extend({ahover:function(options){var options=$.extend({},$.ahover.defaults,options);var effect=((typeof options.toggleEffect=="string")?$.ahover.effects[options.toggleEffect]:options.toggleEffect);var parent=this.offsetParent();return this.hover(function(e){var over=$(this);var overSize={width:over.outerWidth(),height:over.outerHeight()};var overOffset=over.offset();var parentOffset=parent.offset();var under=$("div."+options.className,parent).stop();var created=(under.length==0);if(created){under=$("<div>&nbsp;</div>").addClass(options.className).appendTo(parent).css(overSize)}var underOffset={left:overOffset.left-parentOffset.left-(under.outerWidth()-under.width())/2,top:overOffset.top-parentOffset.top-(under.outerHeight()-under.height())/2};if(created){under.css(underOffset).css(effect).animate(overSize,{queue:false,duration:options.toggleSpeed,easing:options.easing})}else{var underCSS=$.extend({},overSize,underOffset);under.animate(underCSS,{queue:false,duration:options.moveSpeed,easing:options.easing})}if($.isFunction(options.hoverEffect)){under.queue(options.hoverEffect)}},function(e){$("div."+options.className,parent).animate(effect,{queue:false,duration:options.toggleSpeed,easing:options.easing,complete:function(){$(this).remove()}})})}})})(jQuery);

jQuery(function($) {
$('ul#mainnav li').ahover({toggleEffect: 'width'});
//$('ul#mainnav li.current').unbind('mouseover').unbind('mouseout');
});
/* ====== END ======= */



// JavaScript Animated Scrolling w/jQuery 1.2 thx Karl
// http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
$(document).ready(function(){
$('#maincontent a.scroller, a#linkTop').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target
|| $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body')
.animate({scrollTop: targetOffset}, 700);
return false;}}
});
});

/* ====== END ======= */



// JavaScript TRIGGERS
$(document).ready(function() {
$('#maincontent a.fancybox, #mini-gallery ol a').fancybox();
$('a.iframe').fancybox({ 'hideOnContentClick': false, 'frameWidth': 610, 'frameHeight': 540/*, 'padding': 4*/ });
$('#teaser').jCarouselLite({ btnNext:'#nextBtn', btnPrev:'#prevBtn', visible:1, auto:7000, speed:500 });
$('div.carouselWrapper').jCarouselLite({ btnNext:'#bv_nextBtn', btnPrev:'#bv_prevBtn', visible:1, auto:5000, speed:1500 });
//$('ul.bigTarget h3 a').bigTarget({hoverClass: 'over'});
$('img.captify').captify({
				// all of these options are... optional
				// ---
				// speed of the mouseover effect
				speedOver: 'fast',
				// speed of the mouseout effect
				speedOut: 'normal',
				// how long to delay the hiding of the caption after mouseout (ms)
				hideDelay: 500,	
				// 'fade', 'slide', 'always-on'
				animation: 'slide',		
				// text/html to be placed at the beginning of every caption
				prefix: '',		
				// opacity of the caption on mouse over
				opacity: '0.7',					
				// the name of the CSS class to apply to the caption box
				className: 'caption-bottom',	
				// position of the caption (top or bottom)
				position: 'bottom',
				// caption span % of the image
				spanWidth: '100%'
});
});
