

	//
	// GLOABL

	$().ready(function() {
	
		// PRIMARY NAV
		$("ul#primary_nav li").hover(function() {
			$(this).addClass("hover").find("ul").stop().slideDown(200,function() { $(this).css("height","auto"); });
		},function() {
			$(this).removeClass("hover").find("ul").stop().slideUp(100,function() { $(this).css("height","auto"); });
		});
		
		// PRINT
		$("a.print").click(function() {
			window.print();
			return false;							
		});
	
	});
	
	
	//
	// FIRM
	
	$().ready(function() {
	
		// EXAMPLES POPUP
		$("div.transform a.view").click(function() {
			$("div.transform div.examples").slideDown(300);
			return false;
		});
		$("div.transform div.examples a").click(function() {
			$("div.transform div.examples").slideUp(100);
			return false;
		});
	
	});
	
	
	//
	// MEET

	var ul_pos = 11;
	var ul_interval=null;
	var selected=null;
	$().ready(function() {
	
		// FIND OPTIONS
		$("a.toggle").click(function() {
			var el=$(this).parent();
			$("div.box:visible").each(function() { close_options($(this).parent()); });
			if($(el).find("div.box").is(":hidden")) {
				$(el).addClass("open");
				$(el).find("div.box").slideDown(300);
			}
			return false;
		});
		
		// ENABLE SCROLLING
		$("div#scroll").each(function() { $(this).jScrollPane({ showArrows:true, scrollbarWidth: 17, arrowSize: 15, dragMaxHeight: 30, dragMinHeight: 30 }); });
		$("div#find_by_name div.box").css("display","none");
		
		// BIO GRID OVERLAY
		$("ul#bio_grid div.overlay").css("opacity","0.7");
		
		// BIO GRID HOVER
		$("ul#bio_grid li").hover(function() {
			show_overlay();
			dehover_all_li();
			hover_li($(this));
		},function() {
			hide_overlay();
			dehover_li($(this));
		});
		
		// FIND BY NAME HOVER
		$("div#find_by_name ul.options li a").hover(function() {
			show_overlay();
			hover_li($("ul#bio_grid li#"+$(this).parent().attr("class")));
		},function() {
			hide_overlay();
			dehover_all_li();
		});
		
		// FIND BY EXPERTISE HOVER
		$("div#find_by_expertise ul.options li a").hover(function() {
			show_overlay();
			hover_expertise($(this).text());
		},function() {
			hide_overlay();
			dehighlight_all_li();
		});

		// FIND BY EXPERTISE CLICK
		$("div#find_by_expertise ul.options li a").click(function() {
			return false;
		});
		
		ul_pos=parseInt($("div#bio div#thumbnails ul").css("left"));
		update_nav_options();
		
		// BIO THUMBNAIL NAV
		$("div#bio a#thumbnails_previous").click(function() {
			return false;
		});
		$("div#bio a#thumbnails_previous").hover(function() {
			clearInterval(ul_interval);
			thumbnails_previous();
			ul_interval=setInterval("thumbnails_previous();",200);
		},function() {
		 	clearInterval(ul_interval);
		});
		$("div#bio a#thumbnails_next").click(function() {
			return false;
		});
		$("div#bio a#thumbnails_next").hover(function() {
			clearInterval(ul_interval);
			thumbnails_next();
			ul_interval=setInterval("thumbnails_next();",200);
		},function() {
		 	clearInterval(ul_interval);
		});
		
	});
	
	// UPDATE NAV OPTIONS
	function update_nav_options() {
		/*if(ul_pos>=11) {
			$("div#bio a#thumbnails_previous").css("display","none");
			$("div#bio a#thumbnails_next").css("display","block");
		} else if(ul_pos<=-365) {
			$("div#bio a#thumbnails_previous").css("display","block");
			$("div#bio a#thumbnails_next").css("display","none");
		} else {
			$("div#bio a#thumbnails_previous").css("display","block");
			$("div#bio a#thumbnails_next").css("display","block");
		}*/
	}
	
	// BIO THUMBNAIL PREVIOUS
	function thumbnails_previous() {
		ul_pos+=47;
		if(ul_pos<11) {
			$("div#bio div#thumbnails ul").stop().animate({left:ul_pos+"px"},400);
		} else {
			$("div#bio div#thumbnails ul").stop().animate({left:"11px"},400);
			ul_pos=11;
		}
		update_nav_options();
	}
	
	// BIO THUMBNAIL NEXT
	function thumbnails_next() {
		ul_pos-=47;
		if(ul_pos>-177) {
			$("div#bio div#thumbnails ul").stop().animate({left:ul_pos+"px"},400);
		} else {
			$("div#bio div#thumbnails ul").stop().animate({left:"-177px"},400);
			ul_pos=-177;
		}
		update_nav_options();
	}
	
	// CLOSE FIND OPTIONS
	function close_options(el) {
		$(el).removeClass("open");
		$(el).find("div.box").slideUp(150);
	}
	
	// BIO GRID LI HOVER
	function hover_li(el) {
		$(el).addClass("hover").find("div.overlay").stop().css({display:"none",zIndex:"0.7"});
		$(el).find("div.popup").css("display","block");
	}
	
	// BIO GRID LI DE-HOVER
	function dehover_li(el) {
		$(el).removeClass("hover");
		$(el).find("div.popup").css("display","none");
	}
	
	// BIO GRID ALL LI DE-HOVER
	function dehover_all_li() {
		$("ul#bio_grid li.hover").each(function() {
			dehover_li($(this));
		});
	}
	
	// BIO GRID HIGHLIGHT LI
	function highlight_li(el) {
		$(el).addClass("highlight").find("div.overlay").stop().css({display:"none",zIndex:"0.7"});
	}
	
	// BIO GRID DE-HIGHLIGHT LI
	function dehighlight_li(el) {
		$(el).removeClass("highlight");
	}
	
	// BIO GRID DE-HIGHLIGHT ALL LI
	function dehighlight_all_li() {
		$("ul#bio_grid li.highlight").each(function() {
			dehighlight_li($(this));
		});
	}
	
	// FIND BY EXPERTISE HOVER
	function hover_expertise(type) {
		var items=get_items(type);
		for ( var i in items ) { highlight_li($("ul#bio_grid li#bio_"+items[i])); } 		
	}
	
	// FIND BY EXPERTISE ITEM ARRAY
	function get_items(type) {
		var items = Array();
		if(type=="Biotechnology") {
			items=biotechnology;	
		} else if(type=="Chemistry") {
			items=chemistry;	
		} else if(type=="Computer Science") {
			items=computer_science;	
		} else if(type=="Electrical") {
			items=electrical;	
		} else if(type=="Material Science") {
			items=material_science;	
		} else if(type=="Mechanical") {
			items=mechanical;	
		}
		return items;
	}
	
	// BIO GRID SHOW OVERLAY
	function show_overlay() {
		$("ul#bio_grid li div.overlay").stop().fadeIn(400,function() { $(this).css("opacity","0.7"); });
	}
	
	// BIO GRID HIDE OVERLAY
	function hide_overlay() {
		$("ul#bio_grid li div.overlay").stop().fadeOut(400,function() { $(this).css("opacity","0.7"); });
	}


	//
	// SERVICES

	$().ready(function() {
					   
		// SERVICES LANDING MENU
		$("div#services ul.menu li").hover(function() {
			$(this).addClass("active");
		},function() {
			$(this).removeClass("active");
		});
		
	});
	
	
	//
	// CONTACT

	$().ready(function() {
					   
		// SELECT BOX
		$("div.select").hover(function() {
			$(this).find("ul").stop().slideDown(200,function() { $(this).css("height","158px"); });
		},function() {
			$(this).find("ul").stop().slideUp(100,function() { $(this).css("height","158px"); });
		});
		$("div#interest li a").click(function() {
			$("div#interest div").text($(this).text());
			$("div#interest li a.active").removeClass("active");
			$(this).addClass("active");
			$("div#interest ul").stop().slideUp(100,function() { $(this).css("height","158px"); });
			return false;
		});
	});
	