hash = new Array();

function getLeft(element) {
  var iPos = 53;
  while (element!=null) {
    iPos+=element.offsetLeft;
    element = element.offsetParent;
  }
  return iPos;
}

function getTop(element) {
  var iPos = -220;
  while (element!=null) {
    iPos+=element.offsetTop;
    element = element.offsetParent;
  }
  return iPos;
}

function OpenSubMenu( parent, menu )
{
//  document.getElementById(menu).style.left = getLeft(document.getElementById(parent));
//  document.getElementById(menu).style.top = getTop(document.getElementById(parent)) + document.getElementById(parent).offsetHeight;
  document.getElementById(menu).style.visibility = "visible";
  hash[ menu ] = true;
}

function CloseSubMenu( menu )
{
  setTimeout( "HideSubMenu('" + menu + "');", 100 );
  hash[ menu ] = false;
}
     
function HideSubMenu( menu )
{
  if( !hash[ menu ] )
  {
    document.getElementById(menu).style.visibility = "hidden";
  }
}

function Validate() {
  if (document.fo.company.value == "" || document.fo.name.value == "" || document.fo.doljnost.value == "" || document.fo.phone.value == "") {
    alert ("Вы не заполнили необходимые поля");
    return false;
  }
}

function Validate1() {
  if (document.fo.company.value == "" || document.fo.name.value == "" || document.fo.status.value == "" || document.fo.phone.value == "" || document.fo.mail.value == "" || document.fo.message.value == "") {
    alert ("Вы не заполнили необходимые поля");
    return false;
  }
}

function Validate2() {
  if (document.fo.bank.value == "" || document.fo.company.value == "" || document.fo.name.value == "" || document.fo.phone.value == "" || document.fo.fax.value == "" || document.fo.phone.value == "" || document.fo.mail.value == "" || document.fo.message.value == "") {
    alert ("Вы не заполнили необходимые поля");
    return false;
  }
}

function Validate3() {
  if (document.fo.bank.value == "" || document.fo.company.value == "" || document.fo.name.value == "" || document.fo.phone.value == "" || document.fo.mail.value == "" || document.fo.message.value == "") {
    alert ("Вы не заполнили необходимые поля");
    return false;
  }
}

function check_length(){
		total=parseInt(document.form.local_man.value) + parseInt(document.form.near_man.value) + parseInt(document.form.far_man.value);
		document.form.total_man.value = total;
		document.form.l_man.value=parseInt(document.form.local_man.value);
		document.form.n_man.value=parseInt(document.form.near_man.value);
		document.form.f_man.value=parseInt(document.form.far_man.value);
//		if(total%30==0){
//			document.form.pri.value = total/30;
//		}else{
//			document.form.pri.value = Math.ceil(total/30);
//		}
	}

