// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function jump(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popupWindow(sUrl,height,width,scrollbars) {
  height = (height == null) ? '400' : height;
  width = ( width == null) ? '400' : width;
  scrollbars = (scrollbars == null) ? '0' : scrollbars;
  window.open(sUrl,'name','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + scrollbars + ',resizable=1,height=' + height + ',width=' + width);
}

function printwin() {
  if (window.print) window.print();
  else if (VBS) printIt();
  else alert('This script does not work in your browser');
}

function redirect(form) { 
  var index=form.select.selectedIndex
  if (form.select.options[index].value != "0") {
    location=form.select.options[index].value;
  }
}

var checkflag = "false";
function check(field) {
  if (checkflag == "false") {
    for (i = 0; i < field.length; i++) {
      field[i].checked = true;
    }
    checkflag = "true";
    return "Uncheck All"; 
  }
  else {
    for (i = 0; i < field.length; i++) {
      field[i].checked = false;
    }
    checkflag = "false";
    return "Check All";
  }
}

function checkoruncheckit(field,value) {
    $(field).checked = value;
}

function printConversion(response) {
  printwin();
}

    sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
	  sfEls[i].onmouseover=function() {
		this.className+=" sfhover";
	  }
	  sfEls[i].onmouseout=function() {
		this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
	  }
	 }
    } 
   if (window.attachEvent) window.attachEvent("onload", sfHover);