$(document).ready(function()
{
 // code
 $(".email").each(function()
 {
  var e = $(this).attr("href") + "@" + $(this).text();
  $(this).text(e);
  $(this).attr("href", "mailto:" + e);
 }
 );
 // end code
}
);

function loadform(alias)
{
 $('#'+alias).ajaxForm(
 { 
  dataType:  'json', 
  success:   processJsonForm
 }
 );	
}

function processJsonForm(data)
{
 $("#inputresult").html(data.text);	
 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>");
}

function redraw_calendar(direction)
{
 $("#calendar_snake").append("<img src=\"/i/ajax/black.gif\" alt=\"\" width=\"16\" height=\"16\" />");
 $("#calendar").load("/calendar/",
 {
  direction: direction
 }
 );
}
