function selectInput(id) {
	var inputObj = document.getElementById(id);
	if (inputObj != null) {
		inputObj.focus();
		return true;
	} else {
		return false;
	}
}

/* CheckWinnerName BEGIN */

var winner = null, 
	password = null, 
	password1 = null,
	error = null;

function CheckWinnerName() {
	if (winner == null) {winner = document.getElementById('winner');}
	if (password == null) {password = document.getElementById('password');}
	if (password1 == null) {password1 = document.getElementById('password1');}
	if (error == null) {error = document.getElementById('error');}

	if (winner.value == '') {
		error.innerHTML = 'Имя не может быть пустым';
		winner.focus();
		return false;
	}
	
	if (password.value == '') {
		error.innerHTML = 'Пароль не может быть пустым';
		password.focus();
		return false;
	}
	
	if (password.value != password1.value ) {
		error.innerHTML = 'Пароли не совпадают';
		password.focus();
		return false;
	}
	
	return true;
}

/* CheckWinnerName END */

function askNewGame() {
	return confirm('Начав тест заново, вы можете столкнуться как с '+
								'более легкими вопросами, так и с более тяжелыми. '+
								'Это уж как повезет.\n\n'+
								'Вы точно хотите пройти тест сначала?');
}

function openVote(qid, pointer, pic) {
	if (document.all)
	var xMax = screen.width, yMax = screen.height;
	else
		if (document.layers)
			var xMax = window.outerWidth, yMax = window.outerHeight;
		else
			var xMax = 640, yMax=480;
	
	
	//alert(pointer.href);

	if (pic) {
		var xOffset = (xMax - 400)/2, yOffset = (yMax - 510)/2;
		window.open('vote.php?qid='+qid,'voting','width=400,height=510,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	} else{
		var xOffset = (xMax - 300)/2, yOffset = (yMax - 220)/2;
		window.open('vote.php?qid='+qid,'voting','width=300,height=220,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes');
	}
}
