/*
<?php
header('Content-type: text/html; charset=windows-1251');
?>
*/

/* не дать засабмитить пустой вопрос */
function SearchSubmit () {
	if ('' == document.forms.search.search.value) {
		return false;
	}
}

function CheckItOut () {
	if (document.indord.ordersum.value != '' && document.indord.ordersum.value != '0') {
		document.forms.indord.submit ();
		return true;
	} else {
		return false;
	}
}

// (C) Yandex
function RegisterEventHandler () {
	if (document.getElementById) {
		document.onkeydown = ParseKeyEvent;
	}
}

// (C) Yandex
function ParseKeyEvent (e) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;

	if ((code == 37) && (e.ctrlKey == true)) {
		var destination = document.getElementById('prev_page');
		if (destination) location.href = destination.href;
	}
	if ((code == 39) && (e.ctrlKey == true)) {
		var destination = document.getElementById('next_page');
		if (destination) location.href = destination.href;
	}
}

function AuthentificationError (error_code) {
	if (error_code == 1) {
		alert ('Пользователь с таким e-mail не зарегистрирован');
	} else if (error_code == 2) {
		alert ('Неверный пароль');
	}
}
