/* calls that are specific to commissions page */

function Field(name){
         this.name = name;
         this.value = null;
         this.hasContent = function(){ if (this.value == null){ return false; } else { return true; } }
         this.has_request_in_progress = false;
}

fields = new function(){
	 this.opt = new Field('opt');
	 this.fut = new Field('fut');
	 this.fop = new Field('fop');
	 this.stk = new Field('stk');
         this.etf = new Field('etf');
	 this.war = new Field('war');
	 this.vwap = new Field('vwap');
	 this.ssf = new Field('ssf');
	 this.fx = new Field('fx');
         this.ind = new Field('ind');
	 this.bond = new Field('bond');
         this.mf = new Field('mf');
         this.cfd = new Field('cfd');
         this.europe_opt = new Field('europe_opt');
	 this.asia_opt = new Field('asia_opt');
         this.europe_fut = new Field('europe_fut');
         this.asia_fut = new Field('asia_fut'); 
         this.europe_fop = new Field('europe_fop');
	 this.asia_fop = new Field('asia_fop');
         this.europe_stk = new Field('europe_stk');
	 this.asia_stk = new Field('asia_stk');
         this.europe_etf = new Field('europe_etf');
         this.asia_war = new Field('asia_war');
         this.europe_ssf = new Field('europe_ssf');
	 this.asia_ssf = new Field('asia_ssf');
	 this.europe_ind = new Field('europe_ind');
	 this.asia_ind = new Field('asia_ind');

         this.setSelected=function(s){
	   if (s == 'fut'){ this.selected = this.fut; }
           else if (s == 'fop'){ this.selected = this.fop; }
	   else if (s == 'stk'){ this.selected = this.stk; }
	   else if (s == 'etf'){ this.selected = this.etf; }
	   else if (s == 'war'){ this.selected = this.war; }
	   else if (s == 'vwap'){ this.selected = this.vwap; }
	   else if (s == 'ssf'){ this.selected = this.ssf; }
	   else if (s == 'fx'){ this.selected = this.fx; }
	   else if (s == 'bond'){ this.selected = this.bond; }
	   else if (s == 'mf'){ this.selected = this.mf; }
	   else if (s == 'ind'){ this.selected = this.ind; }
           else if (s == 'cfd'){ this.selected = this.cfd; }
           else if (s == 'europe_opt'){ this.selected = this.europe_opt; }
           else if (s == 'asia_opt'){ this.selected = this.asia_opt; }
	   else if (s == 'europe_fut'){ this.selected = this.europe_fut; }
	   else if (s == 'asia_fut'){ this.selected = this.asia_fut; }
	   else if (s == 'europe_fop'){ this.selected = this.europe_fop; }
           else if (s == 'asia_fop'){ this.selected = this.asia_fop; }
	   else if (s == 'europe_stk'){ this.selected = this.europe_stk; }
	   else if (s == 'asia_stk'){ this.selected = this.asia_stk; }
           else if (s == 'europe_etf'){ this.selected = this.europe_etf; }
	   else if (s == 'asia_war'){ this.selected = this.asia_war; }
	   else if (s == 'europe_ssf'){ this.selected = this.europe_ssf; }
	   else if (s == 'asia_ssf'){ this.selected = this.asia_ssf; }
	   else if (s == 'europe_ind'){ this.selected = this.europe_ind; }
           else if (s == 'asia_ind'){ this.selected = this.asia_ind; }
	   else { this.selected = this.opt; }
         }
}

function getdata(p, path, ib_entity)
{
	 if (xmlHttp)
	 {
	     try {
		xmlHttp.open("GET", path+"en/trading/exchange_product_data.php?p="+p+"&ib_entity="+ib_entity, true);
		xmlHttp.onreadystatechange = displaycontent;
		xmlHttp.send(null);
	     }
	     catch(e){}
	 }
}

function displaycontent()
{
	 try {
	     if (xmlHttp.readyState == 4)
	     {
		     fields.selected.value = xmlHttp.responseText;
		     content.innerHTML = trim(fields.selected.value);
	             fields.has_request_in_progress = false;
	     }
         } catch(e){alert(e)}
}
