
	
	/* Easing for Cycle */
	$.fn.cycle.transitions.scrollBothWays = function($cont, $slides, opts) {
		$cont.css('overflow','hidden');
		opts.before.push($.fn.cycle.commonReset);
		// custom transition fn (trying to get it to scroll forward and backward)
		opts.fxFn = function(curr, next, opts, cb, fwd) {
			var w = $cont.width();
			opts.cssFirst = { left: 0 };
			opts.animIn	  = { left: 0 };
			if(fwd){
				opts.cssBefore= { left: w, top: 0 };
				opts.animOut  = { left: 0-w };
			}else{
				opts.cssBefore= { left: -w, top: 0 };
				opts.animOut  = { left: w };
			};
			var $l = $(curr), $n = $(next);
			var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animOut = opts.animOut, animIn = opts.animIn;
			$n.css(opts.cssBefore);
			var fn = function() {$n.show();$n.animate(animIn, speedIn, easeIn, cb);};
			$l.animate(animOut, speedOut, easeOut, function() {
				if (opts.cssAfter) $l.css(opts.cssAfter);
				if (!opts.sync) fn();
			});
			if (opts.sync) fn();
		};
	};
	
	/* Tabs */
	function initTabs(){
		$('ul.tabset').each(function(){
			var _btn = $(this).children();
			var _a = _btn.index(_btn.filter('.active:eq(0)'));
			if(_a == -1) _a = 0;
			
			for(var i = 0; i < _btn.length; i++){
				if(_btn.eq(i).find('a').prop('hash').length){
					_btn.eq(i).data('box', $(_btn.eq(i).find('a').prop('hash')));
					_btn.eq(i).data('box').css({display: 'none', opacity: 0});
				}
			}
			//_btn.removeClass('active').eq(_a).addClass('active').data('box').css({display: 'block', opacity: 1});
			_btn.click(function(){
				changeTab(_btn.index(this));
				return false;
			});
			function changeTab(_ind){
				if(_ind != _a){
					_btn.eq(_a).removeClass('active');
					_btn.eq(_ind).addClass('active');
					_btn.eq(_a).data('box').animate({opacity: 0}, 200, function(){
						$(this).css('display', 'none');
						_btn.eq(_ind).data('box').css('display', 'block').animate({opacity: 1}, 200, function(){
							_a = _ind;
						});
					});
				}
			}
		});
	}
	
	/* Videobox */
	function initVideobox(){
		var trigger = $('a[rel="videobox"]');
		var videobox = $('#videobox');
		
		videobox.css({display: 'none', opacity: 0});
		
		trigger.click(function(){			
			videobox.css({display: 'block'}).animate({opacity: 1}, 500, function(){
				var close = $(this).find('.close');
				
				close.bind('click', function(){
					videobox.animate({opacity: 0}, 500, function(){
						$(this).css({display: 'none'});
						close.unbind('click');
					})
				});
			});
		});
	}
	
	/* Document Ready */
	$(document).ready(function(){
		
		$("#home-boxes a").mouseover(function () {
		      $(this).effect("size", { to: {width: 243,height: 166} }, 500);
		});
		
		$("#home-boxes a").mouseout(function () {
		      $(this).effect("size", { to: {width: 183,height: 125} }, 100);
		});
	
		// Form placeholder
		$('input, textarea').placeholder();
		
		// Tabs
		initTabs();
		
		// Videobox
		initVideobox();
		
		//Slider
		
		
		/* show more cases */
		$('.more-cases').click(function(){
			$(this).hide().next().fadeIn(500);
		});
		
		$('#people li').mouseover(function() {
			var index = $("#people li").index(this);
			$('#people li').show('.email').index(index);
		});
		
		
		
	});
	
