/* custom functions for Francys Subiaul */

(function($) {
$(document).ready(function() {
    
    if($.browser.msie) {

    }
    
    // nav dropdown
    $("#nav li:has(ul)").each(function(){
    	var len = $("ul li", this).length;
    	var h = $("ul", this).height();
    	$("ul", this)
    		.css({
    			display:"none", 
    			height: 0, 
    			opacity: 0,
    			overflow: "hidden"
    		});
    	$(this).hover(function() {
    		$("ul", this).css({ display: "block"  }).stop().animate({
    		 	height: h,
    		 	opacity: 1
    		}, len*50);
    	
    	}, function(){
    		$("#nav li ul").stop().css({ 
    			display: "none",
    			height: 0,
    			opacity: 0 
    		});
    	});
    });
    
    
    // nav div click
    $("#nav li").css({ cursor : "pointer" }).click(function() {
    	var url = $("a", this).attr("href");		
		window.location = url;    	
    });
    
    // home buttons
    $("#home-about").click(function() {
    	window.location = "about/social-cognition-lab.php";
    });
    $("#home-ami").click(function() {
    	window.location = "ami/ape-mind-initiative.php";
    });
	
	$("#home-news").click(function() {
    	window.location = "news/";
    });
    $("#home-publications").click(function() {
    	window.location = "publications/";
    });
	$("#home-links").click(function() {
    	window.location = "links/";
    });
    
    /*
    
    $("body").prepend("<div id='announce' />");
    $("#announce").append("<div><p>The site is currently being updated, the videos and external links might not be active. We apologize for the inconvinience.</p></div>");
    
    */
    
    /* video buttons */
    $(".exp-videos").click(function() {
    	window.location = "http://subiaul.com/videos/experiment-videos.php";
    });
	$(".primate-videos").click(function() {
    	window.location = "http://subiaul.com/videos/primate-videos.php";
    });


}); // end $ function
})(jQuery);