function open_menu(id)
{
document.getElementById('menu_td'+id).style.display= '';
}

function close_menu(id)
{
    document.getElementById('menu_td'+id).style.display='none';
}

function switch_menu(id)
{
    if (document.getElementById('menu_td'+id).style.display=='none')
    document.getElementById('menu_td'+id).style.display= '';
    else
    document.getElementById('menu_td'+id).style.display='none';
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}




function showCities(obj){
    region_id=obj.value;
    document.forms['form1'].city_id.options.length = 0;
    var count=0;
    if(region_id=='0')
    {
        document.forms['form1'].city_id.options[0] = new Option("Вначале выберите регион","0");
        document.forms['form1'].city_id.disabled=true;
    }
    else
    {
    try {



     document.forms['form1'].city_id.disabled=false;
        if(region_id!='77' && region_id!='78')
        {
            document.forms['form1'].city_id.options[0] = new Option(document.forms['form1'].city_id_h.options[0].text,document.forms['form1'].city_id_h.options[0].value);
            count=1;
        }

        for(var i=1; i<=document.forms['form1'].city_id_h.length; i++)
        {
            if (document.forms['form1'].city_id_h.options[i].id=='r'+region_id)
            {
                document.forms['form1'].city_id.options[count] = new Option(document.forms['form1'].city_id_h.options[i].text,document.forms['form1'].city_id_h.options[i].value);
                count++;
            }
        }

        }
 catch (e) {

// ignore it

}


        }
 showMetro(document.forms['form1'].city_id);
}

 function showMetro(obj){

    city_id=obj.value;
    document.forms['form1'].metro_station_id.options.length = 0;
    var count=0;

    if(city_id=='0')
    {
        document.getElementById('metro_block').style.display='none';
    }
    else
    {
        document.forms['form1'].metro_station_id.options[0] = new Option(document.forms['form1'].metro_station_id_h.options[0].text,document.forms['form1'].metro_station_id_h.options[0].value);
         try {

        for(var i=1; i<=document.forms['form1'].metro_station_id_h.length; i++)
        {
            if (document.forms['form1'].metro_station_id_h.options[i].id=='c'+city_id)
            {
                document.forms['form1'].metro_station_id.options[count] = new Option(document.forms['form1'].metro_station_id_h.options[i].text,document.forms['form1'].metro_station_id_h.options[i].value);
                count++;
            }
        }
        }
catch (e) {

// ignore it

}

        if(count > 0)
        {
            document.getElementById('metro_block').style.display='';
        }
        else
        {
            document.getElementById('metro_block').style.display='none';
        }
    }
}