﻿function HideAllForms()
{
	$(".form").hide();
}

function ShowForm(formName)
{
	$("#" + formName).show();
}

var maxCharacters = 750;
var text = "";

$(function(){
	if ($("#radioSubmitResume").attr("checked") == true)
		ShowForm("frmSubmitResume");
	else if ($("#radioBidList").attr("checked") == true)
		ShowForm("frmBidList");
	else if ($("#radioContactUs").attr("checked") == true)
		ShowForm("frmContactUs");
	else if ($("*:contains('You must specify a value for this required field.')").length > 0)
	{
		$("#radioContactUs").attr("checked",true);
		ShowForm("frmContactUs");
	}

	$("#txtNotes textarea").keydown(function(){
		if ($("#txtNotes textarea").val().length > maxCharacters)
		{
			$("#wordLimit").css("color","red");
		}
		else
		{
			text = $("#txtNotes textarea").val();
		}
	}).keyup(function(){
		if ($("#txtNotes textarea").val().length > maxCharacters)
		{
			$("#txtNotes textarea").val(text);
			$("#wordLimit").css("color","red");
		}
		else
		{
			$("#wordLimit").css("color", "");
		}
	}).change(function(){
		if ($("#txtNotes textarea").val().length >= maxCharacters)
		{
			$("#txtNotes textarea").val(text);
			$("#wordLimit").css("color","red");
			
			alert("Please limit your question/comment to " + maxCharacters + " characters.");
		}
	});
});