/*
  * Title: Auto-fill Algorithm
  * Description: Auto-fills the ein and business address fields.
  * Author: Christian Noel G. Reyes, Lhester Santiago
  * Company: BCWeblab
  */

function Require(obForm, szFields)
{
  var fields = szFields.split(",")
  var szMissing= new Array();
  for (x=0;x<fields.length;x++) {
	var str = obForm.elements[fields[x]].value;
    if (str.length==0 || str==null || str=="" || str=="- -select- -") {
       //szMissing[szMissing.length]=new String(fields[x]);
       szMissing[szMissing.length]=new String(document.getElementById(fields[x]).title);
    }
  }
  if (szMissing.length) {
    alert("We require you to fill up "+((szMissing.length>1)?" ":" ")+szMissing.join(",")+" to fulfill your request.");
    return false
  }
  return true; -IE
}

function check1(obForm, szFields){
  var fields = szFields.split(",")
  var szMissing= new Array();
  for (x=0;x<fields.length;x++) {
	var str = obForm.elements[fields[x]].value;
    if(!str.match(/^[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+$/)){
       szMissing[szMissing.length]=new String(document.getElementById(fields[x]).title);
    }
  }
  if (szMissing.length) {
    alert("Please enter a valid Certified Mail Receipt for the ff: "+((szMissing.length>1)?" ":" ")+szMissing.join(","));
    return false
  }
  return true; -IE	

  //var field = document.getElementById(objfield);
  //var fieldval = field.value;
  //if(!fieldval.match(/^[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+\s[0-9][0-9][0-9][0-9]+$/)){
    //alert("Please enter a valid Certified Mail Receipt!");
    //return false;
  //}
}