/**
  * Used in sendaglamwire.php
  */

var site_host = "http://" + document.location.host;

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;
}

// Load language and voice drop-downs
function loadVoices(langid) {
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null) {
    alert ("Your browser does not support HTTP Requests.");
    return;
  } 
  var url=site_host + "/getvoices.php";
  url=url+"?lang=" + langid; // initialize to English
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=loadVoicesReady;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
} 

function loadVoicesReady() { 
  //document.getElementById("voice_select").innerHTML = 'Loading voices...';    
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
    document.getElementById("voice_select").innerHTML=xmlHttp.responseText;
  } 
}