popupOFF = function(popup){  $('#'+popup).fadeOut('slow');  $('#background_'+popup).fadeOut('fast');  return false;}fadeOFF= function(popup){  setTimeout(function(){    $('#'+popup).fadeOut('slow');    $('#background_'+popup).fadeOut('fast');    return false;  }, 5000);}webinarvoteDone = function(id){    var bckgrnd_voteWidth = $('#bckgrnd_vote'+id).width();    if(bckgrnd_voteWidth<333){      bckgrnd_voteWidth++;    }    $('#bckgrnd_vote'+id).css({        'width' : bckgrnd_voteWidth    });    var count_vote= $('#count_vote'+id).text();    count_vote=parseInt(count_vote)+1;    $('#count_vote'+id).html(count_vote);    return false;}popupON = function(popup){  $('#background_'+popup).fadeIn('fast');  $('#'+popup).fadeIn('fast');  var windowWidth = document.documentElement.clientWidth;  var windowHeight = document.documentElement.clientHeight;  var popupHeight = $('#'+popup).height();  var popupWidth = $('#'+popup).width();  $('#'+popup).css({      'position': 'fixed',      'top': windowHeight/2-popupHeight/2,      'left': windowWidth/2-popupWidth/2  });  return false;}$(document).ready(function(){  $("#clickfootnote").click(function(){$("#footnote").slideToggle("slow");return false;});  $('#background_popup_mention_done').click(function(){    $('#popup_mention_done').fadeOut('slow');    $('#background_popup_mention_done').fadeOut('fast');    return false;  });  $('#background_popup_webinar_new_theme_done').click(function(){    $('#popup_webinar_new_theme_done').fadeOut('slow');    $('#background_popup_webinar_new_theme_done').fadeOut('fast');    return false;  });  $('#background_popup_webinar_question_done').click(function(){    $('#popup_webinar_question_done').fadeOut('slow');    $('#background_popup_webinar_question_done').fadeOut('fast');    return false;  });  $('#background_popup_webinar_vote_done').click(function(){    $('#popup_webinar_vote_done').fadeOut('slow');    $('#background_popup_webinar_vote_done').fadeOut('fast');    return false;  });  $('#background_popup_reg_done').click(function(){    $('#popup_reg_done').fadeOut('slow');    $('#background_popup_reg_done').fadeOut('fast');    return false;  });  $('#background_popup_activate_done').click(function(){    $('#popup_activate_done').fadeOut('slow');    $('#background_popup_activate_done').fadeOut('fast');    return false;  });  $('#background_popup_rempass_done').click(function(){    $('#popup_rempass_done').fadeOut('slow');    $('#background_popup_rempass_done').fadeOut('fast');    return false;  });  $('#background_popup_rempass_false').click(function(){    $('#popup_rempass_false').fadeOut('slow');    $('#background_popup_rempass_false').fadeOut('fast');    return false;  });  $('#background_popup_profile_done').click(function(){    $('#popup_profile_done').fadeOut('slow');    $('#background_popup_profile_done').fadeOut('fast');    return false;  });  var options = {    target: "#output_ajax",    timeout: 3000  };  $('#mentionForm').submit(function() {    $(this).ajaxSubmit(options); return false;  });  $('#newthemeForm').submit(function() {    $(this).ajaxSubmit(options); return false;  });// ************** Валидация форм *************  $.validator.addMethod("testFio", function(val){    if (val == 'Ф.И.О.') return false;    return true;  }, "Недопустимое значение");  $.validator.addMethod("testEmail", function(val, el, len){    if (val.length > len) return false;    return /^[a-z0-9_\-.]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i.test(val);  }, "Нужен корректный E-mail адрес!");  $.validator.addMethod("testPas", function(val){    if (val == 'пароль') return false;    return true;  }, "Недопустимое значение");  $.validator.addMethod("testTel", function(val){    if (val == 'телефон') return false;    return true;  }, "Недопустимое значение");  $("#regForm").validate({    submitHandler: function(form) {      $(form).ajaxSubmit(options);    },    focusInvalid:false,    rules: {      fio: {required: true, testFio: true, rangelength: [3, 30]},      pass: {required: true, testPas: true, rangelength: [5, 12]},      email: {required: true, testEmail: 50, remote: SITE_URL+"check_reg_email/"},      phone: {required: true, testTel: true, rangelength: [7, 30]}    },    messages: {      fio: {required: "Укажите Ф.И.О.!", testFio: "Укажите Ф.И.О.!", rangelength: "Не менее 3 и не более 30 символов"},      pass: {required: "Укажите пароль!", testPas: "Укажите пароль!", rangelength: "Не менее 5 и не более 12 символов"},      email: {required: "Нужно указать e-mail адрес!", testEmail: "Нужен корректный E-mail адрес!", remote : "Такой e-mail уже существует!"},      phone:{required: "Укажите номер телефона!", testTel:"Укажите номер телефона!", rangelength: "Не менее 7 и не более 30 символов"}    },    errorPlacement: function(error, element) {      var er = element.attr("name");      error.appendTo( element.parent().find("#"+er+"_out"));    }  });  $("#authorizationForm").validate({    focusInvalid:false,    rules: {      email: {required: true, testEmail: 50}    },    messages: {      email: {required: "Нужно указать e-mail адрес!", testEmail: "Нужен корректный E-mail адрес!"}    },    errorPlacement: function(error, element) {      var er = element.attr("name");      error.appendTo( element.parent().find("#"+er+"_out"));    }  });  $("#rempassForm").validate({    submitHandler: function(form) {      $(form).ajaxSubmit(options);    },    focusInvalid:false,    rules: {      email: {required: true, testEmail: 50, remote: SITE_URL+"check_rem_email/"}    },    messages: {      email: {required: "Нужно указать e-mail адрес!", testEmail: "Нужен корректный E-mail адрес!", remote : "Такой e-mail не зарегистрирован!"}    },    errorPlacement: function(error, element) {      var er = element.attr("name");      error.appendTo( element.parent().find("#"+er+"_out"));    }  });  $("#profileForm").validate({    submitHandler: function(form) {      $(form).ajaxSubmit(options);    },    focusInvalid:false,    rules: {      fio: {required: true, testFio: true, rangelength: [3, 30]},      pass: {required: true, testPas: true, rangelength: [5, 12]},      email: {required: true, testEmail: 50, remote: SITE_URL+"check_profile_email/"},      phone: {required: true, testTel: true, rangelength: [7, 30]}    },    messages: {      fio: {required: "Укажите Ф.И.О.!", testFio: "Укажите Ф.И.О.!", rangelength: "Не менее 3 и не более 30 символов"},      pass: {required: "Укажите пароль!", testPas: "Укажите пароль!", rangelength: "Не менее 5 и не более 12 символов"},      email: {required: "Нужно указать e-mail адрес!", testEmail: "Нужен корректный E-mail адрес!", remote : "Такой e-mail уже существует!"},      phone:{required: "Укажите номер телефона!", testTel:"Укажите номер телефона!", rangelength: "Не менее 7 и не более 30 символов"}    },    errorPlacement: function(error, element) {      var er = element.attr("name");      error.appendTo( element.parent().find("#"+er+"_out"));    }  });});