//Main nav
function sidebarMenu() {
  $('#nav ul.active').show();
  function menuItemMove() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
      }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
          $('#nav ul:visible').slideUp('normal');
          checkElement.slideDown('normal');
      }
      $('#left').mouseleave(function() {
          $('#nav ul.regular_nav').slideUp('normal');
          $('#nav ul.active').slideDown('normal');
      });
  }
  var config = {
      over: menuItemMove,
      timeout:300,
      out: menuItemMove
  }
  $('#nav li a').hoverIntent(config);
}
function initMenu() {
  $('#nav ul').hide();
  $('#nav ul.active').show();
  $('#nav li a').mouseover(function() {
    var checkElement = $(this).next();
    if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
    }
    if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
      $('#nav ul:visible').slideUp('normal');
      checkElement.slideDown('normal');
    }
  });
};
//Recent Projects menu
function recent() {
  $('.recentbutton').mouseenter(function() {
    $('#recent #projects').slideDown('normal');
    return false;
  });
  $('#recent #projects').mouseleave(function() {
    $('#recent #projects').slideUp('normal');
    return false;
  });
};
//Recent Projects menu -HOMEPAGE
function recenthome() {
  $('#recent-home #projects').mouseleave(function() {
      if($('#recent-home #projects-blank').css('height') == '0px'){
          $('#recent-home #projects-blank').animate({height:"180px"});
          return false;
      }
  });
  $('#recent-home-link .recentbutton').mouseenter(function() {
      if($('#recent-home #projects-blank').css('height') == '180px'){
          $('#recent-home #projects-blank').animate({height:"0px"});
          return false;
      }
  });
};

function projects() { 
  //$('#projects').load('/experience/projects.php', {'do':'jax-recent_projects'}); 
};

/* function to make training blurbs
 * fully clickable.
 * NOT YET CALLED */
function blurbClick() {
    $(".blurb").click(function(){
		var path = $(this).find('a.learn_more').attr('href');
		if(path) {
			if(path.indexOf("http://") >= 0) {
				window.open(path);
			}
			else {
				window.location = path;
			}
		}
		return false;
	});
}

$(document).ready(function() {sidebarMenu();/*initMenu();*/recent();projects();recenthome();});

