// 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();
}

function createMarker(point,longhtml,shorthtml,options) {
  var marker = new GMarker(point,options);
  GEvent.addListener(marker, "mouseover", function() {
    marker.openInfoWindowHtml(longhtml);
  });
  return marker;
}

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

if(typeof(window['shadowboxOptions']) == "undefined" ){
  shadowboxOptions = {};
}

sfHoverCore = function() {
	var e = sfHoverCore.divEls || [];
  for (var x=0; x < e.length; x++) {
		var el = document.getElementById(e[x]);
		var els = el ? el.getElementsByTagName("LI") : [];
		for (var i=0; i < els.length; i++) {
		  els[i].onmouseover=function() { this.className+=" sfhover"; }
		  els[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); }
	  }
	}
}
