// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
jQuery.noConflict();

jQuery(document).ready(function() {

	jQuery('#web_subscriber_subscription_change_id_2').click(function() {
		jQuery("#edit_section").hide("slow");
		jQuery("#unsubscribe_section").show("slow");
		jQuery("#web_subscriber_submit").attr("value","Unsubscribe");
	});
	
	jQuery('#web_subscriber_subscription_change_id_1').click(function() {
		jQuery("#edit_section").show("slow");
		jQuery("#unsubscribe_section").hide("slow");
		jQuery("#web_subscriber_submit").attr("value","Update");
	});

	jQuery("#unsubscribe_section").hide();
	jQuery('#web_subscriber_subscription_change_id_1').attr("checked","checked");
	
	jQuery("input.clearonfocus").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});

	jQuery('#show_subscriber_email_address').click(function() {
		jQuery("#subscriber_email_address").slideDown();
		jQuery("input#subscriber_email").focus();
		jQuery('#show_subscriber_email_address').replaceWith(" request a link via email.")
	});
});
