function addClass(o, c){
  var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g")
  if (re.test(o.className)) return
  o.className = (o.className + " " + c).replace(/\s+/g, " ").replace(/(^ | $)/g, "")
}

function removeClass(o, c){
  var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g")
  o.className = o.className.replace(re, "$1").replace(/\s+/g, " ").replace(/(^ | $)/g, "")
}

function menu_du(img_id) {
  var id = img_id.replace('img','');
  if (document.getElementById('ul'+id) != null) {
    if (document.getElementById('ul'+id).className != 'products_child is_show') {
      removeClass(document.getElementById('ul'+id), 'is_hidden');
      addClass(document.getElementById('ul'+id), 'is_show');
      addClass(document.getElementById('a'+id), 'menu-down-is');
      removeClass(document.getElementById('img'+id), 'bull-left');
      addClass(document.getElementById('img'+id), 'bull-down');
    } else {
      removeClass(document.getElementById('ul'+id), 'is_show');
      addClass(document.getElementById('ul'+id), 'is_hidden');
      removeClass(document.getElementById('a'+id), 'menu-down-is');
      removeClass(document.getElementById('img'+id), 'bull-down');
      addClass(document.getElementById('img'+id), 'bull-left');
    }
  }
  return false;
}

function upclick(obj) {
  //alert($(obj).parents('div:eq(0)').children('input').css('display'));
  if ($(obj).parents('div:eq(0)').children('input').css('display')=='none') {
    $(obj).parents('div:eq(0)').children('input').show(300);
  } else {
    var postdata = $(obj).parents('div:eq(0)').children('input').val();
    $.ajax({
      type: "POST",
      url: '/ajax/updates/show.htm',
      cache:false,
      data: 'key='+postdata,
      success: function(answ) {
        $(obj).parents('div:eq(0)').empty().html(answ); 
      }
    });
    
  }
  
  return false;
}


