/*
'======================================================================
' AUTHOR: Tim Sewell
' OVERVIEW: 
' Javascript functions
'
' MODIFICATION DETAILS (LAST 2)
' LAST EDITED: Tim Sewell - 28/04/2004
' COMMENTS:
' 
'======================================================================
*/

/*======================================================================
								OPEN POPUP WINDOWS
======================================================================*/

var wHeight = screen.height
var wWidth = screen.width


function popupMainWindow(url,height,width) 
{
	var isHeight=Number(height);
	var isWidth=Number(width);
	var wTop = (wHeight - isHeight) / 2
	var wLeft = (wWidth - isWidth) / 2
	mainWindow  =   window.open(url,"mainWindow",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+isWidth+',height='+isHeight+',top='+wTop+',left='+wLeft);
	mainWindow.focus();
}

function popupMainWindow1(url,height,width) {
  var isHeight=Number(height);
  var isWidth=Number(width);
  var wTop = (wHeight - isHeight) / 2
  var wLeft = (wWidth - isWidth) / 2
  mainWindow1  =   window.open(url,"mainWindow1",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+isWidth+',height='+isHeight+',top='+wTop+',left='+wLeft);
  mainWindow1.focus();
}

function centerScreen(xWidth,xHeight)
{
		window.resizeTo(xWidth,xHeight);
		var wHeight = screen.height-xHeight;
  		var wWidth = screen.width-xWidth;
  		window.moveTo(wWidth/2,wHeight/2);
}

/*======================================================================
								CHECK FOR DIGITS
======================================================================*/

function isDigits(str) {
	var i
	for (i = 0; i < str.length; i++) {
		mychar = str.charAt(i)
		if ((mychar < "0" || mychar > "9") && mychar !=".")
			return false;
	}
	return true;
}

/*======================================================================
								CHECK FOR VALID EMAIL
======================================================================*/

function checkemail(s)
{
    var str = s;
    var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
    if (filter.test(str))
        testresults=true
    else
    {
        alert("Please input a valid email address!")
        testresults=false
    }
    return (testresults)
}
