
function LoadJobTitle()
{
  // Get the selected job title if any
  var url = window.location.href;
  // Next, split the url by the ?
  var qparts = url.split("?");
  var selectedReqNo="";
  
  // Check that there is a querystring, return "" if not
  if (qparts.length > 0)
  {
   selectedReqNo = qparts[1];
  }
  
  var xmlDoc=null;
  if (window.ActiveXObject)  
   {// code for IE
       xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
   }
    else if (document.implementation.createDocument)
    {
     // code for Firefox, Mozilla, Opera, etc.
        xmlDoc=document.implementation.createDocument("","",null);
   }
   else
    {
      alert('Your browser cannot handle this script');
    }
    if (xmlDoc!=null)
     {
         xmlDoc.async=false;
         xmlDoc.load("Opportunities.xml");
         var x=xmlDoc.getElementsByTagName("Job");
         document.write("<select id='JobTitle' style='width:100%;'>");
         document.write("<option value='0'>General</option>");  
		for (var i=0;i<x.length;i++)
		{ 
			
			if (x[i].getAttribute("active").toUpperCase() == "YES" )
			{
				if  (selectedReqNo== x[i].getAttribute("requisition"))
					document.write("<option value='" + x[i].getAttribute("id")  + "' selected='selected'>");
				else
					document.write("<option value='" + x[i].getAttribute("id") + "'>");
				document.write(x[i].getAttribute("title")+ " (#" + x[i].getAttribute("requisition")  + ")" );

				document.write("</option>");	
			}
		}
		document.write("</select>");
     }
}

function ChangeJobKind()
{
 var x;
 x=document.getElementById("JobTitle");
 if (x.selectedIndex != 0)
    document.getElementById("kindofjob").value = x.options[x.selectedIndex].text;
 else
   document.getElementById("kindofjob").value = ""; 
}

function ChangeSubject()
{
   var subject;
   var title;
   title=document.getElementById("JobTitle");
   subject = title.options[title.selectedIndex].text + " - " + document.getElementById("lastname").value +  " - " + getTime();
   document.getElementById("subject").value = subject;
}

function getTime()
{
var time;
var today=new Date();
var hour=today.getHours();
var ap = "AM";
if (hour   > 11) { ap = "PM";        }
if (hour   > 12) { hour = hour - 12; }
if (hour   == 0) { hour = 12;        }

var m=today.getMinutes();
var s=today.getSeconds();
var month = today.getMonth();
var day = today.getDate();
var year = today.getFullYear();
time= month + "/" + day + "/" + year + " " +hour+":"+m+ " " + ap;
return time;

}