//action script
//Author: Allan Betschart
////////////////////////////////////JS Button functions/////////////////////////////
function getLang()
{
  var cls=new newClass("SLAL.actions");
  var meth=new cls.insertMethod("getLang");
  XMLexchange(cls.xmlDoc,null,GET,null);
}
function guiLoaded()
{
  var cls=new newClass("SLAL.actions");
  var meth=new cls.insertMethod("guiLoaded");
  XMLexchange(cls.xmlDoc,null,GET,null);
}
function getExch()
{
  //popDialog('titleWait','textWait','wait');
  var cls=new newClass("SLAL.actions");
  var meth=new cls.insertMethod("getExch");
  XMLexchange(cls.xmlDoc,null,GET,null);
}
function showExch(obj)
{ 
  doc.getElementById('exch').value=' ';
  doc.getElementById('exch').focus();
  return false;
}
function doSearch()
{
  if ((doc.getElementById('exch').value.length > 2)&&((doc.getElementById('sym').value.length > 0)||
      (doc.getElementById('isin').value.length > 0)||(doc.getElementById('cusip').value.length > 0)))
  {
    //doc.getElementById('history').style.display="none";
    popDialog('titleWait','textWait2','wait');
    var cls=new newClass("SLAL.actions");
    var meth=new cls.insertMethod("getInfo");
    meth.insertParam("String",doc.getElementById('sym').value.toUpperCase());
    meth.insertParam("String",doc.getElementById('isin').value.toUpperCase());
    meth.insertParam("String",doc.getElementById('exch').value.toUpperCase());
    meth.insertParam("String",doc.getElementById('cusip').value.toUpperCase());
    XMLexchange(cls.xmlDoc,null,GET,null);
  }
  else
    {popDialog('titleError','textError1','ok');}
}
function doHist()
{
  popDialog('titleWait','textWait2','wait');
  var cls=new newClass("SLAL.actions");
  var meth=new cls.insertMethod("getHist");
  meth.insertParam("String",doc.getElementById('resCon').value);
  XMLexchange(cls.xmlDoc,null,GET,null);
}
function doConID(conID)
{
  makeDialog();
  slbTxt.innerHTML="<center>Querying server for availability</center><br/>"+
                   "<center><div style=\""+
                   "position:relative;height:16px;width:16px;background:url('http://www.interactivebrokers.com/webtms/ibslb/images/loadSml.gif');"+
                   "\"></div></center>";
  slbDiv.style.display="block";
  var cls=new newClass("SLAL.actions");
  var meth=new cls.insertMethod("getConInfo");
  meth.insertParam("String",conID);
  XMLexchange(cls.xmlDoc,null,GET,null);
  return false;
}
var slbDiv=null;
var slbTxt=null;
////////////////////////////////////JS Button functions/////////////////////////////
function makeDialog()
{
  if (slbDiv == null)
  {
    initDrag(0,0);
    var hold=doc.getElementById('mainBody');
var w = window.ActiveXObject ? 250 : 264 ;
    var div=doc.createElement('div');
    div.innerHTML="<div style='cursor:move;width:"+w+"px;border: solid 1px #CCC'><img onmousedown='dragIt(event,this,slbDiv);' "+
                  "src='http://www.interactivebrokers.com/webtms/ibslb/images/titleHeaderMiddle.gif' "+
                  "width='100%' height='10px'/></div>";
    var divT=doc.createElement('div');
    div.style.width="250px"; 
    divT.style.width="250px"; 
    div.style.position="absolute";
    div.style.zIndex="99";
    divT.style.border="ridge 3px #CCC";
    divT.style.background="#FFF";
    divT.style.padding="5px";
    div.appendChild(divT);
    hold.appendChild(div);
    slbTxt=divT;
    slbDiv=div;
  }
  slbDiv.style.left="42%";
  slbDiv.style.top=(doc.body.scrollTop+250)+"px";
  slbDiv.style.display="block";
  slbDiv.style.display="none";
  slbDiv.style.display="block";
}

