function r_on(i) {
  if (document[i].src.indexOf("down") < 0) {
    document[i].src = "/zht/images/" + i + "_over.gif"; 
  }
}

function r_off(i) {
  if (document[i].src.indexOf("down") < 0) {
    document[i].src = "/zht/images/" + i + ".gif"; 
  }
}

function writeDate() {
  var today = new Date();
  var year = today.getFullYear();
  document.write(year);
}

function openIndustry() {
	selectron = document.getElementById("solution");
	window.open('/solutions/?view=Application&Industry=' + selectron.options[selectron.selectedIndex].value,'_top');
}

function convertSpaces(str) {
  var out = "", flag = 0;
  for (i = 0; i < str.length; i++) {
    if (str.charAt(i) != "_") {
      out += str.charAt(i);
      flag = 0;
    } else {
      if (flag == 0) {
        out += " ";
        flag = 1;
      }
    }
  }
  return out;
}

function checkrequired(which) {
  var pass=true;
  if (document.images) {
    for (i=0; i < which.length; i++) {
      var tempobj=which.elements[i];
      if (tempobj.name.substring(0,9)=="required_") {
        if (((tempobj.type=="text"||tempobj.type=="textarea")&&
          tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
          tempobj.selectedIndex==0)) {
          pass=false;
          break;
        }
      }
    }
  }
  if (!pass) {
    shortFieldName = tempobj.name.substring(9,tempobj.name.length).toUpperCase();
    alert("The "+convertSpaces(shortFieldName)+" field is required. Please enter the " +convertSpaces(shortFieldName.toLowerCase())+" and try again.");
    return false;
  } else
    return true;
}

