var xmlHttp

function Addadvice(str){ 
  if (str) {
    str = str.replace(/\'/g, "\'")
    str = str.replace(/\"/g, "\"")
    str = str.replace(/\$/g, "\$")
    str = str.replace(/\#/g, "\#")
    str = str.replace(/\?/g, "\?")
  }else{
    alert ("Please input Advice. ")
    return false
  }
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null) {
     alert ("Browser does not support HTTP Request")
     return false
  }
  var formdata = "query="+str
  var url="http://www.technovatetranslations.com/advice.php"
  xmlHttp.onreadystatechange=stateChanged 
  xmlHttp.open("POST",url,true)
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
  xmlHttp.send( formdata )
}

function stateChanged() {
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
    alert("Advice added!")
  } 
}

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;
}

