function updateFlagState(path, noticeId, checkbox){
	var url = path + "flagNotice.html?noticeId="+ noticeId + "&flagged=" + checkbox.checked;
	initRequest(url);
	req.send(null);
	
	setFlagTextState(noticeId);
	
}

function setFlagTextState(noticeId) {
	
	document.getElementById("notice_"+noticeId).checked==true 
		? document.getElementById("flag"+noticeId).innerHTML="Flagged Contract" 
		: document.getElementById("flag"+noticeId).innerHTML="Unflagged Contract";

}

function initRequest(url) {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	req.open("GET", url, true);
} 