/////////////////////////////////////////////////////////////////////////////////////////

var xmlHttp1 = createXmlHttpRequestObject(); 

function createXmlHttpRequestObject() 

{	

  var xmlHttp1;

  if(window.ActiveXObject)

  {

    try

    {

      xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");

    }

    catch (e) 

    {

      xmlHttp1 = false;

    }

  }

  else

  {

    try 

    {

      xmlHttp1 = new XMLHttpRequest();

    }

    catch (e) 

    {

      xmlHttp1 = false;

    }

  }

  if (!xmlHttp1)

 

    alert("Error creating the XMLHttpRequest object.");

  else 

    return xmlHttp1;

}

function LoadStateCP()

{

  if (xmlHttp1.readyState == 4 || xmlHttp1.readyState == 0)

  {

	idStateCP = document.getElementById("CareProvider").value;

    xmlHttp1.open("GET", "loadState.php?id="+idStateCP+"&sel=1", true);  

    xmlHttp1.onreadystatechange = handleServerResponse1;

    xmlHttp1.send(null);

  }

  else setTimeout("LoadStateCP()", 1000);

}

function handleServerResponse1() 

{

  if (xmlHttp1.readyState == 4) 

  {

    if (xmlHttp1.status == 200) 

    {

    xmlResponse1 = xmlHttp1.responseText;

//Care Provider

/** ------------ Profile Customization [start][ET] ----------- **/
	iCountSelected = 0;
	for (i=0; i < document.getElementById("CareProvider").options.length; i++)
	{
	    if (document.getElementById("CareProvider").options[i].selected)
	       iCountSelected++;
	}

	if ((xmlResponse1 == "0" || xmlResponse1 == 0) || (iCountSelected > 1) ) { 
/** ------------ Profile Customization [end][ET] ------------- **/

	document.getElementById("RowFormCP").style.display=""; 

	document.getElementById("RowFormSCP").style.display="none"; 

	document.getElementById("CPState").innerHTML='<select class=input_select name=StatePT[0]><option value=0>1</option></select>';

	}

	else { 

	document.getElementById("RowFormCP").style.display="none"; 

	document.getElementById("RowFormSCP").style.display=""; 

	document.getElementById("CPState").innerHTML =xmlResponse1;

		 }

	}

    else 

    {

      alert("There was a problem accessing the server: " + xmlHttp1.statusText);

    }

  }

}	

/////////////////////////////////////////////////////////////////////////////////////////
