$(document).ready(function() {
/*	
		$(".support a").click(function(e) {
       e.preventDefault();
        $(".nav ul li a").removeClass("active");
        $(this).addClass("active");
	  	$('#theme-support').reveal();
   	});

		//$(".support a").trigger("click");
    */
    $("#theme-support-form").submit(function() {
    	var this_form = $("#theme-support-form");
		$.ajax({
			type: 'post',
			data: this_form.serialize(),
			url: 'send_form.php',
			success: function(res) {
				if(res == "true") {
					this_form.fadeOut("fast");
				} else {
					$(".validation").fadeIn("fast");
					this_form.find("span").removeClass("error");
					$.each(res.split(","), function() {
						this_form.find("#"+this).find("span").addClass("error");
					});
				}
			}
		});
    });
	
	$(".items li").hover(function() {
		$(this).find(".info").stop(true, true).fadeIn(300);
	}, function() {
		$(this).find(".info").stop(true, true).fadeOut(300);
	});
	
	//$(".info a").attr("target", "_blank");
	
	$("li.new").append('<span class="new"></span>');
	
	// Default text field values
	$(".text").focus(function(srcc)
  {
      if ($(this).val() == $(this)[0].title)
      {
          $(this).addClass("default_text_active");
          $(this).val("");
      }
  });
  $(".text").blur(function()
  {
      if ($(this).val() == "")
      {
          $(this).removeClass("default_text_active");
          $(this).val($(this)[0].title);
      }
  });
  $(".text").blur();
	
	// Newsletter validation
	$("#newsletter-form").submit(function() {
		if($("#mce-FNAME").val() == "" || $("#mce-FNAME").val() == "Your name...") {
			alert("Please enter a first name!");
			return false;
		} else if($("#mce-EMAIL").val() == "" || $("#mce-EMAIL").val() == "Your email...") {
			alert("Please enter an email address!");
			return false;
		}
	});
	
});
