$(document).ready(function(){
    $("#submit").click(function(){
		var type = $("#type").val();
		if(type == "") {
			$("#error_relay").html("Please Select a Category").slideDown("slow");
			return false;
		}
		if(type == 1){
			var com = $("#comp").val();
			if(com == ""){$("#error_relay").html("All Fields are Required").slideDown("slow");
				return false;}
		}
		if(type == 2){
			var com = $("#comp").val();
			if(com == ""){$("#error_relay").html("All Fields are Required").slideDown("slow");
				return false;}
		}
		if(type == 3){
			var url = $("#uri").val();
			if(url == ""){$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;}
			var cat = $("#servicecat").val();
			if(cat == ""){$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;}
		}

		var nam = $("#name").val();
		if(nam == ""){
			$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;
		}
		var pho = $("#telephone").val();
		if(pho == "") {
			$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;
		}
		var ema = $("#email").val();
		if(ema == "") {
			$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;
		}
		var mes = $("#message").val();
		if(mes == "") {
			$("#error_relay").html("All Fields are Required").slideDown("slow");
			return false;
		}
		else{
			$("#error_relay").css("display","none");
			$("#submit_load").slideDown();

			var url = "formy.php";

			  $.ajax({
				 type: "POST",
				 url: url,
				 data: $("#contUs").serialize(),
				 success: function(data)
				 {
				     $("#submit_load").html("Your message has been successfully sent. We'll be in touch soon.").delay(800).fadeIn(400);
				 }
			       });
    				return false;
		}
    });
  });
