function check_display(layer, str) {
		if (layer == 'rwarning') {
		 if (str == "")
 	 	document.getElementById(layer).style.display = "none";
 	 else
		  document.getElementById(layer).style.display = "block";
		}
}

function ajaxObject(layer, url, what) {                                    // This is the object constructor
   var that=this;                                                    // A workaround for some javascript idiosyncrocies
   var updating = false;                                             // Set to true if this object is already working on a request
   this.callback = function() {}                                     // A post-processing call -- a stub you overwrite.

   this.update = function(passData) {                                // Initiates the server call.
      if (updating==true) { return false; }                          // Abort if we're already processing a call.
      updating=true;                                                 // Set the updating flag.
      var AJAX = null;                                               // Initialize the AJAX variable.
      if (window.XMLHttpRequest) {                                   // Are we working with mozilla?
         AJAX=new XMLHttpRequest();                                  //  Yes -- this is mozilla.
      } else {                                                       // Not Mozilla, must be IE
         AJAX=new ActiveXObject("Microsoft.XMLHTTP");                //  Wheee, ActiveX, how do we format c: again?
      }                                                              // End setup Ajax.
      if (AJAX==null) {                                              // If we couldn't initialize Ajax...
         alert("Your browser doesn't support AJAX.");                // Sorry msg.						
         return false                                                // Return false (WARNING - SAME AS ALREADY PROCESSING!)
      } else {
         AJAX.onreadystatechange = function() {                      // When the browser has the request info..
            if (AJAX.readyState==4 || AJAX.readyState=="complete") { //   see if the complete flag is set.
               if (what == 'value')
															   LayerID.value=AJAX.responseText;                  //   It is, so put the new data in the object's layer
															else
															   LayerID.innerHTML=AJAX.responseText;                  //   It is, so put the new data in the object's layer
															check_display(layer, AJAX.responseText);
															delete AJAX;                                          //   delete the AJAX object since it's done.
               updating=false;                                       //   Set the updating flag to false so we can do a new request
               that.callback();                                      //   Call the post-processing function.
            }                                                        // End Ajax readystate check.
         }                                                           // End create post-process fucntion block.
         var timestamp = new Date();								                       	// Get a new date (this will make the url unique)
									var uri = urlCall+'?';
									if (passData != '')
								  	uri = uri + passData + '&timestamp='+(timestamp*1);
									else
								  	uri = uri + 'timestamp='+(timestamp*1);                   // Append date to url (so the browser doesn't cache the call)
         AJAX.open("GET", uri, true);                                // Open the url this object was set-up with.
         AJAX.send(null);                                            // Send the request.
         return true;                                                // Everything went a-ok.
      }                                                              // End Ajax setup aok if/else block                 
   }
      
   // This area set up on constructor calls.
   var LayerID = document.getElementById(layer);                     // Remember the layer associated with this object.
   var urlCall = url;                                                // Remember the url associated with this object.
}                                                                    // End AjaxObject
                  
function ulookup(name, what) {
  var b = name.toLowerCase();
  var temp = new Array();
  temp = b.split(' ');
  for (i=0;i<temp.length;i++) {
    strTemp = temp[i].substring(0, 1).toUpperCase();
    strTemp2 = temp[i].substring(1, temp[i].length);
    temp[i] = strTemp+strTemp2;
  }
  var full="";
  for (i=0;i<temp.length;i++) {
		   if (temp[i]=='' || temp[i] == " ") continue;
     if (full != "") full = full + ' ';
     full = full + temp[i];
  }
	 temp = full.split(' ');
  document.getElementById(what).value=full;
		if (what == 'workeruname')
     workerUname.update("fname="+temp[0]+"&sname="+temp[1]);
  else
   		workerUname2.update("fname="+temp[0]+"&sname="+temp[1]);
}
                                        
function nlookup(name, what) {
  if (what == 'workeruname')
    workerName.update("uname="+name);
  else
		  workerName2.update("uname="+name);
  return true;
}
                                        