var inps = document.getElementsByTagName("input");
var changes;

for(i=inps.length-1; i>=0; i--)
{
	if(inps[i].type == 'text')
	{
		inps[i].title = inps[i].value;
		inps[i].onfocus = infield;
		inps[i].onblur = outfield;
		inps[i]._editted = 0;
		inps[i].onkeyup = changefield;
	}

	if (inps[i].type == 'radio')
		inps[i].checked = true;	
}

function infield()
{
	if (this.value == this.title)
		this.value = '';
}

function outfield()
{
	if (this.value == '')
		this.value = this.title;
}

function changefield()
{
	if (this.value == '')
		this._editted = 0;
	else
		this._editted = 1;
}

function check_form(ignore)
{
	if (ignore) {
		alert ('Вы уже отсылали анкету');
		return false;
	}
	for(i=inps.length-1; i>=0; i--)
		if(inps[i].type == 'text' && !inps[i]._editted ) {
			alert ("Ответьте, пожалуйста, на все вопросы анкеты." );
			return false;
		}
	return true;
}