/*
 * Panel Slider
 *
 * Copyright © 2009 Leonard Chan
 * All rights reserved.
*/
$(document).ready(function(){
	$(".btn-slide").click(function(){
	
		$("#panel").slideToggle("slow");	
		$(this).toggleClass("active"); return false;
	
	});
});

/*
 * Banner Slider
 *
 * Copyright © 2009 Leonard Chan
 * All rights reserved.
*/

		var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			clearInterval(theInt);
			
			if( typeof cur != 'undefined' )
				curclicked = cur;
			
			$crosslink.removeClass("active-thumb");
			$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
			
			theInt = setInterval(function(){
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
				curclicked++;
				if( 6 == curclicked )
					curclicked = 0;
				
			}, 8000); /* 5s */
		};
		
		$(function(){
			
			$("#main-photo-slider").codaSlider();
			
			$navthumb = $(".nav-thumb");
			$crosslink = $(".cross-link");
			
			$navthumb
			.click(function() {
				var $this = $(this);
				theInterval($this.parent().attr('href').slice(1) - 1);
				return false;
			});
			
			theInterval();
		});

/*
 * Fancybox video
 *
 * Copyright © 2009 Jennifer Pan
 * All rights reserved.
*/
$(function(){
	$("a.researchvideo").click(function() {
   $.fancybox({
  'padding' : 0,
  'autoScale' : false,
   'transitionIn' : 'none',
   'transitionOut' : 'none',
   'title' : this.title,
   'width' : 640,
   'height' : 385,
   'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
   'type' : 'swf',
   'swf' : {
   'wmode' : 'transparent',
   'allowfullscreen' : 'true'
   }
 });

return false;  
});
	

		
		$("a.video").fancybox({ 
	 	'width': 425,
         'height': 344,
         'hideOnContentClick': false,
         'callbackOnClose': function() {
         $("#fancy_content").empty();
         }
	 });
	 
	 
	 
});		

