﻿function GetXmlHttpObject()
{
var xmlHttp=null;

    try
    {
        // Firefox, Opera 8.0+, Safari
        
        xmlHttp=new XMLHttpRequest();
  
         //if (xmlHttp.overrideMimeType) {
            //xmlHttp.overrideMimeType('text/xml');
         //}  
    }
    catch (e)
    {
        // Internet Explorer
        
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    
    return xmlHttp;
}

function dropdown_add(e, index, val)
{
    if (!e)
        return;
        
    var o = document.createElement("option");
    o.text = val;
    o.value = index;
e.options[e.options.length]=o;
//    e.options.add(o);

    //fields["sel" + n].onchange = function(){
}

function dropdown_remove_all(e)
{
    if (!e)
        return;
        
    //alert("dropdown_remove_all: n = " + e.options.length);
    
    for (var i = e.options.length-1; i >=0; i--)
    {
        e.remove(i);
    }
}

function dropdown_select_item(e, i)
{
    if (!e)
        return;
        
    if (i < e.options.length)
        e.selectedIndex = i;
}

function dropdown_size(e)
{
    if (!e)
        return;
        
    return e.options.length;
}