<!--
function checkForNull (str)
   {
   // If the string is null, then return a blank string else returned the string trimmed
   if (str == null)
      {
      return("");
      }
   else
      {
      return(Trim(str));
      }
   }
function Trim (orgString)
   {
   return LTrim(RTrim(orgString))
   }

function LTrim (orgString)
   {
   return orgString.replace(/^\s+/,'')
   }

function RTrim(orgString)
   {
   return orgString.replace(/\s+$/,'')
   }

function pad(str, length)
   {
   // Pad the input string with zero's
   while (str.length < length)
      {
      str = '0' + str;
      }

   return(str);
   }

function formCheck(formobj){
	// Array of all feild names to be checked
	// var fieldRequired = Array("name","department","emplid","email","phone","building","roomnumber","ebuilding","eroomnumber","equipmentinvolved","worktype","typeofproblem", "usmnumberofequipment");
	// Array of all correlating descriptions to the previous array ( What will be displayed by the alert window
	// var fieldDescription = Array("Name","Department","Employee Id","Email address","Phone number","Building number","Room number", "Electronics Building","Electronics room number","Equipment involved","Type of work","Problem Description","USM Number on Equipment");
	
	// Array of all feild names to be checked
	var fieldRequired = Array("name","emplid","phone","department","email","building","roomnumber","usmnumberofequip","worktype","typeofproblem");
	// Array of all correlating descriptions to the previous array ( What will be displayed by the alert window
	var fieldDescription = Array("Name","Employee Id","Phone number","Department","Email address","Building name","Room number","USM Number on Equipment","Type of Problem","Problem Description");
	// Dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	// Determine what each named object is, and then ensure that none are empty
	for (var i = 0; i < fieldRequired.length; i++)
	    {
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;

			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
		        tempText = checkForNull (obj.value);
               if (tempText == "" || tempText == null){
                  alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	    // Check for mac address field
/*	    j=worktype.length; //alert(j)
	    for (i=0; i<j; i++){
		if(worktype[i].checked) var worktype = worktype[i].value;
	    }
*/
	}
	
/*	if (worktype == "Wireless"){
	    alertMsg += " - " + "MAC Address" + "\n";
	}
*/
	// Based upon the classification, we need to check different fields
	if (formobj.classification.value == "F")
	   {
	   // Make sure the user selected Type of Problem
       var optionSelected = getTheSelectedValue(formobj.worktype);
	   if (checkForNull(optionSelected) == "")
	      {
	      alertMsg += " - Type of Problem\n";
	      }
	   }
	else
	   {
	   var radioSelected = getTheCheckedValue(formobj.worktype);
	   // If the user has selected Wireless, then make sure they have entered a MAC address
	   if (radioSelected == "Wireless")
	      {
		  if (checkForNull(formobj.macaddress.value) == "" || formobj.macaddress.value.length != 12)
		     {
             alertMsg += " - MAC Address\n";
			 }
		  }
	   }


	// If something has been added to alert message, display alert window to user
	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//-->