//JQuery calls
$(document).ready(function(){		  					   
//validate the Service Requst form						   
$("#contact-form").validate({				 
   errorLabelContainer: "#error-box",
   errorElement: "li",
   rules: {
     "ord010_Name of Organization:": "required",
     "ord011_Contact Name:": "required",
	 "ord012_Email Address:": "required",
	 "ord013_Phone Number:": "required",
	 "ord014_Position or Title:": "required",
	 "ord016_How you located our website:": "required",
	 "ord017_Key Words:": "required",
	 "ord019_Person to Thank:": "required",
	 "ord020_Company to Thank:": "required",
	 "ord021_Other Reason:": "required"
   },
   messages: {	
        "ord010_Name of Organization:": "Please enter your Organization Name.",
		"ord011_Contact Name:": "Please enter your Contact Name.",
		"ord012_Email Address:": "Please enter your Email Address.",
		"ord013_Phone Number:": "Please enter your Phone Number.",
		"ord014_Position or Title:": "Please enter your Position or Title",
		"ord016_How you located our website:": "Please tell us how you located us.",
		"ord017_Key Words:": "Please tell us your keywords.",
		"ord019_Person to Thank:": "Please tell us who to thank.",		
		"ord020_Company to Thank:": "Please tell us which company to thank.",
		"ord021_Other Reason:": "Please tell us other reason."		
   }
});
	$("input[name='ord016_How you located our website:']").click(function (){
		$("#extra").fadeIn("slow");
		$("#extra").html("");
		if ($("input[id='reason_0']:checked").val()) {
		$("#extra").html("<div class='row'><p>Please let us know which keywords you used</p><br clear='all'/><label for='ord017_Key Words:'>Keywords:</label><textarea name='ord017_Key Words:' cols='40' rows='5' class='txt-field' id='ord017_Key Words:'></textarea></div></br>");
	} else if ($("input[id='reason_1']:checked").val()) {
		$("#extra").html("<p class='current'>Thank you for your continued support!</p></br>");
		$("<input type='hidden' name='ord018_Is Past or Current Customer:' value='Yes'>").appendTo("#contact-form");
	} else if ($("input[id='reason_2']:checked").val()) {
		$("#extra").html("<div class='row'><p>Please let us know who we should thank for the recommendation</p><br clear='all'/><label for='ord019_Person to Thank:'>Name:</label><input name='ord019_Person to Thank:' type='text' class='field' id='ord019_thankName' /><br clear='all'/><label for='ord020_Company to Thank:'>Company:</label><input name='ord020_Company to Thank:' type='text' class='field' id='ord020_thankCompany' /></div></br>");
	} else if ($("input[id='reason_3']:checked").val()) {
		$("#extra").html("<div class='row'><label for='ord021_Other Reason:'>Reason:</label><textarea name='ord021_Other Reason:' cols='40' rows='5' class='txt-field' id='ord021_reason'></textarea></div></br>");
	}
	});
});