//------------------- for clearing and replacing text in form input fields and textareas -------------------//
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}

//------------------- dynamically populate registration drop downs -------------------//

//List Date
var xmlHttp_ListDate

function showListDate(str)
{ 

xmlHttp_ListDate=GetXmlHttpObject_ListDate()
if (xmlHttp_ListDate==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="ajax_reg_session.php"
url=url+"?lkey="+str
url=url+"&sid="+Math.random()
xmlHttp_ListDate.open("GET",url,true)
xmlHttp_ListDate.onreadystatechange=stateListDateChanged 
xmlHttp_ListDate.send(null)
}

function stateListDateChanged() 
{ 
if (xmlHttp_ListDate.readyState==4 || xmlHttp_ListDate.readyState=="complete")
 { 
 document.getElementById("listDate").innerHTML=xmlHttp_ListDate.responseText;
 document.getElementById("listTime").innerHTML="";
 document.getElementById("listSession").innerHTML="";
 } 
}

function GetXmlHttpObject_ListDate()
{
var xmlHttp_ListDate=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp_ListDate=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp_ListDate=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp_ListDate=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp_ListDate;
}

//List Time
var xmlHttp_ListTime

function showListTime(str)
{ 

xmlHttp_ListTime=GetXmlHttpObject_ListTime()
if (xmlHttp_ListTime==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="ajax_reg_session.php"
url=url+"?dkey="+str
url=url+"&sid="+Math.random()
xmlHttp_ListTime.open("GET",url,true)
xmlHttp_ListTime.onreadystatechange=stateListTimeChanged 
xmlHttp_ListTime.send(null)
}

function stateListTimeChanged() 
{ 
if (xmlHttp_ListTime.readyState==4 || xmlHttp_ListTime.readyState=="complete")
 { 
 document.getElementById("listTime").innerHTML=xmlHttp_ListTime.responseText;
 document.getElementById("listSession").innerHTML="";
 } 
}

function GetXmlHttpObject_ListTime()
{
var xmlHttp_ListTime=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp_ListTime=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp_ListTime=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp_ListTime=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp_ListTime;
}

//List Session
var xmlHttp_ListSession

function showListSession(str)
{ 

xmlHttp_ListSession=GetXmlHttpObject_ListSession()
if (xmlHttp_ListSession==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="ajax_reg_session.php"
url=url+"?tkey="+str
url=url+"&sid="+Math.random()
xmlHttp_ListSession.open("GET",url,true)
xmlHttp_ListSession.onreadystatechange=stateListSessionChanged 
xmlHttp_ListSession.send(null)
}

function stateListSessionChanged() 
{ 
if (xmlHttp_ListSession.readyState==4 || xmlHttp_ListSession.readyState=="complete")
 { 
 document.getElementById("listSession").innerHTML=xmlHttp_ListSession.responseText;
 } 
}

function GetXmlHttpObject_ListSession()
{
var xmlHttp_ListSession=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp_ListSession=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp_ListSession=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp_ListSession=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp_ListSession;
}
