function openpop(newpage, anch, sizex, sizey) {
  if (anch == '') {
    var new_page_with_anchor = newpage;
  }else{
    var new_page_with_anchor = newpage + "#" + anch;
    }
  var nwin = window.open(new_page_with_anchor,"", "width=" + sizex + ",height=" + sizey + ",scrollbars=yes,resizable=yes");
  nwin.focus();
}

function openchat() {
    window.open("/chat/index_popup","English, baby! Chat","width=800, height=600,toolbar=no,resizable=yes,location=no,menubar=no,status=no");
  }
  
function rateLesson(rating) {
		var nwin=window.open("rating.php?rating="+rating,"","width=500,height=400,scrollbars=yes,resize=yes,toolbar=yes,locationbar=yes");
		nwin.focus();
}
function addLesson(thisLesson) {
    alert ("("+thisLesson+") has been added to My Lessons");
}

function toggleChecked() {
  for (var i = 0; i < document.forms[0].elements.length; i++) {
    if (document.forms[0].elements[i].type == 'checkbox'){
      if (document.forms[0].elements[i].name == 'schools[]') {
        document.forms[0].elements[i].checked = !(document.forms[0].elements[i].checked);
      }
    }
  }
}

function onLoad() {

    // See if there's a form element that wants focus.
    var focus_element = document.getElementById("js_focus");
    if (focus_element != null) {
        focus_element.focus();
    }

}
