function revertAddLoading() {
  document.getElementsByClassName('submit_buttons').each(function(elm,i) { elm.show(); });
  document.getElementsByClassName('adding_progress').each(function(elm,i) { elm.hide(); });
}

function emptyField(elm, text) {
  if (elm.value == text) { 
  elm.oldValue = text;
  elm.value = '';
  }
}

function revealLogin(element1, element2) {
  element1 = $(element1);
  element2 = $(element2);
  
  if (element2.style.display == "none") { 
    element2.show();
    element1.hide();
  }
}

function switchTab(itemType) {
  if (endEdit()) {
    $$("div#source-boxes div.source-box").invoke('hide');
    if ($(itemType + '-box')) {
      autoMode(itemType);
      $(itemType + '-box').show();
    } else {
      $('other-box').show();
    }
  }
  return false;
}

function autoMode(itemType) {
  if ($(itemType + '_auto_search')) {
    $(itemType + '_auto_search').show();
    $(itemType + '_auto_search').up().select(".go-auto").invoke('hide');
    $(itemType + '_auto_search').up().select(".go-manual").invoke('show');
  }
  if ($(itemType + '_fields')) {
    $(itemType + '_fields').hide();
  }
  $('welcome').hide();
  if ($('invite_form')) {
    $('invite_form').show();
  }
}

function endEdit() {
  if ($("edit-citation-id").present()) {
    if (confirm("Any edits you have made to your citation will be canceled if you navigate away. Do you wish to continue?")) {
        $$("input.submit_buttons").each(function(elm) {
          elm.value = "Add to My Bibliography";
        });
        $$(".citation_being_edited").each(function(elm) {
          elm.removeClassName('citation_being_edited');
        });

        if ($('edit-citation-type').present()) {
          clearForm($F("edit-citation-type"));
        }

        $("edit-citation-type").clear();
        $("edit-citation-id").clear();
        $$("input.delete_item").each(function(elm) {
          elm.clear();
        });
    } else { 
      return false; 
    }
  }
  return true;
}

function clearForm(item_type) {
  $$("div#" + item_type + '_fields input[type="text"]').each(function(elm) {
    elm.clear();
    elm.removeClassName('invalid');
  });

  $$("div#" + item_type + "_fields select").each(function(elm) {
    elm.removeClassName('invalid');
  });

  $$("div#" + item_type + "_fields option").each(function(elm) {
    elm.selected = false;
  });

  $$("div#" + item_type + "_fields textarea").each(function(elm) {
    elm.innerHTML = '';
  });

  if ($(item_type + '-author-names')) {
    $$('#' + item_type + '-author-names table.authors').each(function(elm, i) {
      if (i > 0) {
        elm.remove();
      }
    });
  }
  hideAnnotation(item_type);
}

function handleSearch(item_type) {
  $('welcome').hide();
  
  if ($('invite_form')) {
    $('invite_form').hide();
  }
  
  if ($('ads')) {
    $('ads').hide();
  }
  
  $(item_type + '_fields').hide();
  results_div = $(item_type + '_search_results');
  results_items_div = $(item_type + '_search_results_items');
  search_field = $(item_type + '_search_field');
  hide_search = $(item_type + '_hide_search');
  return_search_results = $(item_type + '_return_search_results');
  
  return_search_results.hide();
  
  new Effect.Appear(results_div);
  showLoadingMessage(item_type,results_div);
  controller_name = item_type;
  
  if (item_type == 'magazine' || item_type == 'newspaper' || item_type == 'journal') {
    controller_name += '_article';
  }
  
  if(search_field.value == "" 
     || search_field.value == "Find a book by title, author, or ISBN..."
     || search_field.value == "Find a magazine article by title..." 
     || search_field.value == "Find a newspaper article by title..."
     || search_field.value == "Find a scholarly journal article by title..."
     || search_field.value == "Find a film by title, director, or actor...") {
    /* the size of this hack is tantamount to world hunger - alvin*/
    
    new Ajax.Updater(results_items_div, '/' + controller_name + '/search', { 
      asynchronous:true, evalScripts:true, onComplete: function(request){
      results_items_div.show();
      hideLoadingMessage(item_type) 
    }, parameters:'q=jf;kdjafdlk'});
  }
  else {
    
  new Ajax.Updater(results_items_div, '/' + controller_name + '/search', { 
    asynchronous:true, evalScripts:true, onComplete: function(request){
     results_items_div.show();
    hideLoadingMessage(item_type) 
  }, parameters:'q=' + search_field.value});
  }
  return false;
}

