function _login_form_show()
{
  if ($("#l-login-window")[0].style.display == "")
  {
    window.setTimeout('$("#l-login-email").focus();', 300);
  }

  $("#l-login-window").fadeToggle(300);
}
document._login_form_show = _login_form_show;


function _login_form_submit(_form)
{
  _login_form_showError(false);

  $("#l-login-loading").show();

  $.post(_form.action, $(_form).serialize(), function(data) { $("#l-login-loading").fadeOut(1000); eval(data); });

  return false;
}

function _login_form_showError(_error)
{
  if (_error !== false)
  {
    $("#l-login-message").html(_error).show();

    window.setTimeout('$("#l-login-message").fadeOut(300);', 1000);
  }
  else
  {
    $("#l-login-message").hide();
  }
}

function __rotatingPhotosUpdate(_data)
{
  for (var i = 0; i < _data.length; i++)
  {
    var _o = _data[i];
    var _box = $("#l-rotating-photos .l-rotating-photo").eq(i);

    var _items = _box.find("a");
    if (_items.length > 1)
    {
      _items.eq(0).remove();
    }

    _box.append('<a style="display: none;" href="' + _o["url"] + '"><img src="' + _o["img"] + '" /></a>');

    _items = _box.find("a");
    if (_items.length > 1)
    {
      _items.eq(0).fadeOut(1000);
    }

    _items.eq(-1).fadeIn(1000);
  }
}

function __resize()
{
  var _max = 530;

  $("#l-overlay-white-shade").height(Math.max(_max, $(document).height() - 20));
  $("#l-curtains-tile-l").height(Math.max(_max, $(document).height() - 10));
  $("#l-curtains-tile-r").height(Math.max(_max, $(document).height() - 10));
  $("#l-curtains-bottom-l").css('top', (Math.max(_max, $(document).height()) - 186) + 'px');
  $("#l-curtains-bottom-r").css('top', (Math.max(_max, $(document).height()) - 186) + 'px');
}

$(function() {
  __resize();

  window.setTimeout("__resize();", 500);

  window.setInterval("__resize();", 3000);

  $(window).resize(function() { __resize(); });
});

