// Функция проверки формы логина
function check_login_form(need_submit){
	var txt;
	var error;
	if(document.auth_form){
		error = false;
		// Проверяем форму логина
		txt	= String(document.auth_form.login.value);
		txt	= txt.replace(/^(\t|\s)+/g, '');
		if((txt.length < 3) || (txt == 'логин')){
			error = true;
			alert('Необходимо указать логин для входа');
			document.auth_form.login.parentNode.className = "error";
			document.auth_form.login.focus();
		}else{
			document.auth_form.login.parentNode.className = "";
		}
		document.auth_form.login.value = txt;
		txt	= String(document.auth_form.psw.value);
		txt	= txt.replace(/^(\t|\s)+/g, '');
		if(txt.length < 3){
			if(!error){
				error = true;
				alert('Необходимо указать пароль для входа');
			}
			document.auth_form.psw.parentNode.className = "error";
			document.auth_form.psw.focus();
		}else{
			document.auth_form.psw.parentNode.className = "";
		}
		document.auth_form.psw.value = txt;
		if(need_submit && !error){
			document.auth_form.submit();
			return false;
		}else{
			if(!need_submit && !error){
				return true;
			}else{
				return false;
			}
		}
	}
}

function enter_verify(event){
	if(event.keyCode == 13){
		check_login_form(true)
	}
	//event.keyCode = 0;
}

function over_field(obj){
	if(obj) obj.className = "over"
}

function leave_field(obj){
	if(obj) obj.className = "";
}

function focus_field(obj, name){
	if(obj){
		if(obj.value == name){
			obj.value = "";
		}
	}
}

function defocus_field(obj, name){
	if(obj){
		if(obj.value == ""){
			obj.value = name;
		}
	}
}


function show_next_hits(){
	obj	= document.getElementById('top10');
	if(obj){
		if(obj.childNodes.length > 3){
			for(var i=1; i<(obj.childNodes.length - 1); i++){
				if(obj.childNodes[i].style.display == 'block'){
					obj.childNodes[i].style.display = 'none';
					if((i+1) < (obj.childNodes.length - 1)){
						obj.childNodes[i + 1].style.display = 'block';
					}else{
						obj.childNodes[1].style.display = 'block';
					}
					break;
				}
			}
		}
	}
}