addEvent(window, 'load', initiate);

/**
 * This function sets up the toggle page url script. It is called here so that it will wait until the page has
 * loaded so that trigger can be correctly assigned. The function is called in case of a reload so that the 
 * field can be displayed if was previously checked. 
 * @return void
 */
function initiate() { 
  document.getElementById('is_problem').onclick = toggle_page_url;
  toggle_page_url();
} // end function initiate()

/**
 * This function toggles the problem page URL. If the is_problem checkbox is checked, then the field is 
 * displayed. Otherwise, the field is hidden. 
 * @return void
 */
function toggle_page_url() {
  document.getElementById('problem_page_div').style.display = (document.getElementById('is_problem').checked ? 'block' : 'none');
} // end function toggle_page_url()
