$(function() {
  $("nav#primary li").hover(function() {
    $(this).toggleClass("active");
  });

  $("input[placeholder]").each(function() {
    var $e = $(this);
    $e.data("placeholder", $e.attr("placeholder")).val($e.attr("placeholder")).removeAttr("placeholder");
    $e.focus(function() {
      $e.val(($e.val() === $e.data("placeholder")) ? "" : $e.data("placeholder"));
    }).blur(function() {
      $e.val(($e.val() === "") ? $e.data("placeholder") : $e.val());
    });
  });

  $(".gallery .slides").cycle({
    fx: "fade",
    speed: "800",
    timeout: 4000,
    cleartype: true
  });

  if ($("#news").length) {
    var max   = $("#news .articles").children().length;
    var start = Math.floor(Math.random()*max);
    $news = $("#news");
    $news.find(".articles").cycle({
      start: start,
      fx: "scrollHorz",
      random: 1,
      speed: 500,
      timeout: 6000,
      next: $news.find("a.next"),
      prev: $news.find("a.prev") 
  });
  }

  /*$(".more_content").hide();
  $("#main p.more a, #main a.more").click(function() {
    var $e = $(this),
        exp = /more/i;
    $e.text((exp.test($e.text())) ? $e.text().replace(exp, "Less") : $e.text().replace(/less/i, "More"));
    $e.closest("p").prev(".more_content").slideToggle(300).end().closest("p").next(".more_content").slideToggle(300);
    return false;
  });*/
});

