
function classroom_card_clicked1(event) {
  if (!event.shiftKey) {
    window.location = "/classroom"
    event.stop();
  } else {
    classroom_card_clicked2(event);
  }
}

function classroom_card_clicked2(event) {
  show_login('classroom');
  $('email3').focus();
  event.stop();
}

function hide_popup(popup) {
  $(popup).popup.hide();
}

function home_page_loaded2() {
  //$('other_button').observe('click', student_card_clicked2);

  $('p1warn').style.display = $('persistent1').checked ? 'block' : 'none';
  $('p2warn').style.display = $('persistent2').checked ? 'block' : 'none';

  var modal_options = { modal:true, duration:0.1, hide_delay: 60*60*1000, opacity: 0.05 };
  new Popup('reset_password_popup', null, modal_options);
}

function persistent1_changed(value) {
  $('p1warn').style.display = (value ? 'block' : 'none');
}

function show_login(user) {
  $('student_card').style.display = (user=='student' || user=='student2') ? 'none' : 'block';
  $('teacher_card').style.display = user=='teacher' ? 'none' : 'block';
  $('classroom_card').style.display = user=='classroom' ? 'none' : 'block';
  $('student_login').style.display = user=='student' ? 'block' : 'none';
  $('student2_login').style.display = user=='student2' ? 'block' : 'none';
  $('teacher_login').style.display = user=='teacher' ? 'block' : 'none';
  $('classroom_login').style.display = user=='classroom' ? 'block' : 'none';
}

function show_popup(popup, focus_field) {
  $(popup).popup.show();
  if (focus_field) {
    setTimeout("$('"+focus_field+"').focus();", 500)
  }
}

function student_card_clicked1(event) {
  show_login('student2');
  event.stop();
}

function student_card_clicked2(event) {
  show_login('student');
  $('email1').focus();
  event.stop();
}

function teacher_card_clicked1(event) {
  window.location = "/teacher";
  event.stop();
}

function teacher_card_clicked2(event) {
  show_login('teacher');
  $('email2').focus();
  event.stop();
}

function hide_flash_notice_popup() {
  $('flash_notice_popup').popup.hide();
}

