//
// Copyright © Anygraaf Oy. All rights reserved.
//

var AjaxUrl = "http://www.karjalainen.fi/scripts/edoris/edoris.dll?";
var Ajax = new AgAjax(AjaxUrl);

function MyQuery(template, element, async)
{
	bAsync = false;
	if ( AgIsSet(async) )
		bAsync = async;
	Ajax.Query(Array("tem"), Array(template), bAsync, ProcessQuery, element); 
}

function ArrayQuery(keys, values, element, async)
{
	bAsync = true;
	if ( AgIsSet(async) )
		bAsync = async;
	Ajax.Query(keys, values, bAsync, ProcessQuery, element); 
}

function ProcessQuery(xmlHttp, funcAttributes)
{
	var updateElem = document.getElementById(funcAttributes);
	if ( AgIsSet(updateElem) ) {
		updateElem.innerHTML = xmlHttp.responseText;
	}
}

function SubmitSuggestion()
{
	var mySuggestion = document.SuggestForm.name.value;
	if ( mySuggestion != "" )
		ArrayQuery(Array("tem","suggestion","encoding"), Array("poll_suggest",mySuggestion,"UTF-8"), "suggestion_feedback", true);
	return false;
}
