﻿

function SetTextbox( TextboxID, data, MyDiv )
{
   
    document.getElementById(TextboxID).value = data;
    
    if ( MyDiv.length > 0 )
    {
        HideDiv( MyDiv );
    }
}


var xmlhttp;
function loadXMLDoc(LINK)
{ 
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=Process; 
  var url="http://localhost:1599/EmailList/AutoComplete.aspx?Link="+ LINK;
  xmlhttp.open("GET",url,false);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}




function Process()
{			if (xmlhttp.readyState == 4)  
    {   
    if (xmlhttp.status == 200) 	
      {			
       	if(xmlhttp.responseText=="")	
       		HideDiv("autocomplete");
       	else			
       	{	
        	document.getElementById("autocomplete").innerHTML=""	
       		ShowDiv("autocomplete");	 
       		document.getElementById("autocomplete").innerHTML =xmlhttp.responseText;}}	
       		else {document.getElementById("autocomplete").innerHTML="There was a problem retrieving data:"+xmlhttp.statusText;	
       		
       		}	
       		}}
       		
       		function ShowDiv(divid)
       		 { 
       		   if (document.layers) document.layers[divid].visibility="show"; 
       		     else document.getElementById(divid).style.visibility="visible";}
       		     
       		     function HideDiv(divid) {  
       		      if (document.layers) document.layers[divid].visibility="hide";  
       		       else document.getElementById(divid).style.visibility="hidden";}
       		      
       		       function BodyLoad(){	HideDiv("autocomplete");	
       		       document.form1.address.focus();}
       		       
       		       
   