function openPopup(url, size) {
	openPopup(url, size, size);
}

function openPopup(url, width, height) {
	popup = window.open(url, "_blank", "width=" + width + ",height=" + height
			+ ",status=yes,scrollbars=yes,resizable=yes");
	popup.focus();
	return false;
}

function setFocus(id) {
	var ele = window.document.getElementById(id);
	if (ele != null) {
		ele.focus();
		ele.value = ele.value;
	}
}
function checkForNull(id) {
	var ele = window.document.getElementById(id);
	if (ele != null) {
		if (ele.value == '' || ele.value == null) {
			return true;
		}
	}
}

function fadeElement(id, fadeOut) {
	var ele = window.document.getElementById(id);
	if (ele != null) {
		if (fadeOut) {
			ele.style.display = "none";
		} else {
			ele.style.display = "block";
		}
	}
}

function displayRatingAreaIfPositive(id, selectName) {
	var ele = window.document.getElementById(id);
	if (ele != null) {
		var ele2 = window.document.getElementsByName(selectName);
		if (ele2 != null) {
			var len = ele2.length;
			for (i = 0; i < len; i++) {
				if (ele2[i].value == 'P') {
					if (ele2[i].checked) {
						ele.style.display = "block";
						break;
					}
				}
			}
		}
	}
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for (z = 0; z < theForm.length; z++) {
		if (theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
			theForm[z].checked = theElement.checked;
		}
	}
}

function changeImageSrc(imageid,newsrc) {
	var ele = window.document.getElementById(imageid);
	if (ele != null) {
		ele.src=newsrc;
	}
}

