jQuery(document).ready(function() {
	qs = new Querystring();
  
  //Add Interest edit link to unsub page and unsub confirmation page.
  if(qs.get("cid") != "0" && qs.get("cid") != "")
    jQuery("form#IChangeEmailFormat").after('<p>If you would like to make more changes to your email subscriptions <a href="https://secure3.convio.net/nrdc/admin/ConsInterestsUser">click here</a>.</p>');

  if(qs.contains("op.unsubscribe.confirm"))
    jQuery("div.appArea").append('<p><br/>If you would like to make more changes to your email subscriptions <a href="https://secure3.convio.net/nrdc/admin/ConsInterestsUser">click here</a>.</p>');
  
  //Alter text on Category Unsub page when no category defined
  if(qs.get("cid") == "0" || qs.get("cid") == "" || location.search.length == 0) {
    unsubCatPElement = jQuery("form[name='IUnsubscribeCategory'] p[class='PaddedListHeadings']");
    if(unsubCatPElement.html())
      unsubCatPElement.html('To remove yourself from an NRDC subscription list uncheck the appropriate box below and click "Update my Email Interests"');
    
    jQuery("input#ConsOptInterestOptInControl").parent().children("p").remove();
  }
  
  //Remove unwanted text from category box on unsub page
  unsubCatPElement = jQuery("form#IUnsubscribeCategory p[class='wrapable']");
  if(unsubCatPElement.html())
    unsubCatPElement.html(unsubCatPElement.html().replace(", but continue to send email on other topics",""));
});