function showLoadingMessage(item_type, elm) {
  results_items_div = $(item_type + '_search_results_items');
  Element.hide(results_items_div);
        
  TransparentMenu.show(item_type + '_info_message', {insideElement:{id: elm.id}, hideMode: 'none'});
  
  $('welcome').hide();
}

function hideLoadingMessage(item_type) {
  TransparentMenu.hide(item_type + '_info_message')
}

function removeAuthor(elm) {
  if (elm.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("table").length == 1) 
  {
    Element.getElementsBySelector(elm.parentNode.parentNode.parentNode.parentNode.parentNode, "table.authors input").each(function(input){input.value = ""});
  }  
  else {
    elm.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild(elm.parentNode.parentNode.parentNode.parentNode);
  }
    
}

function authors_type(elm, item_type, author_type) {
  $(item_type + '-news-service').hide();
  $(item_type + '-add-author').hide();
  $(item_type + '-author-names').hide();
  $(item_type + '_author_labels').hide();

  if (author_type == 'news-service') {
    $(item_type + '-news-service').show();
    $$('#' + item_type + '-author-names input, #' + item_type + '-author-names select').invoke('disable');
    $$('#' + item_type + '-news-service input, #' + item_type + '-news-service select').invoke('enable');
  } else if (author_type == 'persons') {
    $(item_type + '-add-author').show();
    $(item_type + '-author-names').show();
    $(item_type + '_author_labels').show();
    $$('#' + item_type + '-author-names input, #' + item_type + '-author-names select').invoke('enable');
    $$('#' + item_type + '-news-service input, #' + item_type + '-news-service select').invoke('disable');
  } else {
    $$('#' + item_type + '-news-service input, #' + item_type + '-news-service select').invoke('disable');
    $$('#' + item_type + '-author-names input, #' + item_type + '-author-names select').invoke('disable');
  }
}

function change_origin(item_type, origin) {
  $(item_type + '-origin-' + origin).checked = "checked"
  if (item_type == 'magazine' || item_type == 'newspaper' || item_type == 'journal') {
    if (origin == 'print') {
      $(item_type + '-online-fields').hide();
      $('optional-' + item_type + '-pages').show();
			$(item_type + '-database-fields').hide();
			$(item_type + '_date_accessed').hide();
    } 
		else if (origin == 'online') {
      $(item_type + '-online-fields').show();
      $('optional-' + item_type + '-pages').hide();
			$(item_type + '-database-fields').hide();
			$(item_type + '_date_accessed').show();
    } 
		else if (origin == 'database') {
			$(item_type + '-online-fields').hide();
      $('optional-' + item_type + '-pages').show();
			$(item_type + '-database-fields').show();
			$(item_type + '_date_accessed').show();
  	} 
  } 
	else if (item_type == 'encyclopedia') {
    if (origin == 'print') {
      $(item_type + '-online-fields').hide();
			$(item_type + '-database-fields').hide();
			$(item_type + '_date_accessed').hide(); 
    } 
		else if (origin == 'online') {
      $(item_type + '-online-fields').show();
			$(item_type + '-database-fields').hide();
			$(item_type + '_date_accessed').show();
    } 
		else if (origin == 'database') {
			$(item_type + '-online-fields').hide();
			$(item_type + '-database-fields').show();
			$(item_type + '_date_accessed').show();
		}
  }
}

function resetSearchField(item_type) {
  search_field = $(item_type + '_search_field');
  if (item_type == "book") {
     search_field.value = "Find a book by title, author, or ISBN..."
  }
  
  if (item_type == "magazine") {
     search_field.value = "Find a magazine article by title..." 
  }
  
  if (item_type == "newspaper") {
     search_field.value = "Find a newspaper article by title..." 
  }
  
  if (item_type == "journal") {
     search_field.value = "Find a scholarly journal article by title..."
  }
  
  if (item_type == "film") {
     search_field.value = "Find a film by title, director, or actor..."
  }
  
  if (item_type == "website") {
     $('url_of').value = "http://"
  }
}

function showWebsiteLoading() {
  results_div = $("website_search_results");
  results_div.show();
  $('website_fields').hide(); 
  showLoadingMessage("website", results_div);
}

function hideWebsiteLoading() {
  hideLoadingMessage("website");
  results_div.hide();
}

