//focuses the cursor, usually on a form/input element
function focusCursor(jqueryPath) {
	$(jqueryPath).focus();
}

//general function to nicely make areas appear and reappear by clicking
function toggleElement(idCode) {
	if($(idCode).is(':visible')) {
		$(idCode).fadeOut();
	} else {
		$(idCode).fadeIn();
	}
} 


function updateApprovalBody(id, theColor) {
	idCode = '#body-comments-' + id;
	$(idCode).css('backgroundColor', theColor);
}
function markAllCommentsAsApprove(theColor) {
	$(".approve input").attr("checked", true);
	$(".approve").css('backgroundColor', theColor);
	$(".remove").css('backgroundColor', '');
}
function markAllCommentsAsRemove(theColor) {
	$(".remove input").attr("checked", true);
	$(".approve").css('backgroundColor', '');
	$(".remove").css('backgroundColor', theColor);
}


//this is a fix to override the yellow background color that the google toolbar puts in Internet Explorer
 if(window.attachEvent)
   window.attachEvent("onload",setListeners);

 function setListeners(){
   inputList = document.getElementsByTagName("INPUT");
   for(i=0;i<inputList.length;i++){
     inputList[i].attachEvent("onpropertychange",restoreStyles);
     inputList[i].style.backgroundColor = "";
   }
   selectList = document.getElementsByTagName("SELECT");
   for(i=0;i<selectList.length;i++){
     selectList[i].attachEvent("onpropertychange",restoreStyles);
     selectList[i].style.backgroundColor = "";
   }
 }

 function restoreStyles(){
   if(event.srcElement.style.backgroundColor != "")
     event.srcElement.style.backgroundColor = "";
 }