function NewWindow(mypage, myname, w, h, scroll) {
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
		win = window.open(mypage, myname, winprops)
		
		if (parseInt(navigator.appVersion) >=4) { win.window.focus(); }
	}
	
	
window.history.forward(1);	

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

	
// Validate Form	
function validateData(form)
{
	var re = / /g;
	var check
  document.theForm.email.value = document.theForm.email.value.replace(re,"");
  check = document.theForm.email.value.replace(re,"");
	
	
	if (document.theForm.program.selectedIndex  == 0 )
	{
		alert("Please tell us the degree of interest.");
		document.theForm.program.focus();
		return false;	
	}
	
	
	if (document.theForm.first_name.value == "" )
	{
		alert("Please enter your first name.");
		document.theForm.first_name.focus();
		return false;	
	}
	
	if (document.theForm.last_name.value == "" )
	{
		alert("Please enter your last name.");
		document.theForm.last_name.focus();
		return false;	
	}
	
	if (IsEmailValid('theForm','email') == false) 
	{
		alert ("Please enter your E-mail address before continuing:  must be in the format of xxxx@xxx.xxx.");
		document.theForm.email.focus();
		return false;
	}
	
	
			if (document.theForm.city.value == "" )
	{
		alert("Please enter your city.");
		document.theForm.city.focus();
		return false;	
	}
	
	
		if (document.theForm.zip.value == "" )
	{
		alert("Please enter your zip code.");
		document.theForm.zip.focus();
		return false;	
	}
	
	
	if (document.theForm.area.value == "" || document.theForm.firstdigits.value == "" || document.theForm.lastdigits.value == "")
	{
		alert("Please enter your phone number.");
		document.theForm.area.focus();
		return false;	
	}
		
		if (document.theForm.level_of_education.selectedIndex  == 0 )
	{
		alert("Please tell us your level of education.");
		document.theForm.level_of_education.focus();
		return false;	
	}
	
	var formattedphone;
  formattedphone = document.theForm.area.value + "-" + document.theForm.firstdigits.value + "-" + document.theForm.lastdigits.value;
  document.theForm.phone.value = formattedphone;
  
  var formattedphone2;
  formattedphone2 = document.theForm.area2.value + "-" + document.theForm.firstdigits2.value + "-" + document.theForm.lastdigits2.value;
  document.theForm.work_phone.value = formattedphone2;
  
  return true;
}

function IsEmailValid(FormName,ElemName)
{
	var EmailOk  = true
	var Temp     = document.forms[FormName].elements[ElemName]
	var AtSym    = Temp.value.indexOf('@')
	var Period   = Temp.value.lastIndexOf('.')
	var Space    = Temp.value.indexOf(' ')
	var Length   = Temp.value.length - 1   // Array is from 0 to length-1

	if ((AtSym < 1) ||                     // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
  {  
      EmailOk = false
      Temp.focus()
  }
	return EmailOk
}
