function getCookie(name) {
 var dc = document.cookie;
 var prefix = name + "=";
 var begin = dc.indexOf("; " + prefix);
 if (begin == -1) 
 {
  begin = dc.indexOf(prefix);
  if (begin != 0) return null;
 } else begin += 2;
 
 var end = document.cookie.indexOf(";", begin);
 if (end == -1) end = dc.length;
 return unescape(dc.substring(begin + prefix.length, end));
}

function checkregistration()
{
 if (((!this.registration.reg_num_id.value)|| (!this.registration.user_email.value)|| (!this.registration.user_password.value) || (!this.registration.user_password_retype.value))) {alert("Не все обязательные поля заполнены!"); return false;}
 if (this.registration.user_password.value!=this.registration.user_password_retype.value) {this.registration.user_password.focus();alert("Введённые пароли не совпадают!!"); return false;} 
 s=this.registration.user_email.value;
 if (s.indexOf('@',0)==-1)  {this.registration.user_email.focus(); alert('Неправильно введён адрес электронной почты!'); return false}; 
 if (this.registration.reg_num_id.value!=getCookie('reg_num_id')) {this.registration.reg_num_id.focus(); alert ('Неправильно введены цифры с картинки!'); return false;};
 return true;
}

function checkprofile()
{
 if ((!this.registration.user_email.value) || (!this.registration.user_password.value)) {alert("Не все обязательные поля заполнены!"); return false;}
 if (this.registration.user_password.value!=this.registration.user_password_retype.value) {this.registration.user_password.focus();alert("Введённые пароли не совпадают!!"); return false;} 
 s=this.registration.user_email.value;
 if (s.indexOf('@',0)==-1)  {this.registration.user_email.focus(); alert('Неправильно введён адрес электронной почты!'); return false}; 
 return true;
}

function checkauthorisation()
{
 if ((!this.authorisation.login.value)|| (!this.authorisation.password.value)) {alert("Не все обязательные поля заполнены!"); return false;}
 return true;
}


