// Напоминание пароля
function sendpass(){
$("#butclose").hide();
okmes('Напоминание пароля
');
}
// end Напоминание пароля
// Транслит английских букв в русские и наоборот
// Если с английского на русский, то передаём вторым параметром true.
transliterate = (
function(){
var
rus = "щ Щ ш Ш Ч ч ц ю я ё ж Ж ъ ы э а б в г д е з и й к л м н о п р с т у ф х ц ь".split(/ +/g),
eng = "sch Sch sh Sh Ch ch cz yu ya yo zh Zh `` y' e` a b v g d e z i j k l m n o p r s t u f x c `".split(/ +/g);
return function(text, engToRus){
var x;
for(x = 0; x < rus.length; x++){
text = text.split(engToRus ? eng[x] : rus[x]).join(engToRus ? rus[x] : eng[x]);
text = text.split(engToRus ? eng[x].toUpperCase() : rus[x].toUpperCase()).join(engToRus ? rus[x].toUpperCase() : eng[x].toUpperCase());
}return text;}})();
// end Транслит английских букв в русские и наоборот
// Работа с cookie
function createCookie(name,value,days){
var expires=""; if(days){var date=new Date();date.setTime(date.getTime() + (days*86400*1000));expires="; expires=" + date.toUTCString();}
document.cookie=name + "=" + value + expires + "; path=/";
}
function readCookie(name){
var nameEQ=name + "="; var ca=document.cookie.split(';');
for(var i=0;i < ca.length;i++){var c=ca[i];while(c.charAt(0)==' ') c=c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
return null;
}
function eraseCookie(name){createCookie(name,"",-1);}
// end Работа с cookie
// Отправка формы
function sendform(e){
var send=true;
// Проверка обязательных полей
$("#"+e).find('.obz').each(function(){if(!$(this).val()){
$(this).addClass("migborder");setTimeout(function(){$("*").removeClass("migborder");}, 5000);
errmes("Не все поля формы заполнены");
send=false;}});
if(send==true){
$(".control").prop('disabled', true).css({"cursor":"auto"});
$.ajax({type: "POST", url: "/postfunc.php", data: $("#"+e).serialize(), success: function(response){
if(response.indexOf("") !=-1){okmes(response);}
else{if(response.search('')!=-1){closemessage();$("#notice").html(response);}else{errmes(response);}}
$(".control").prop('disabled', false).css({"cursor":"pointer"});
//alert(response);
},error: function(response){errmes("Возникла ошибка при отправке формы.
Попробуйте еще раз");$(".control").prop('disabled', false).css({"cursor":"pointer"});}
});}}
// end Отправка формы