function AjaxWait(show)
    {
    var obj=document.getElementById('AjaxWaitDiv');
    if (show==1) {obj.style.display=''; obj.style.visibility='visible';} else {obj.style.display='none'; obj.style.visibility='hidden';}
    }

function GetIdent(form)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return false;
	 }
	var url="ajax.php";
	url=url+"?t=ident&q="+form.IDENTIFIANT.value;
	xmlHttp.open("GET",url,true)
	xmlHttp.onreadystatechange=stateChangedIdent;
	xmlHttp.send(null)

}

function stateChangedIdent()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {
	 document.getElementById("ExistIdent").value=eval(xmlHttp.responseText);
	 }
}

function GetEmail(form)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return false;
	 }
	var url="ajax.php";
	url=url+"?t=email&q="+form.EMAIL.value;
	xmlHttp.onreadystatechange=stateChangedEmail;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedEmail()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {
	 document.getElementById("ExistEmail").value=eval(xmlHttp.responseText);
	 }
}

function GetPortfolioId(form)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return false;
	 }
	var url="ajax.php";
	url=url+"?t=portfolio&cli="+form.ID_CLIENT.value+"&cpt="+form.ID_COMPTE.value+"&tpl="+form.ID_TPL.value;
	xmlHttp.onreadystatechange=stateChangedPortfolio;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedPortfolio()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {
 	 AjaxWait(0);
	 document.getElementById("portfolio_tpl").innerHTML=xmlHttp.responseText;
         }
}

function GetOrderBook(mnemo)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return false;
	 }
	var url="ajax.php";
	url=url+"?t=orderbook&mnemo="+mnemo;
	xmlHttp.onreadystatechange=stateChangedOrderBook;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedOrderBook()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {
 	 AjaxWait(0);
         document.getElementById("orderbook").innerHTML=xmlHttp.responseText;
         }
}

function GetLastTransac(mnemo)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return false;
	 }
	var url="ajax.php";
	url=url+"?t=lasttransac&mnemo="+mnemo;
	xmlHttp.onreadystatechange=stateChangedLastTransac;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedLastTransac()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 {
	 document.getElementById("lasttransac").innerHTML=xmlHttp.responseText;
 	 AjaxWait(0);
         }
}

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;
}

function HideCours()
{
    document.getElementById("txtHint").style.visibility = "hidden";
}
