var streamObject;

function fnSubmitNewsLetter(){
    var tmpName = "";
    var tmpEmail = "";
    var tmpPhone = "";
    var tmpIndustry = "";
    
    tmpName = document.getElementById("uName").value;
    tmpEmail = document.getElementById("uEmail").value;
    tmpPhone = document.getElementById("uPhone").value;
    tmpIndustry = document.getElementById("uIndustry").value;
    
    fnSaveNewsLetter(tmpName,tmpEmail,tmpPhone,tmpIndustry);
}

function fnSaveNewsLetter(uName,uEmail,uPhone,uIndustry){ 
streamObject=GetstreamObjectObject();
if (streamObject==null)
  {
  alert ("Object could not be created.");
  return;
  } 
    document.getElementById("TopBand_Newsletter_Panel").innerHTML = "<br/><br/><span class=\"saveError\">Saving data. Please wait ....</span>";
    var contentURL="/HTML/Ajax_Pages/Ajax_SaveNewsletter.aspx?name=" + uName + "&email=" + uEmail + "&phone=" + uPhone + "&industry=" + uIndustry + "&rnd=" + Math.random();
    streamObject.onreadystatechange=fnSaveNewsLetterResponse;
    streamObject.open("GET",contentURL,true);
    streamObject.send(null);
}

function fnGetTestimonialRecord(whId){ 
streamObject=GetstreamObjectObject();
if (streamObject==null)
  {
  alert ("Object could not be created.");
  return;
  } 
    loadingPanel.show('Retrieving testimonial data ..');
    var contentURL="/HTML/Ajax_Pages/Ajax_Testimonial.aspx?recordId=" + whId;
    streamObject.onreadystatechange=fnPageContent;
    streamObject.open("GET",contentURL,true);
    streamObject.send(null);
}

function fnGetNewsRecord(whId){ 
streamObject=GetstreamObjectObject();
if (streamObject==null)
  {
  alert ("Object could not be created.");
  return;
  } 
    loadingPanel.show('Retrieving news data ..');
    var contentURL="/HTML/Ajax_Pages/Ajax_News.aspx?recordId=" + whId;
    streamObject.onreadystatechange=fnPageContent;
    streamObject.open("GET",contentURL,true);
    streamObject.send(null);
}

function fnGetGroupRecord(whId){ 
streamObject=GetstreamObjectObject();
if (streamObject==null)
  {
  alert ("Object could not be created.");
  return;
  } 
    loadingPanel.show('Retrieving company data ..');
    var contentURL="/HTML/Ajax_Pages/Ajax_Group.aspx?recordId=" + whId;
    streamObject.onreadystatechange=fnPageContent;
    streamObject.open("GET",contentURL,true);
    streamObject.send(null);
}

function fnPageContent() 
{ 
    //document.getElementById("AjaxContent").innerHTML="<img src=\"/HTML/Images/Loading.gif\" />";
    if (streamObject.readyState==4)
    { 
        document.getElementById("AjaxContent").innerHTML=streamObject.responseText;
        loadingPanel.hide();
    }
}

function fnSaveNewsLetterResponse() 
{ 
    //document.getElementById("AjaxContent").innerHTML="<img src=\"/HTML/Images/Loading.gif\" />";
    if (streamObject.readyState==4)
    { 
        document.getElementById("TopBand_Newsletter_Panel").innerHTML=streamObject.responseText;
    }
}

function GetstreamObjectObject()
{
var streamObject=null;
try
  {
  streamObject=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
        streamObject=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    streamObject=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return streamObject;
}