function numberAuthors(itemtype) {
  i = 0;
  $$('div#' + itemtype + '-author-names input.firstname').each(function(elm) {
    elm.setAttribute('name', itemtype + '[authors][' + i + '][firstname]');
    elm.setAttribute('id', itemtype + '_authors_' + i + '_firstname');
    i++;
  });
  i = 0;
 
  $$('div#' + itemtype + '-author-names input.lastname').each(function(elm) {
    elm.setAttribute('name', itemtype + '[authors][' + i + '][lastname]');
    elm.setAttribute('id', itemtype + '_authors_' + i + '_lastname');
    i++;
  });
}

function numberSuperCiteBooks() {
  i = 0;
  $$('div#super_cite_books input').each(function(elm) {
    elm.setAttribute('name', 'super_cite_book_' + i);
    elm.setAttribute('id', 'super_cite_book_' + i);
    i++;
  });
}

function contractExpand(bib) {
  i = $(bib + '-details');
  contract = $('contract-' + bib);
  expand = $('expand-' + bib);
  
  if (i.style.display != "none") {
    i.hide();
    contract.hide();
    expand.show();
  }
  else {
    i.show();
    contract.show();
    expand.hide();
  }
}

function interviewUpdateForm(value) {
  if (value == "Unpublished") {
    $('interview_network').hide();
    $('interview_program').hide();
    $('interview_periodical_row').hide();
    $('interview_location').show();
    $('interview_network_city').hide();
		$('interview_call_letters').hide();
		$('interview_description_row').hide();
		$('interview_pages_row').hide();
		$('interview_section_row').hide();
		$('interview_edition_row').hide();
		$('interview_published_on_date').show();
		$('interview_date_tooltip').show();
		$('interview_published_date_tooltip').hide();
		$('interview_year_row').hide();
		$('interview_program_type_row').hide();
		$('interview_type').show();
		$('interview_book_title').hide();
		$('interview_volume_row').hide();
  }
  else if (value == "Radio/TV") {
    $('interview_network').show();
		$('interview_network_tooltip').show();
		$('interview_publisher_tooltip').hide();
    $('interview_program').show();
    $('interview_periodical_row').hide();
  	$('interview_location').hide();
    $('interview_network_city').show();
		$('interview_network_city_tooltip').show();
		$('interview_publisher_city_tooltip').hide();
		$('interview_call_letters').show();
		$('interview_description_row').show();
		$('interview_pages_row').hide();
		$('interview_section_row').hide();
		$('interview_edition_row').hide();
		$('interview_published_on_date').show();
		$('interview_date_tooltip').hide();
		$('interview_published_date_tooltip').show();
		$('interview_year_row').hide();
		$('interview_program_type_row').show();
		$('interview_type').hide();
		$('interview_book_title').hide();
		$('interview_volume_row').hide();
  }
  else if (value == "Newspaper") {
    $('interview_network').hide();
    $('interview_program').hide();
    $('interview_periodical_row').show();
    $('interview_location').hide();
    $('interview_network_city').hide();
		$('interview_call_letters').hide();
		$('interview_description_row').show();
		$('interview_pages_row').show();
		$('interview_required_pages').show();
		$('interview_section_row').show();
		$('interview_edition_row').show();
		$('interview_published_on_date').show();
		$('interview_date_tooltip').hide();
		$('interview_published_date_tooltip').show();
		$('interview_year_row').hide();
		$('interview_program_type_row').hide();
		$('interview_type').hide();
		$('interview_book_title').hide();
		$('interview_volume_row').hide();
  }
	else if (value == "Magazine") {
    $('interview_network').hide();
    $('interview_program').hide();
    $('interview_periodical_row').show();
    $('interview_location').hide();
    $('interview_network_city').hide();
		$('interview_call_letters').hide();
		$('interview_description_row').show();
		$('interview_pages_row').show();
		$('interview_required_pages').hide();
		$('interview_section_row').hide();
		$('interview_edition_row').hide();
		$('interview_published_on_date').show();
		$('interview_date_tooltip').hide();
		$('interview_published_date_tooltip').show();
		$('interview_year_row').hide();
		$('interview_program_type_row').hide();
		$('interview_type').hide();
		$('interview_book_title').hide();
		$('interview_volume_row').show();
  }
	else if (value == "Book") {
    $('interview_network').show();
		$('interview_network_tooltip').hide();
		$('interview_publisher_tooltip').show();
    $('interview_program').hide();
    $('interview_periodical_row').hide();
    $('interview_location').hide();
    $('interview_network_city').show();
		$('interview_network_city_tooltip').hide();
		$('interview_publisher_city_tooltip').show();
		$('interview_call_letters').hide();
		$('interview_description_row').show();
		$('interview_pages_row').show();
		$('interview_required_pages').show();
		$('interview_section_row').hide();
		$('interview_edition_row').hide();
		$('interview_published_on_date').hide();
		$('interview_year_row').show();
		$('interview_program_type_row').hide();
		$('interview_type').hide();
		$('interview_book_title').show();
		$('interview_volume_row').hide();
  }
}

