﻿function rating_input(loc) {
	window.location.href = loc;
}

/* NOT REQUIRED?
function submitFunction1(i, formName) {
	//alert("formName name->"+formName.name);
	if (i==1) {
		//document.approvalform.approve="y";
		formName.approve.value = "y";
	} else if (i==2) {
		//document.approvalform.approve="n";
		formName.approve.value = "n";
	} else {
		// javascript not enabled.
	}

	//alert("document.approvalform.approve="+document.approvalform.approve);
	formName.submit();
}
*/

function registerValidation() {
	if (register.username.value.length < 5)
	{
		alert("Your username must be at least 5 characters long.");
		return false;
	}
}

function submitFunction(i, formName, lineId, actionName) {
	if (i==1) {
		//document.approvalform.approve="y";
		formName.approve.value = "y";
	} else if (i==2) {
		//document.approvalform.approve="n";
		if (formName.comment.value == "")
		{
			alert("Denial reason is required.");
			return false;
		}
		formName.approve.value = "n";
	} else if (i==3) {
		//document.approvalform.approve="n";
		if (formName.comment.value == "")
		{
			alert("Denial reason is required.");
			return false;
		}
		formName.approve.value = "nn";
	} else {
		// javascript not enabled.
	}

	// <form name="approvalform77" onsubmit="new Ajax.Updater({success:'block_77'}, '/moderator/newUserApproval', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('indicator');new Effect.Highlight('comment_area77', {});}, onLoading:function(request, json){Element.show('indicator')}, parameters:Form.serialize(this)}); return false;" action="/moderator/newUserApproval" method="post">
	//new Ajax.Updater('id_div', '<?php echo $_SERVER['SCRIPT_NAME']; ?>/event/update', {asynchronous:true, evalScripts:false, parameters:Form.serialize('eventform')}); 
	new Ajax.Updater({success:'block_'+lineId}, '/moderator/'+actionName, {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('indicator');new Effect.Highlight('comment_area'+lineId, {});}, onLoading:function(request, json){Element.show('indicator')}, parameters:Form.serialize(this)}); 
	return false;
}

function validate_form (formName)
{
    valid = true;

    if ( formName.comment.value == "" )
    {
        alert ( "Please fill in the 'Your Name' box." );
        valid = false;
    }

    return valid;
}
