var WindowZOrderCurr = 0;
//__isSSL = false; // values are 'true' or 'false'

// this is the custom hashtable class
Hashtable.prototype.hash 	 = null;
Hashtable.prototype.keys 	 = null;
Hashtable.prototype.location = null;

function Hashtable()
{
    this.hash = new Array();
    this.keys = new Array();
    this.location = 0;
}

Hashtable.prototype.get = function (key)
{
    return this.hash[key];
}

Hashtable.prototype.put = function (key, value)
{
    //if (value == null)
    //    return null;

	if (this.hash[key] == null)
		this.keys[this.keys.length] = key;

	this.hash[key] = value;
}
Hashtable.prototype.remove = function(key, value)
{
    alert(this.keys[key]);
}
// end custom hashtable class

var selectContrats = null;

function InitObjects()
{
    try
    {
        selectContracts = document.createElement("select");
        selectContracts.style.width = "150px";
        selectContracts.style.borderWidth = "1px";

        for ( var i = 0; i < contractsList.length; i++ )
        {
            var option      = document.createElement("option");
            option.text     = contractsList[index];
            option.value    = contractsList[index];
            selectContracts.options.add(option);
            
            if ( i = 0 ) option.selected = true;
        }
    }
    catch(ex)
    {
        if ( navigator.appName != "Microsoft Internet Explorer" ) console.error(ex);
    }
}

function createRow(table)
{
    var row = document.createElement('TR');
    table.appendChild(row);
    
    return row;
}

function createCell(row)
{
    var cell = document.createElement('TD');
    row.appendChild(cell);
    
    return cell;
}

function createDiv(id)
{
    var div = document.createElement("DIV");
    div.id = id;
    return div;
}


function createTable()
{
    var table = document.createElement("TABLE");
    var tbody = document.createElement("TBODY");
    table.appendChild(tbody);
    
    return tbody;
}

function CreateGraphWindow()
{
	var div, table, row, cell;

	div = document.createElement('DIV');
	
	table = document.createElement('TABLE');
	table.style.fontFamily = 'Verdana';
	table.style.fontSize = 'small';
	table.style.backgroundColor = '#BCCBE0';
	
	row = createRow(table);
	row.align = 'center';
	
	cell = createCell(row);
	
	cell.innerHTML = 'GOLD1KG';
	cell.style.width = '250px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#1579B4';
	cell.colspan = '4';
	
	row = createRow(table);	
	cell = createCell(row);
	cell.innerHTML = 'Last Trade Price';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Last Trade Time';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Bid Volume';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Bid';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Ask';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Ask Volume';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'High';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Low';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	row = createRow(table);
	cell = createCell(row);
	cell.innerHTML = 'Open Intrest';
	//cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#AC976C';
	cell.align = 'Right';
	cell = createCell(row);
	cell.innerHTML = '';
	cell.style.width = '80px';
	cell.style.color = '#FFF'
	cell.style.backgroundColor = '#FFF';
	
	table1 = document.createElement('TABLE');
	row = createRow(table1);
	row.align = 'center';
	
	cell = createCell(row);
	cell.style.width = '250px';
	cell.valign = 'top';
	cell.appendChild(table)
	
	cell = createCell(row);
	cell.innerHTML = '<img src="imgs/cbg.jpg" alt="imgs/cbg.jpg"/>';
	
	div.appendChild(table1); 
	
	document.getElementById('wndGraphContent').innerHTML = div.innerHTML;
	document.getElementById('wndGraph').style.visibility = 'visible';
}