function photographUpdateForm(value, edit) {
  if (value == "Magazine") {
		$('photograph-file-type').hide();
		$('photograph-title-row').hide();
    $('photograph-periodical-title').show();
    $('photograph-publisher').hide();
    $('photograph-publisher-city').hide();
    $('photograph-published-year').hide();
    $('photograph-publication-author').show();
    $('photograph-city').show();
    $('photograph-institution').show();
    $('photograph-date-published').show();
		$('photograph-date-year-published').show();
		$('photograph-date-calendar').show();
    $('photograph-year-created').show();
    $('photograph-origin-info').show();
		$('photograph-volume-row').show();
		$('photograph-pages-row').show();
		$('photograph_required_pages').hide();
		$('photograph-section-row').hide();
		$('photograph-edition-row').hide();
		$('photograph-website').hide();
		$('photograph-url-row').hide();
		$('photograph-date-accessed-row').hide();
  }
	else if (value == "Newspaper") {
		$('photograph-file-type').hide();
		$('photograph-title-row').hide();
    $('photograph-periodical-title').show();
    $('photograph-publisher').hide();
    $('photograph-publisher-city').hide();
    $('photograph-published-year').hide();
    $('photograph-publication-author').show();
    $('photograph-city').show();
    $('photograph-institution').show();
    $('photograph-date-published').show();
		$('photograph-date-year-published').show();
		$('photograph-date-calendar').show();
    $('photograph-year-created').show();
    $('photograph-origin-info').show();
		$('photograph-volume-row').hide();
		$('photograph-pages-row').show();
		$('photograph_required_pages').show();
		$('photograph-section-row').show();
		$('photograph-edition-row').show();
		$('photograph-website').hide();
		$('photograph-url-row').hide();
		$('photograph-date-accessed-row').hide();
	}
	else if (value == "Book") {
		$('photograph-file-type').hide();
		$('photograph-title-row').show();
    $('photograph-periodical-title').hide();
    $('photograph-publisher').show();
    $('photograph-publisher-city').show();
    $('photograph-published-year').show();
    $('photograph-publication-author').show();
    $('photograph-city').show();
    $('photograph-institution').show();
    $('photograph-date-published').hide();
		$('photograph-date-year-published').show();
		$('photograph-date-calendar').hide();
    $('photograph-year-created').show();
    $('photograph-origin-info').show();
		$('photograph-volume-row').hide();
		$('photograph-pages-row').show();
		$('photograph_required_pages').show();
		$('photograph-section-row').hide();
		$('photograph-edition-row').hide();
		$('photograph-website').hide();
		$('photograph-url-row').hide();
		$('photograph-date-accessed-row').hide();
	}
  else if (value == "Museum") {
		$('photograph-file-type').hide();
		$('photograph-title-row').hide();
    $('photograph-periodical-title').hide();
    $('photograph-publisher').hide();
    $('photograph-publisher-city').hide();
    $('photograph-published-year').hide();
    $('photograph-publication-author').hide();
    $('photograph-city').show();
    $('photograph-institution').show();
    $('photograph-date-published').hide();
		$('photograph-date-year-published').hide();
		$('photograph-date-calendar').hide();
    $('photograph-year-created').show();
    $('photograph-origin-info').show();
		$('photograph-volume-row').hide();
		$('photograph-pages-row').hide();
		$('photograph-section-row').hide();
		$('photograph-edition-row').hide();
		$('photograph-website').hide();
		$('photograph-url-row').hide();
		$('photograph-date-accessed-row').hide();
  }
  else if (value == "Online") {
		$('photograph-file-type').hide();
		$('photograph-title-row').hide();
    $('photograph-periodical-title').hide();
    $('photograph-publisher').hide();
    $('photograph-publisher-city').hide();
    $('photograph-published-year').hide();
    $('photograph-publication-author').hide();
    $('photograph-city').show();
    $('photograph-institution').show();
    $('photograph-date-published').hide();
		$('photograph-date-year-published').hide();
		$('photograph-date-calendar').hide();
    $('photograph-year-created').hide();
    $('photograph-origin-info').show();
		$('photograph-volume-row').hide();
		$('photograph-pages-row').hide();
		$('photograph-section-row').hide();
		$('photograph-edition-row').hide();
		$('photograph-website').show();
		$('photograph-url-row').show();
		$('photograph-date-accessed-row').show();
  }
  else if (value == "I photographed") {
		$('photograph-file-type').show();
    $('photograph-date-published').show();
    $('photograph-year-created').show();
    $('photograph-origin-info').hide();
    
    if (!edit) {
      myregex = new RegExp("^[0-9]{1,4}");
      var matches = myregex.exec($('photograph_date').value);
      if (matches) {
        $('photograph_published_on_year').value = matches[0];
      } 
    }
  }

  var year = $('photograph_published_on_year');
  year.remove();
  if (value == 'Magazine' || value == 'Newspaper') {
    $('photograph-date-year-published').appendChild(year);
  }
	else {
		$('photo_year_published').appendChild(year);
	}
}

