function grow(smin, smax, obj) {
	if ($(obj).height() == smin) {
		$(".fluid").animate( { height:smin }, 1000);
		$(".fluid").css("background-color", "#17212D");
		$(".fluid").clearQueue();
		$(obj).animate( { height:smax }, 1000);
		$(obj).css("background-color", "#1B3858");
	}
}

function inp_prep(obj) {
	$(obj).css("color", "black");
	$(obj).val("");
}

function img_rotate() {
	imgNum = $("#index_cop").css("background-image").match(/[123]/);
	if (imgNum < 3)
		imgNum++;
	else
		imgNum = 1;
	$("#index_cop").css("background-image", "url(images/courage_" + imgNum + "_home_pg.jpg)");
	t = setTimeout("img_rotate()",5000);

}

function subscribe_mc() {
//	$.get("http://globalaccessmedia.us1.list-manage.com/subscribe/post", {
	$.get("php/proxy.php5", {
		u: "f74cdbf50f2b9429e22416007",
		id: "cc3a43a303",
		MERGE0: $("#email_fld").val() },
	function(data) {
		$("#mc-success-response").show(1000);
	});
}

function send_email() {
	$("#contact_error").html(""); // Clear error message
	$.get("php/sendemail.php", {
		name: $("#contact_name").val(),
		addr1: $("#contact_address1").val(),
		addr2: $("#contact_address2").val(),
		city: $("#contact_city").val(),
		state: $("#contact_state").val(),
		postal: $("#contact_postal").val(),
		country: $("#contact_country").val(),
		phone: $("#contact_phone").val(),
		email: $("#contact_email").val(),
		msg: $("#contact_message").val(),
		code: $("#contact_code").val(),
		encoded: $("#contact_encoded").val(),
		action: $("#contact_action").val() },
   function(data){
	   $('html, body').animate({
			scrollTop: $("#contact_error").offset().top
		}, 1000);
	   if (data.indexOf("ERROR") != -1)
	   		$("#contact_error").html(data);
		else
			$("#contact_content").html("Thank you, your message was sent.<br />&nbsp;"); 
   });
}

function asCode() {
	var randNum = "";
	for (i = 0; i < 4; i++) {
		randNum = randNum + Math.floor(Math.random()*10);
	}
	randNum = randNum * 2 + 13 - 94;
	$("#contact_code_img").html('<img style="vertical-align:middle" src="php/sendemail.php?action=getCode&code=' + randNum + '" />');
	$("#contact_encoded").val(randNum);
}

$(".fluid").mouseover(function(){
	$(this).animate( { height:150 }, 1000);
	$(this).css("background-color", "#1B3858");
});
$(".fluid").mouseout(function(){
	$(this).animate( { height:45 }, 1000);
	$(this).css("background-color", "#17212D");
});
