function oe()
{
 return false;
}
window.onerror = oe;

function explodeArray(item,delimiter)
{
  tempArray=new Array(1);

  var Count=0;
  var tempString=new String(item);

  while (tempString.indexOf(delimiter)>0)
  {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
    tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);
    Count=Count+1
  }

  tempArray[Count]=tempString;

  return tempArray;
}

function checkReqFields( fields )
{

 fields = explodeArray(fields,",");

 var m,ok,obj,mfocus,frm;
 ok=true;

 frm=document.forms[0];

  with (frm)
  {

		for ( i=0; i<fields.length; i++ )
    {
			field = fields[i];


			obj = elements[''+field+''];

      // Check if radiobox
      if ( obj.type != "text"  && obj.type != "password" && obj.type != "file" && obj.type != "textarea" && obj.type != "select-one" && obj.type != "checkbox" )
      {
        if (obj[0].type == "radio")
        {
          var check = 0;

          for (k=0;k<obj.length;k++)
          {
            if ( obj[k].checked == true ) { check++; }
          }

          if ( check == 0 )
          {
            ok=false;

            for (k=0;k<obj.length;k++)
            {
              obj[k].style.backgroundColor='#F40201';
            }
          } else {
            for (k=0;k<obj.length;k++) {
              obj[k].style.backgroundColor='#fff';
            }
          }
        }
      }
      else if ( obj.type == "select-one" )
      {

        if ( obj.value == "" )
        {

          ok=false;
          obj.style.backgroundColor='#F40201';

        }
        else
        {

           obj.style.backgroundColor='#fff';

        }

		  }
      else if ( obj.type == "checkbox" )
      {
        if ( obj.checked == false )
        {

          ok=false;
          obj.style.backgroundColor='#F40201';

        }
        else
        {

          obj.style.backgroundColor='#fff';

        }
		  }
      else
      {
        if ( !obj.value )
        {

          ok=false;
          obj.style.backgroundColor='#F40201';

        }
        else
        {

          obj.style.backgroundColor='#fff';

        }
		  }
    }

		if ( !ok )
    {

			return false;

		}
    else
     return true;

	}
}