function savedBibsConfirm(action) {
  if(action=="delete"){
    return confirm("Are you sure you wish to delete the selected bibliographies");    
  }
  
  if(action=="merge"){
    var name = prompt('What would you like to call the merged bibliography?'); 
    if (name) {
      $('bibname').value = name;
    }
    return false;  
  }
  
  if(action=="share"){
    return confirm("Are you sure you wish to share these bibliographies?");    
  }
}

function toggleInviteField(elm) {
  elm = $(elm);
  elm.setStyle({'color' : '#000'});
  elm.innerHTML = '';
  $('has_emails').value = "1"
}

function renameBib(){
  var name = prompt('What would you like to call the merged bibliography?'); 
  if (name) {
    $('newname').value = name;
  }
  return false;  
}

function showAnnotation(itemType) {
  if ($(itemType + '_primary_annotation')) {
    $(itemType + '_primary_annotation').up().show();
    $(itemType + '_primary_annotation').up().previous().hide();
  }
}

function hideAnnotation(itemType) {
  if ($(itemType + '_primary_annotation')) {
    $(itemType + '_primary_annotation').up().hide();
    $(itemType + '_primary_annotation').up().previous().show();
  }
}

function returnToSearchResults(itemType) {
  hideLoadingMessage(itemType);
  $(itemType + "_search_results").show();
  $(itemType + "_search_results_items").show();
  $(itemType + "_fields").hide(); 
  $(itemType + "_return_search_results").hide();
	if (itemType != "website") {
  	$(itemType + "_hide_search").show();
	}
  $("welcome").hide();
}

function hideSearchResults(itemType) {
  $(itemType + "_search_results").hide();
  $(itemType + "_search_results_items").hide();
  if ($(itemType + "_auto_manual_status").value == "auto" || $(itemType + "_auto_manual_status").value == "manual") {
    $(itemType + "_fields").show();
  } 
  $(itemType + "_return_search_results").show();
	if (itemType != "website") {
  	$(itemType + "_hide_search").hide();
	}
}

function magazineUpdateForm(value) {
	toggleMagDay(value);
  if (value && value.toString().match(/^m-/)) {
    var month = value.substring(2);
    calendarUpdate($('magazine_year').value, month, $('magazine_day').value, 'magazine', 'published');
  }
}

function toggleMagDay(value) {
  if (!value || value == "" || value.toString().match(/^m-/) || value.toString().match(/^\d+$/)) {
    $("magazine_day").show();
    $$('td.date-cells-to-hide').invoke("show");
  } else {
    $("magazine_day").hide();
    $$('td.date-cells-to-hide').invoke("hide");
  }
}

function calendarUpdate(year, month, day, source, date_type) {
  if (date_type == "published") {
    if (source == "magazine") {
      if (month < 10) {
        month = "0" + month;
      }
    }
    
    $(source + '_date').value = year + "-" + month + "-" + day;
  }
  else if (date_type == "accessed") {
    $(source + '_accessed_date').value = year + "-" + month + "-" + day;
  }
}

function calendarMonthSplit(value, source, date_type) {
  month = value.substring(5,7);
  
  if (date_type == "published") {
    if (source == "magazine") {
      if (month < 10) {
        month = month.substring(1);
      }
      $(source + '_month').value = 'm-' + month;
      $(source + '_day').value = value.substring(8,10);
      $(source + '_year').value = value.substring(0,4);
      $(source + '_day').show();
    }
    else {
      $(source + '_published_on_month').value = month;
      $(source + '_published_on_day').value = value.substring(8,10);
      $(source + '_published_on_year').value = value.substring(0,4);
    }
  }
  else if (date_type == "accessed") {
    $(source + '_accessed_on_month').value = month;
    $(source + '_accessed_on_day').value = value.substring(8,10);
    $(source + '_accessed_on_year').value = value.substring(0,4);
  }
}

