//var xmlHttp;

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


///////////////////////////////////////////////////////////////
function mailing(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="requestAjax/mailing.cfm";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChangedMail;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}



////////////////////////////////////////////////////////////////
function mailingHome(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="requestAjax/mailingHome.cfm";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChangedHome;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

///////////////////////////////////////////////////////////////
function institution(str,loc)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/graded/requestAjax/institution.cfm";
url=url+"?q="+str+"&location="+loc;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedInstitution;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}


//////////////////////////////////////////////////////////////
function stateChangedInstitution() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("institution").innerHTML=xmlHttp.responseText;
}
}


//////////////////////////////////////////////////////////////
function stateChangedHome() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("displayMailingHomeForm").innerHTML=   xmlHttp.responseText ;
}
}


/////////////////////////////////////////////////////////////
function stateChangedMail() 
{ 
if (xmlHttp.readyState==4)
{ 
	//alert(xmlHttp.responseText);
	if (xmlHttp.status==200)
    {// 200 = OK
	var myText = xmlHttp.responseText;
	document.getElementById("displayMailingForm").innerHTML=xmlHttp.responseText;
	document.getElementById("displayMailingForm").style.display= "block";
	}
}
}


//////////////////////////////////////////////////////////////
function show(div,onOff,otherDiv){
	if(onOff==0){
		document.getElementById(div).style.display="none";
		if(otherDiv > 0){
			document.getElementById(otherDiv).style.display="block";
		}
	}
	if(onOff==1){
		document.getElementById(div).style.display="block";
		if(otherDiv){
		document.getElementById(otherDiv).style.display="none";
		}
	}
}

function killInfo(div){
		document.getElementById("displayMailingForm").innerHTML="";
}
