

function addReviewComment(val)
{
	
	new Ajax.Request(val, { method: 'post', onComplete: displayReviewForm });
}
function displayReviewForm(responseHttpObj)
{
	$("reviewcomment").style.display="block";
	$("reviewcomment").innerHTML=responseHttpObj.responseText;
}

function showLoadingActionOnForm()
{
	$("loadingDiv").style.display="block";
}
function getRequestBody()
{
	var oForm = $("form");
	var aParam= new Array();
	for (i=0; i < oForm.elements.length; i++)
	{
		var sParam="";
		sParam += encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].value);
		aParam.push(sParam);
	}
	return aParam.join("&");
}

function submitCommentform()
{
	var oForm = $("form");
	if(oForm.new_comment.value=="")
	{
		alert("Please Enter a new Comment")
		return false;
	}
	//alert(oForm.action+"?"+getRequestBody())
	new Ajax.Request(oForm.action+"?"+getRequestBody(), { method: 'get', onComplete: hideReviewDiv });	
}
function hideReviewDiv(responseHttpObj)
{
	
	//alert(responseHttpObj.responseText);
	
	
	if(responseHttpObj.responseText=="error")
	{
//		$("MYCOMMENT").innerHTML="<p style='margin-top: 20px; color: #ff0000'>An error occured while saving your comment. Please contact the site administrator.</p>";
		$("mid").innerHTML="<p style='margin-top: 20px; color: #ff0000'>An error occured while saving your comment. Please contact the site administrator.</p>";
	}
	else
	{
//		$result=responseHttpObj.responseText.split("|");
//		var obj="COMMENT_"+$result[0];
//		var bobj=document.getElementById(obj);
//		bobj.innerHTML=$result[1];
//		$("MYCOMMENT").innerHTML=
//			"<p><span style='font-weight: bold'>Your new comment: </span>" + responseHttpObj.responseText + "</p>" + 
//			"<p style='margin-top: 20px; color: #ff0000'>Your comment was successfully saved.</p>" +
//			"<p><input type='submit' value='Close' onclick='deleteLyteBox(); return false' /></p>";
//		$("MYCOMMENT").innerHTML = responseHttpObj.responseText;
		$("mid").innerHTML = responseHttpObj.responseText;
	}
}