function bookEditionUpdateForm(value) {
	if (value == "") {
			$('book_edition_number_name').hide();
			$('book_original_year').hide();
			$('book_reprint').hide();
	}
	else if (value == "Reprint") {
			$('book_edition_number_name').hide();
			$('book_original_year').show();
			$('book_reprint').show();
	}
	else if (value == "Revised/Expanded") {
			$('book_edition_number_name').show();
			$('book_original_year').hide();
			$('book_reprint').hide();
	}
}

function bookChapterUpdateForm(value) {
	if (value == "Book") {
		$('book-chapter-fields').hide();
	}
	else if (value == "Chapter") {
		$('book-chapter-fields').show();
	}
}

function filmEditionUpdateForm(value) {
	if (value == "") {
		$('film_reprint').hide();
		$('film_original_year').hide();
	}
	else if (value == "Reprint") {
		$('film_reprint').show();
		$('film_original_year').show();
	}
}

function filmChapterUpdateForm(value) {
	if (value == "Chapter") {
		$('film_chapter').show();
	}
	else if (value == "Film" || value == "") {
		$('film_chapter').hide();
	}
}

function encyclopediaSourceUpdateForm(value) {
		if (value == "Encyclopedia article") {
			$('encyclopedia_article').show();
			$('encyclopedia_article_tooltip').show();
			$('dictionary_entry_tooltip').hide();
			$('encyclopedia_pages').show()
			$('dictionary_definition').hide();
			$('encyclopedia_text').show();
			$('dictionary_text').hide();
		}
		else if (value == "Encyclopedia book") {
			$('encyclopedia_article').hide();
			$('encyclopedia_article_tooltip').show();
			$('dictionary_entry_tooltip').hide();
			$('encyclopedia_pages').hide()
			$('dictionary_definition').hide();
			$('encyclopedia_text').show();
			$('dictionary_text').hide();
		}
		else if (value == "Dictionary definition") {
			$('encyclopedia_article').show();
			$('encyclopedia_article_tooltip').hide();
			$('dictionary_entry_tooltip').show();
			$('encyclopedia_pages').show()
			$('dictionary_definition').show();
			$('encyclopedia_text').hide();
			$('dictionary_text').show();
		}
		else if (value == "Dictionary book") {
			$('encyclopedia_article').hide();
			$('encyclopedia_article_tooltip').hide();
			$('dictionary_entry_tooltip').show();
			$('encyclopedia_pages').hide()
			$('dictionary_definition').hide();
			$('encyclopedia_text').hide();
			$('dictionary_text').show();
		}
}

function lectureUpdateForm(type) {
	if (type == "Class lecture") {
		$('lecture_topic_tooltip').show();
		$('lecture_title_tooltip').hide();
		$('lecture_class_tooltip').show();
		$('lecture_event_tooltip').hide();
		$('lecture_university_tooltip').show();
		$('lecture_sponsor_tooltip').hide();
	}
	else {
		$('lecture_topic_tooltip').hide();
		$('lecture_title_tooltip').show();
		$('lecture_class_tooltip').hide();
		$('lecture_event_tooltip').show();
		$('lecture_university_tooltip').hide();
		$('lecture_sponsor_tooltip').show();
	}
}

function newspaperCountryUpdateForm(country) {
	if (country == "North American" || country == "") {
		$$('.hide-if-international').invoke('show');
	}
	else if (country == "International") {
		$$('.hide-if-international').invoke('hide');
	}
}

function radioTVSourceUpdateForm(source) {
	if (source == "Episode") {
		$('radiotv_date_published').show();
		$('radiotv_year_row').hide();
		$('radiotv_series_row').show();
		$('radiotv_program_row').hide();
	}
	else if (source == "Series") {
		$('radiotv_date_published').hide();
		$('radiotv_year_row').show();
		$('radiotv_series_row').show();
		$('radiotv_program_row').hide();
	}
	else if (source == "Program") {
		$('radiotv_date_published').show();
		$('radiotv_year_row').hide();
		$('radiotv_series_row').hide();
		$('radiotv_program_row').show();
	}
}
