/*
   f5 Pty Ltd
   Miscellaneous Functions for the Portal
*/

// check for Submitted once
 function checkForOneSubmit() {  
	alert('checking...');
  if (window.document.forms[0].submitonce.value == 0) {
   window.document.forms[0].submitonce.value = 1;
   return true;
  }
  else {
   // do nothing while submitting
   alert('System is processing your request.\n\nPlease click \'OK\' and wait for the page to load.');
   return false;
  }
 }
 
// Pop up a window, focused and centered on screen.
function popup (url,name,height,width) {
	var popup_height = height;
	var popup_width = width;
	var popup_locX = (self.screen.availWidth - popup_width) / 2;
	var popup_locY = (self.screen.availHeight - popup_height) / 2;

	if (navigator.appName == "Microsoft Internet Explorer")
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",left=" + popup_locX + ",top=" + popup_locY + ",location=no,status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=yes");
	else
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",screenX=" + popup_locX + ",screenY=" + popup_locY + ",location=no,status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=yes");

	if (!((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) <= 3))) theWin.focus();
}

// Pop up a window, focused on screen.
function popup_notcentered (url,name,height,width) {
	var popup_height = height;
	var popup_width = width;

	if (navigator.appName == "Microsoft Internet Explorer")
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",location=no,status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=yes");
	else
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",location=no,status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=yes");

	if (!((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) <= 3))) theWin.focus();
}

// Pop up a window, focused and centered on screen - with no resizing or scrolls.
function popupNoResize (url,name,height,width) {
	var popup_height = height;
	var popup_width = width;
	var popup_locX = (self.screen.availWidth - popup_width) / 2;
	var popup_locY = (self.screen.availHeight - popup_height) / 2;

	if (navigator.appName == "Microsoft Internet Explorer")
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",left=" + popup_locX + ",top=" + popup_locY + ",location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
	else
		theWin = window.open (url, name, "height=" + popup_height + ",width=" + popup_width + ",screenX=" + popup_locX + ",screenY=" + popup_locY + ",location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");

	if (!((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) <= 3))) theWin.focus();
}
