/*****************************************************************************
 * General Java-Script functions
 ****************************************************************************/

// Opens a new restricted window
function openRestrictedWindow(file, name, width, height){
	openWindow(file, name, width, height, 'yes', 'no', 'yes', 1);
}

// Opens a new window which has toolbars, scrollbars ...
function openOpenWindow(file, name, width, height){
	openWindow(file, name, width, height, 'yes', 'yes', 'yes', 1);
}

// Opens a new window using the given attributes
function openWindow(file, name, width, height, resizable, toolbar, scrollbars, status){
	var xPos = (screen.width - width)/2;
	var yPos = (screen.height - height)/2;
	newWindow = window.open(file, name, 'width='+width+',height='+height+',left='+xPos+',top='+yPos+',resizable='+resizable+',toolbar='+toolbar+',scrollbars='+scrollbars+',status='+status);
	newWindow.focus();
}

searchCounter = false;
function search() {
	if (searchCounter == false ) {
		searchCounter = true;
		document.getElementById("searchTerm").value = '';
	}
}

function openFormsPrint(formObj, printUrl, target) {
	var urlBackup = formObj.action;
	var targetBackup = formObj.target;
	formObj.action=printUrl;	
	formObj.target=target;
	formObj.submit();
	formObj.action=urlBackup;
	formObj.target=targetBackup;
}