/*
	Created by Anatol Latotin | www.latotin.com
	Cipyright (c) 2006.10.10
*/

var delta = 0;
var direction;
var margin_top = 137;
var move_to = 137;
var stat = 'passive';
var form_status = 'view';

function sign(number) {
  document.all.flogin.style.display = 'none';
  var new_move = -137*number;
  if (new_move != move_to) {
    move_to = -137*number;
    if (move_to < margin_top) direction = 'top';
      else direction = 'bottom';
    delta = Math.abs( margin_top - 137*(1 - number) );
    motion();
  }
  return true;
}

function motion() {
  var step = Math.round( delta/3 );
  if (step > 1) {
    if (direction == 'top') margin_top -= step;
	  else margin_top += step;
      document.all.insignes.style.marginTop = margin_top;
      delta -= step;
	  setTimeout('motion()', 1);
  }
  else {
    margin_top = move_to + 137;
    document.all.insignes.style.marginTop = margin_top;
  }
  return true;
}

function on_menu() {
  stat = 'active';
}

function off_menu() {
  stat = 'passive';
  setTimeout('rem_sign()', 3);
  return true;
}

function rem_sign() {
  if (stat == 'passive') {
    document.all.insignes.style.marginTop = 137;
    delta = 0;
    direction;
    margin_top = 137;
    move_to = 137;
	if (form_status == 'view') document.all.flogin.style.display = '';
  }
  return true; 
}

function enter() {
  if (form_status == 'hidden') {
    document.all.flogin.style.display = '';
	form_status = 'view';
  }
  else {
    document.all.flogin.style.display = 'none';
	form_status = 'hidden';
  }
}
