function DoPanelValidatation(form, failedText)
{
    var amount = -1;
    var otherIndex = -1;
    var checkedIndex = -1;
    for (var i=0; i < form.donateAmount.length; i++)
    {
        if(form.donateAmount[i].value < 0)
            otherIndex = i;
        if(form.donateAmount[i].checked)
            checkedIndex = i;
    }
    amount = form.donateAmount[checkedIndex].value;    
    if(otherIndex >= 0 && form.otherAmount.value != '')
    {
        form.donateAmount[otherIndex].checked = true;
        amount = form.otherAmount.value;
    }
    
    form.otherAmount.focus();
    return DoMinAmountValidation(amount, form, failedText);
}

function DoMinAmountValidation(amount, form, failedText)
{
    if(typeof(window[ 'disableValidation' ]) != 'undefined')
        if(disableValidation)
            return;
    
    url = './includes/ajaxRequestor.php?handlerID=validate_min_amount&data=' + amount;
    
    Http.get({
		url: url,
		method: Http.Method.Post,
		callback: DoMinAmountValidation_Callback,
		cache: Http.Cache.Get,
		body: amount
	}, [form, failedText]);
	
	return false;
}

function ClearTextInField(field, defaultText){
    if(field.value == defaultText)
        field.value = '';
}

function DoMinAmountValidation_Callback(xmlreply, form, failedText)
{
    if (xmlreply.status == Http.Status.OK)
    {
        var dataResponse = xmlreply.responseText;
        var dataArray = dataResponse.split('|');
/*        var funcRef = window[funcName];
        if ('function' == typeof funcRef)
        {
            funcRef(dataArray[0]);
        }
*/      
        if(dataArray[0]=='OK')
            form.submit();
        else
            alert(failedText);
    }
    else
        alert('Cannot handle the Ajax call.');
}
