$(document).ready(function()
{
 $(".email").each(function()
 {
  var e = $(this).attr("href") + "@" + $(this).text();
  $(this).text(e);
  $(this).attr("href", "mailto:" + e);
 }
 );
 drop_bottom();
}
);

function drop_bottom()
{  
 var screen_height = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
 var box = $("#box").height();
 height = Math.max(screen_height,box);
 if (screen_height>box) height = height-50; 
// alert(height);
 $("#box").css	
 (
  {
   height: height + "px"
  }
 );
}

function loadform(alias)
{
 $('#'+alias).ajaxForm(
 { 
  dataType:  'json', 
  success:   processJsonForm
 }
 );	
}

function processJsonForm(data)
{
 $("#inputresult").html("<div class=\"error\"><div class=\"errorpad\">"+data.text+"</div></div>");	
 if(data.done==1) 
 {
  $("#submit_data").attr("disabled","disabled");
  // ставим задержку, чтобы пользователь мог прочитать надпись
  setTimeout(function(){window.location = data.link;}, 2000);
 }
 else
 {
  $("#submit_data").attr("disabled","");	
 }
 $("#formajaxloader").empty();
}

function loadindicator()
{
 $("#formajaxloader").html("<div style=\"position:absolute;top:5px;left:50%;width:16px;height:16px\"><img src=\"/i/ajax/orange.gif\" width=\"16\" height=\"16\" alt=\"\" /></div>");
}
