
if (window.XMLHttpRequest) {

  http = new XMLHttpRequest();

} else if (window.ActiveXObject) {

  http = new ActiveXObject("Microsoft.XMLHTTP");

}

function vastausveikko_search() {

	phrase = encodeURI(document.getElementById('phrase').value);
	nocache = Math.random();

	if (phrase) {
		http.open('get', 'vastausveikko_search_fi.php?phrase='+phrase+'&nocache = '+nocache);
		http.onreadystatechange = vastausveikko_answer;
	}

	http.send(null);

}

function vastausveikko_answer() {

	if (http.readyState == 4) {

		var response = http.responseText;
		document.getElementById('vastausveikko-answer').innerHTML = response;

	}

}

function vastausveikko_suggest_over(div_value) {

	div_value.className = 'vastausveikko_link_over';

}

function vastausveikko_suggest_out(div_value) {

	div_value.className = 'vastausveikko_link';

}

function vastausveikko_close() {

	document.getElementById('vastausveikko-answer').innerHTML = "";

}