$(document).ready(function(){  
	$("a.imgZoom").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow':	true,
		'overlayOpacity': .8
	});
	$("#form_search #search_button").click(function(){
		$("#form_search").submit();
	});
	$("#form_help_wanted #bio").maxlength({
		'feedback':		'#bio_left',
		'hardLimit':	true,
		'useInput':		false,
		'words':		false
	});
	$("#form_help_wanted #why_deliver").maxlength({
		'feedback':		'#why_deliver_left',
		'hardLimit':	true,
		'useInput':		false,
		'words':		false
	});
	$("#form_tell_us_your_story #story").maxlength({
		'feedback':		'#story_left',
		'hardLimit':	true,
		'useInput':		false,
		'words':		false
	});
	$("#form_post #mm_accouncement").maxlength({
		'feedback':		'#mm_accouncement_left',
		'hardLimit':	true,
		'useInput':		false,
		'words':		false
	});
	$("#form_post #cc_accouncement").maxlength({
		'feedback':		'#cc_accouncement_left',
		'hardLimit':	true,
		'useInput':		false,
		'words':		false
	});
	$("#form_post #type").change(function(){
		if($(this).val() == "Community Calendar")
		{
			$("#form_post #milestones_section").hide();
			$("#form_post #community_calendar_section").show();
		} else {
			$("#form_post #milestones_section").show();
			$("#form_post #community_calendar_section").hide();
		}
	});
	$("#form_help_wanted #state").val($("#form_help_wanted #state").attr("rel"));
	$("#form_subscribe #shirt_size").val($("#form_subscribe #shirt_size").attr("rel"));
	$("#form_subscribe #billing_state").val($("#form_subscribe #billing_state").attr("rel"));
	$("#form_subscribe #shipping_state").val($("#form_subscribe #shipping_state").attr("rel"));
	$("#form_subscribe #cc_type").val($("#form_subscribe #cc_type").attr("rel"));
	$("#form_subscribe #cc_exp_month").val($("#form_subscribe #cc_exp_month").attr("rel"));
	$("#form_subscribe #cc_exp_year").val($("#form_subscribe #cc_exp_year").attr("rel"));
	$("#form_post #type").val($("#form_post #type").attr("rel"));
	$("#form_post #announcement_type").val($("#form_post #announcement_type").attr("rel"));
	
	$("#form_checkout #billing_state").val($("#form_checkout #billing_state").attr("rel"));
	
	$("#form_subscribe #same_as_shipping").click(function(e){
		$("#form_subscribe #billing_address1").val($("#form_subscribe #shipping_address1").val());
		$("#form_subscribe #billing_address2").val($("#form_subscribe #shipping_address2").val());
		$("#form_subscribe #billing_city").val($("#form_subscribe #shipping_city").val());
		$("#form_subscribe #billing_state").val($("#form_subscribe #shipping_state").val());
		$("#form_subscribe #billing_zip").val($("#form_subscribe #shipping_zip").val());
		
		e.preventDefault();
		return false;
	});
	
	$(".print_me").click(function(e){
		window.print();
		
		e.preventDefault;
		return false;
	});
});
