/**
 * Make AJAX request and apply effect to response data
 *
 * @param string sURL
 * @param string sParams
 */

var bPositioned = false;

function vDoMenu(poMenu)
{
  var oCurrentMenu = $(poMenu);
  var oOtherMenu = (poMenu == 'language_menu') ? $('country_menu') : $('language_menu');

  if (!bPositioned) {
    var sCurrentList = oCurrentMenu.identify();
    var aOffset = $('list_'+sCurrentList).positionedOffset();
    oCurrentMenu.style.left = aOffset[0]+'px';
    oCurrentMenu.style.top = (aOffset[1] + 14)+'px';

    if (oOtherMenu != null) {
      var sOtherList = oOtherMenu.identify();
      aOffset = $('list_'+sOtherList).positionedOffset();
      oOtherMenu.style.left = aOffset[0]+'px';
      oOtherMenu.style.top = (aOffset[1] + 14)+'px';
    }

    bPositioned = true;
  }

  // Blind current menu
  if (!oCurrentMenu.visible())
  {
    new Effect.BlindDown(oCurrentMenu, {
      duration: 0.3,
      scaleFrom: 0,
      scaleTo: 100,
      beforeStart : function() {
        // Blind up other menu if visible
        if (oOtherMenu != null && oOtherMenu.visible()) {
          new Effect.BlindUp(oOtherMenu, {
            duration: 0.1
          });
        }

        // Set opacity and height
        oCurrentMenu.setOpacity(0.8);
        oCurrentMenu.style.height = oCurrentMenu.getHeight() + 'px';
      }
    });
  }
  else
  {
    new Effect.BlindUp(oCurrentMenu, {
      duration: 0.1
    });
  }
}
