function reportBug()
{
	//showLoadingBar();
	ShowAjaxMsg("Sending message...");
	url = "processAjax.php"
	str = "type=sendBug&bugDetail=" + encodeURI(document.getElementById('msgDetail').value);
	makePostRequest(url, str);
	
	ClearInputBox();
}

function makeSuggestion()
{
	//showLoadingBar();
	ShowAjaxMsg("Sending message...");
	url = "processAjax.php"
	str = "type=sendSuggest&suggestion=" + encodeURI(document.getElementById('msgDetail').value);
	makePostRequest(url, str);
	
	ClearInputBox();
}
/*
function showLoadingBar()
{
	document.getElementById('sendingMsg').innerHTML = "Sending...";
	document.getElementById('sendingBar').style.visibility = 'visible';
}
*/
function ClearInputBox()
{
	document.getElementById('sendingMsg').innerHTML = "";
	document.getElementById('sendingBar').style.visibility = 'hidden';
	document.getElementById('MsgInputBox').style.visibility = 'hidden';
}

function sendAjaxMsg()
{
	if(ajaxMsgSending == "sendBug")
	{
		reportBug();
	}
	else if(ajaxMsgSending == "sendSuggest")
	{
		makeSuggestion();
	}
}

var msgBox = new PopupWindow('MsgInputBox');

function showInputBox(anchorName)
{
	document.getElementById('msgDetail').value = "";
	document.getElementById('sendingBar').style.visibility = 'hidden';
	
	if(anchorName == 'sendBugLink')
	{
		ajaxMsgSending = "sendBug";
		document.getElementById('sendingMsg').innerHTML = "Please describe the error below.";
		msgBox.offsetY=-180;
		msgBox.offsetX=20;
	}
	else if(anchorName == 'sendSuggestLink')
	{
		ajaxMsgSending = "sendSuggest";
		document.getElementById('sendingMsg').innerHTML = "Please enter your suggestion below.";
		msgBox.offsetY=20;
		msgBox.offsetX=-320;
	}
	else
	{
		ajaxMsgSending = "";
		msgBox.hidePopup();
	}
	
	msgBox.showPopup(anchorName);
}

function closeAjaxMsgBox()
{
	document.getElementById('sendingBar').style.visibility = 'hidden';
	msgBox.hidePopup();
}