function verify()
{
	if (document.forma.clogin.value.length<5) {
		alert('Логин не должен быть меньше 5 символов');
        document.forma.clogin.focus();
		return false;
		}
	else if (document.forma.cpass.value.length<5) {
		alert('Пароль не должен быть меньше 5 символов');
        document.forma.cpass.focus();
		return false;
		}
	else if (document.forma.cpass.value.length!=document.forma.cpass1.value.length) {
		alert('Пароли не совпадают');
        document.forma.cpass.focus();
		return false;
		}
	else if (document.forma.cmail.value.length<5) {
		alert('E-mail не должен быть меньше 5 символов');
        document.forma.cmail.focus();
		return false;
		}
	else if (document.forma.cfam.value.length<2) {
		alert('Неверная фамилия');
        document.forma.cfam.focus();
		return false;
		}
	else if (document.forma.caddres.value.length<5) {
		alert('Неверный адрес');
        document.forma.caddres.focus();
		return false;
		}
	else if (document.forma.ctel.value.length<7) {
		alert('Телефон указан неверно');
        document.forma.ctel.focus();
		return false;
		}
}

function verify1()
{
	if (document.forma1.opf.value.length<2) {
		alert('Организационно-правовая форма указана неверно');
        document.forma1.opf.focus();
		return false;
		}
    else if (document.forma1.clogin.value.length<2) {
		alert('Название фирмы указано неверно');
        document.forma1.clogin.focus();
		return false;
		}
	else if (document.forma1.cpass.value.length<5) {
		alert('Пароль не должен быть меньше 5 символов');
        document.forma1.cpass.focus();
		return false;
		}
	else if (document.forma1.cpass.value!=document.forma1.cpass1.value) {
		alert('Пароли не совпадают');
        document.forma1.cpass.focus();
		return false;
		}
	else if (document.forma1.inn.value.length<10) {
		alert('ИНН указан неверно');
        document.forma1.inn.focus();
		return false;
		}
	else if (document.forma1.ccity.value.length<2) {
		alert('Укажите город');
        document.forma1.ccity.focus();
		return false;
		}
	else if (document.forma1.cstreet.value.length<2) {
		alert('Укажите улицу');
        document.forma1.cstreet.focus();
		return false;
		}
	else if (document.forma1.cdom.value.length<1) {
		alert('Укажите дом');
        document.forma1.cdom.focus();
		return false;
		}
    else if (document.forma1.cofis.value.length<1) {
		alert('Укажите офис');
        document.forma1.cofis.focus();
		return false;
		}
    else if (document.forma1.ctel.value.length<1) {
		alert('Укажите телефон');
        document.forma1.ctel.focus();
		return false;
		}
	else if (document.forma1.cmail.value.length<5) {
		alert('E-mail не должен быть меньше 5 символов');
        document.forma1.cmail.focus();
		return false;
		}
}


	//  функция для кодирования URL
	function utf8_encode(string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return escape(utftext);
	}

	//  функция для декодирования URL
   	function utf8_decode(utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return unescape(string);
	}


