//Register: step 1 form FORM VALIDATION FUNCTION
function objRegisterStepOne(obj)
{		
	if(!(obj.uid.value.length > 3 && obj.uid.value.length <= 20 && isValidText(obj.uid.value))) {
		alert("Username must be between 4 and 20 characters in length and must not contain spaces or symbols.");
		obj.uid.focus();
		obj.uid.select();
		return false;
	}
 	
	//validate password field it must contain numeric values and it cannot match username
	if(!(isValidText(obj.usr_userpassword.value) && obj.usr_userpassword.value.length > 3  && obj.usr_userpassword.value.length <= 20 
		&& itHasNumbers(obj.usr_userpassword.value)))
	{
		alert("Password must be between 4 and 20 characters with at least 1 numeric character and may not match username");
		obj.usr_userpassword.focus();
		obj.usr_userpassword.select();
		return false;
	}
	
	
	//Confirmpassword field must equal passwordfield
	if(obj.usr_userpassword.value != obj.confirmPassword.value)
	{
		alert("passwords do not match");
		obj.confirmPassword.value= "";
		obj.usr_userpassword.focus();
		obj.usr_userpassword.select();
		return false;
	}
	
	//select "Pick a secret question" required
	/*if(obj.usr_hint.options.selectedIndex == 0)
	{
		alert("Please select a question"); 
		obj.usr_hint.focus();
		return false;
	}
	
	//Question answer required
	if(obj.usr_hintanswer.value == "")
	{
		alert("answer to question field is required");
		obj.usr_hintanswer.focus();
		return false;
	}
	*/

	//first name required
	if(obj.usr_givenname.value == "")
	{
		alert("first name field is required");
		obj.usr_givenname.focus();
		return false;
	}
	
	//last name required
	if(obj.usr_sn.value == "")
	{
		alert("last name field is required");
		obj.usr_sn.focus();
		return false;
	}
	
	//validating email
	if(!isValidEmail(obj.usr_mail.value))
	{
		alert("invalid email\nexp: you@domain.com");
		obj.usr_mail.focus();
		obj.usr_mail.select();
		return false;	
	}

	//validating re-type email
	if(!isValidEmail(obj.usr_mail2.value))
	{
		alert("invalid email\nexp: you@domain.com");
		obj.usr_mail2.focus();
		obj.usr_mail2.select();
		return false;	
	}

	//Match email and re-type email
	if(obj.usr_mail.value != obj.usr_mail2.value)
	{
		alert("two email fields don't match");
		obj.usr_mail.focus();
		obj.usr_mail.select();
		return false;	
	}
	


	//Work at hospital required
	if(obj.usr_hospital.value == "")
	{
		alert("Work at hospital field is required");
		obj.usr_hospital.focus();
		return false;
	}
	
	
}

//Register: step 2 Address FORM VALIDATION FUNCTION
function objRegisterStepTwo(obj)
{	
	//Addres field 1 is required
	if(obj.usr_addr1.value == "")
	{
		alert("Address field is required");
		obj.usr_addr1.focus();
		obj.usr_addr1.select();
		return false;
	}
	
	//City field  is required
	if(obj.usr_city.value == "")
	{
		alert("City field is required");
		obj.usr_city.focus();
		obj.usr_city.select();
		return false;
	}
	
	//county field  is required
	if(obj.usr_c.options.selectedIndex == 0)
	{
		alert("Country field is required");
		obj.usr_c.focus();
		return false;
	}
	
	//checking to see if there is a STATE selected if USA or CANADA WAS SELECTED
	if(obj.usr_c.options [obj.usr_c.options.selectedIndex].value == "USA" || obj.usr_c.options
	[obj.usr_c.options.selectedIndex].value == "CAN")
	{
		//USA OR CANADA was selected, check to see if there was a STATE selected else return false; 
		//otherwise proceed
		if (obj.usr_st.options.selectedIndex == 0)
		{
			alert("please select a state");
			obj.usr_st.focus();
			return false;
		}	
		
		//USA OR CANADA was selected, check to see if there is a valid zip code
		if (obj.usr_postalcode.value.length < 5)
		{
			alert("Please enter your postal code");
			obj.usr_postalcode.focus();
			obj.usr_postalcode.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.usr_telephonenumber.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!(isNumericString(obj.usr_telephonenumber.value) && obj.usr_telephonenumber.value.length >= 10 && obj.usr_telephonenumber.value.length <=20))
		{
			alert("Your telephone number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_telephonenumber.focus();
			obj.usr_telephonenumber.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.usr_facsimiletelephonenumber.value.length > 0)
	{
		// it returns false if the Fax string is a non-numeric string
		if(!(isNumericString(obj.usr_facsimiletelephonenumber.value) && obj.usr_facsimiletelephonenumber.value.length >= 10 && obj.usr_facsimiletelephonenumber.value.length <=20))
		{
			alert("Your fax number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_facsimiletelephonenumber.focus();
			obj.usr_facsimiletelephonenumber.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.usr_mobile.value.length > 0)
	{
		// it returns false if the CELL PHONE e string is a non-numeric string
		if(!(isNumericString(obj.usr_mobile.value) && obj.usr_mobile.value.length >= 10 && obj.usr_mobile.value.length<=20))
		{
			alert("Your mobile number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_mobile.focus();
			obj.usr_mobile.select();
			return false;
		}
	}
}

//Login validation function FORM VALIDATION FUNCTION
function objLogin(obj)
{
	//validate user name
	if(obj.uid.value == "")
	{
		alert("Please enter your username");
		obj.uid.focus();
		return false;
	}
	
	//validate password
	if(obj.userpassword.value == "")
	{
		alert("Please enter your password");
		obj.userpassword.focus();
		return false;
	}
	return true;
}

//Edit profile FORM VALIDATION FUNCTION
function objEditProfileForm(obj,isMember)
{
	//user entered new password
	if(obj.userpassword.value != ""){	
		//validate new password field it must contain numeric values and it cannot match username
		if(!(isValidText(obj.userpassword.value) && obj.userpassword.value.length > 3 && obj.userpassword.value.length <= 20 &&
		itHasNumbers(obj.userpassword.value)))
		{
			alert("Password must be between 4 and 20 characters with at least 1 numeric character and may not match username");
			obj.userpassword.focus();
			obj.userpassword.select();
			return false;
		}
	}
	
	//user must confirm password if he enters a new password
	if(obj.userpassword.value != ""){
		if(obj.userpassword.value !=  obj.userpassword_confirm.value)
		{
			alert("Confirm password does not match your new password");
			obj.userpassword_confirm.select();
			obj.userpassword_confirm.focus();
			return false;
		}
	}	
	
	//making sure user enter old password if he enters a new password
	//if(obj.userpassword.value != "" && obj.userpassword_old.value == "")
	//{
	//	alert("please enter your old password");
	//	obj.userpassword_old.focus();
	//	return false;
	//}
		
	//first name required
	if(obj.usr_givenname.value == "")
	{
		alert("first name field is required");
		obj.usr_givenname.focus();
		return false;
	}
	
	//last name required
	if(obj.usr_sn.value == "")
	{
		alert("last name field is required");
		obj.usr_sn.focus();
		return false;
	}
	//Only non-members have to enter address info
	if(isMember=="false")
	{
		if(obj.usr_addr1 != null && obj.usr_addr1.value == "")
		{
			alert("address line 1 field is required");
			obj.usr_addr1.focus();
			return false;
		}

		//City field  is required
		if(obj.usr_city != null && obj.usr_city.value == "")
		{
			alert("City field is required");
			obj.usr_city.focus();
			obj.usr_city.select();
			return false;
		}
	
		//county field  is required
		if(obj.usr_c != null && obj.usr_c.options != null && obj.usr_c.options.selectedIndex == 0)
		{
			alert("Country field is required");
			obj.usr_c.focus();
			return false;
		}
	
		//checking to see if there is a STATE selected if USA or CANADA WAS SELECTED
		if(obj.usr_c != null && obj.usr_c.options != null && (obj.usr_c.options [obj.usr_c.options.selectedIndex].value == "USA" || obj.usr_c.options
		[obj.usr_c.options.selectedIndex].value == "CAN"))
		{
			//USA OR CANADA was selected, check to see if there was a STATE selected else return false; 
			//otherwise proceed
			if (obj.usr_st.options.selectedIndex == 0)
			{
				alert("please select a state");
				obj.usr_st.focus();
				return false;
			}	
			
			//USA OR CANADA was selected, check to see if there is a valid zip code
			if (obj.usr_postalcode.value.length < 5)
			{
				alert("Please enter your postal code");
				obj.usr_postalcode.focus();
				obj.usr_postalcode.select();
				return false;
			}
		}
	}

	if(obj.usr_telephonenumber != null && obj.usr_telephonenumber.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!(isNumericString(obj.usr_telephonenumber.value) && obj.usr_telephonenumber.value.length >= 10 && obj.usr_telephonenumber.value.length <=20))
		{
			alert("Your telephone number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_telephonenumber.focus();
			obj.usr_telephonenumber.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.usr_facsimiletelephonenumber != null && obj.usr_facsimiletelephonenumber.value.length > 0)
	{
		// it returns false if the Fax string is a non-numeric string
		if(!(isNumericString(obj.usr_facsimiletelephonenumber.value) && obj.usr_facsimiletelephonenumber.value.length >= 10 && obj.usr_facsimiletelephonenumber.value.length <=20))
		{
			alert("Your fax number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_facsimiletelephonenumber.focus();
			obj.usr_facsimiletelephonenumber.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.usr_mobile != null && obj.usr_mobile.value.length > 0)
	{
		// it returns false if the CELL PHONE e string is a non-numeric string
		if(!(isNumericString(obj.usr_mobile.value) && obj.usr_mobile.value.length >= 10 && obj.usr_mobile.value.length<=20))
		{
			alert("Your mobile number must be at least 10 digits long, and can contain only numbers.  [ex: 313-555-1212 becomes 3135551212]");
			obj.usr_mobile.focus();
			obj.usr_mobile.select();
			return false;
		}
	}
	
	//validating email
	if(!isValidEmail(obj.usr_mail.value))
	{
		alert("invalid email\nexp: you@domain.com");
		obj.usr_mail.focus();
		obj.usr_mail.select();
		return false;	
	}

	
}

//PMG Mebership Application FORM VALIDATION FUNCTION
function objPMGValidate(obj)
{
	//First name required
	if(obj.First_Name.value == "")
	{
		alert("First name field is required");
		obj.First_Name.focus();
		return false;
	}
	
	//First name required
	if(obj.Last_Name.value == "")
	{
		alert("Last name field is required");
		obj.Last_Name.focus();
		return false;
	}
	
	//Email is required
	if(obj.Email.value == "")
	{
		alert("Email field required");
		obj.Email.focus();
		return false;
	}
	else
	{
		//validate email field
		if(!(isValidEmail(obj.Email.value)))
		{
			alert("please enter a correct email address\nex: you@domain.com");
			obj.Email.focus();
			obj.Email.select();
			return false;
		}
	}
	
	//Employer/Organization Name field required
	if(obj.Organization.value == "")
	{
		alert("Employer/Organization Name\nfield is required");
		obj.Organization.focus();
		return false;
	}
		
	//Address 1 field required
	if(obj.Address_1.value == "")
	{
		alert("Address 1 field is required");
		obj.Address_1.focus();
		return false;
	}
	
	//City field required
	if(obj.City.value == "")
	{
		alert("City field is required");
		obj.City.focus();
		return false;
	}
	
	//county field  is required
	if(obj.Country.options.selectedIndex == 0)
	{
		alert("Country field is required");
		obj.Country.focus();
		return false;
	}
	
	//checking to see if there is a STATE selected if USA or CANADA WAS SELECTED
	if(obj.Country.options [obj.Country.options.selectedIndex].value == "USA" || obj.Country.options
	[obj.Country.options.selectedIndex].value == "CAN")
	{
		//USA OR CANADA was selected, check to see if there was a STATE selected else return false; 
		//otherwise proceed
		if (obj.State.options.selectedIndex == 0)
		{
			alert("please select a state");
			obj.State.focus();
			return false;
		}	
		
		//USA OR CANADA was selected, check to see if there is a valid zip code
		if (obj.Zip.value.length < 5)
		{
			alert("Please enter your postal code");
			obj.Zip.focus();
			obj.Zip.select();
			return false;
		}
	}
	
	//Phone field required
	if(obj.Phone.value == "")
	{
		alert("Phone field is required");
		obj.Phone.focus();
		return false;
	}
	else
	{
		//do number test if field contains more than one character
		if(obj.Phone.value.length > 0)
		{
			// it returns false if the Phone string is a non-numeric string
			if(!isNumericString(obj.Phone.value))
			{
				alert("Phone Must be #s only");
				obj.Phone.focus();
				obj.Phone.select();
				return false;
			}
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Fax.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Fax.value))
		{
			alert("Fax Must be #s only");
			obj.Fax.focus();
			obj.Fax.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Cell.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Cell.value))
		{
			alert("Cell Phone Must be #s only");
			obj.Cell.focus();
			obj.Cell.select();
			return false;
		}
	}	
	return true;		
}


//Evant Registration FORM VALIDATION FUNCTION
function objEventRegistration(obj)
{
	//Event required - prepopulated
	if(obj.Event.value == "")
	{
		alert("Please enter an event");
		obj.Event.focus();
		return false;
	}
	
	//First name required
	if(obj.First_Name.value == "")
	{
		alert("First name field is required");
		obj.First_Name.focus();
		return false;
	}
	
	//Last name required
	if(obj.Last_Name.value == "")
	{
		alert("Last name field is required");
		obj.Last_Name.focus();
		return false;
	}
	
	//user must check if he/she is a member or not
	if(!obj.Member[0].checked && !obj.Member[1].checked)
	{
		alert("Please check if you are a member or not");
		obj.Member[0].focus();
		return false;
	}	
	
	//Member ID field required
	if(obj.Member[0].checked && obj.Member_ID.value == "")
	{
		alert("Member ID field is required");
		obj.Member_ID.focus();
		return false;
	}
	
	//Address 1 field required
	if(obj.Address_1.value == "")
	{
		alert("Address 1 field is required");
		obj.Address_1.focus();
		return false;
	}
	
	//City field required
	if(obj.City.value == "")
	{
		alert("City field is required");
		obj.City.focus();
		return false;
	}
	
	//county field  is required
	if(obj.Country.options.selectedIndex == 0)
	{
		alert("Country field is required");
		obj.Country.focus();
		return false;
	}
	
	//checking to see if there is a STATE selected if USA or CANADA WAS SELECTED
	if(obj.Country.options [obj.Country.options.selectedIndex].value == "USA" || obj.Country.options
	[obj.Country.options.selectedIndex].value == "CAN")
	{
		//USA OR CANADA was selected, check to see if there was a STATE selected else return false; 
		//otherwise proceed
		if (obj.State.options.selectedIndex == 0)
		{
			alert("please select a state");
			obj.State.focus();
			return false;
		}	
		
		//USA OR CANADA was selected, check to see if there is a valid zip code
		if (obj.Zip.value.length < 5)
		{
			alert("Please enter your postal code");
			obj.Zip.focus();
			obj.Zip.select();
			return false;
		}
	}
	
	//Phone field required
	if(obj.Phone.value == "")
	{
		alert("Phone field is required");
		obj.Phone.focus();
		return false;
	}
	else
	{
		//do number test if field contains more than one character
		if(obj.Phone.value.length > 0)
		{
			// it returns false if the Phone string is a non-numeric string
			if(!isNumericString(obj.Phone.value))
			{
				alert("Phone Must be #s only");
				obj.Phone.focus();
				obj.Phone.select();
				return false;
			}
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Fax.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Fax.value))
		{
			alert("Fax Must be #s only");
			obj.Fax.focus();
			obj.Fax.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Cell.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Cell.value))
		{
			alert("Cell Phone Must be #s only");
			obj.Cell.focus();
			obj.Cell.select();
			return false;
		}
	}	
	
	//Email is required
	if(obj.Email.value == "")
	{
		alert("Email field required");
		obj.Email.focus();
		return false;
	}
	else
	{
		//validate email field
		if(!(isValidEmail(obj.Email.value)))
		{
			alert("please enter a correct email address\nex: you@domain.com");
			obj.Email.focus();
			obj.Email.select();
			return false;
		}
	}
	
	//User Name required
	if(obj.User_Name.value == "")
	{
		alert("User Name field is required");
		obj.User_Name.focus();
		return false;
	}
	return true;		
}
//Request Information/Contact FORM VALIDATION FUNCTION
function obRequestContact(obj)
{
	//First name required
	if(obj.First_Name.value == "")
	{
		alert("First name field is required");
		obj.First_Name.focus();
		return false;
	}
	
	//Last name required
	if(obj.Last_Name.value == "")
	{
		alert("Last name field is required");
		obj.Last_Name.focus();
		return false;
	}
	
	//Email is required
	if(obj.Email.value == "")
	{
		alert("Email field required");
		obj.Email.focus();
		return false;
	}
	else
	{
		//validate email field
		if(!(isValidEmail(obj.Email.value)))
		{
			alert("please enter a correct email address\nex: you@domain.com");
			obj.Email.focus();
			obj.Email.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Phone.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Phone.value))
		{
			alert("Phone Must be #s only");
			obj.Phone.focus();
			obj.Phone.select();
			return false;
		}
	}

	//do number test if field contains more than one character
	if(obj.Fax.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Fax.value))
		{
			alert("Fax Must be #s only");
			obj.Fax.focus();
			obj.Fax.select();
			return false;
		}
	}
	
	//do number test if field contains more than one character
	if(obj.Cell.value.length > 0)
	{
		// it returns false if the Phone string is a non-numeric string
		if(!isNumericString(obj.Cell.value))
		{
			alert("Cell Phone Must be #s only");
			obj.Cell.focus();
			obj.Cell.select();
			return false;
		}
	}	
	return true;		
}

//this function validates for Numerics characters Only
function isNumericString(strValidateText)
{
	var strAlphaNumeric = "1234567890";
		
	for (i=0;i < strValidateText.length;i++)
	{
		var c = strValidateText.charAt(i);
		
		if (strAlphaNumeric.indexOf(c) == -1)
		{			
			return false;
		}
	}
	return true;
}

//this function validates for AlphaNumerics characters
function isValidText(strValidateText)
{
	var strAlphaNumeric = "abcdefghijklmnopqrstuvwxyz1234567890";
		
	for (i=0;i < strValidateText.length;i++)
	{
		var c = strValidateText.charAt(i).toLowerCase();
		if(c == " "){
		  return false;
		}
		if (!(strAlphaNumeric.indexOf(c) > -1))
		{
			return false;
		}
	}
	return true;
}

//this function validates for Numerics characters
function itHasNumbers(strValidateText)
{
	for (i=0;i < strValidateText.length;i++)
	{
		var c = strValidateText.charAt(i).toLowerCase();
		if (parseInt(c, 10) > -1)
		{
			return true;
		}
	}
	return false;
}

//this function validates email field, @ must be present and no white space allowed.
function isValidEmail(inString)
{
	// search for required characters @, ., and white space " "
	var chrFoundAt = inString.indexOf("@");
	var chrFoundWhite = inString.indexOf(" ");
	var chrFoundDOT = inString.indexOf(".");		
	
	// if these is any white space, return false	
	if (inString.length < 7)
	{
		return false;
	}
	
	// if these is any white space, return false	
	if (chrFoundWhite != -1)
	{
		return false;
	}
	
	// if the dot character does not exists, return false
	if (chrFoundDOT == -1)
	{
		return false;
	}
	
	//if the @ character does not exist, return false
	if (chrFoundAt == -1)
	{
		return false;
	}	
	return true;
}

// Add and Remove options from one list to another
function AddRemoveOptions(obj, obj2, selectItems){
	// if the there are no options, then start at 0 otherwise start at the end
	if(obj2.length == 1 && obj2.options[0].value == "")
	{
		var newOptionsCount = 0;
	}
	else
	{
		var newOptionsCount = obj2.length;
	}
	
	//add selected items to list
	for (i=0; i < obj.length; i++)
	{			
		//alert(obj.options[i]);
		if(obj.options[i] != null && obj.options[i].selected)
		{			
			//alert("do it");
			var objOption = new Option();
			
			objOption.text = obj.options[i].text;
			objOption.value = obj.options[i].value;	
			objOption.selected = true;							
			obj2.options[newOptionsCount++] = objOption;										
		}
	}
	
	// remove selected items from list
	for (i = obj.length; i >= 0 ; i--)
	{			
		
		if(obj.options[i] != null && obj.options[i].selected)
		{			
			obj.options[i] = null;									
		}
	}
	//select all item in appropiate list
	if(selectItems == "first") {
		for (i=0; i < obj.length; i++)
		{
			obj[i].selected = true;			
		}
	}
	else if(selectItems == "second") {
		//add selected items to list
		for (i=0; i < obj2.length; i++)
		{
			obj2[i].selected = true;			
		}
	}			
}

//Swap option going up
function swapOptionUp(obj)
{		
	for(i=0; i < obj.length; i++)
	{		
		if(obj.options[i] != null && obj.options[i].selected && i > 0)
		{
			var tempOption1 = new Option(obj.options[i].text,obj.options[i].value);
			var tempOption2 = new Option(obj.options[i-1].text,obj.options[i-1].value);
			
			obj.options[i] = tempOption2;
			obj.options[i-1] = tempOption1;
			obj.options[i-1].selected = true;
		}
	}
}

//Swap option going going down
function swapOptionDown(obj)
{	
	
	for(i = obj.length-1; i > -1; i--)
	{		
		if(obj.options[i] != null && obj.options[i].selected && i != obj.length-1)
		{
			var tempOption1 = new Option(obj.options[i].text,obj.options[i].value);
			var tempOption2 = new Option(obj.options[i+1].text,obj.options[i+1].value);
			
			obj.options[i] = tempOption2;
			obj.options[i+1] = tempOption1;
			obj.options[i+1].selected = true;
		}
	}
}
//Close the current pop p window and open target link in parent window
function unpopuplink(url) {
  window.opener.location = url;
  window.close();
  return false;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function sessionOnLoad(){
  if(document.login_form2 != null){
    if(document.login_form2.uid.value != "" && document.login_form2.userpassword.value != ""){
      document.login_form2.Submit.value = "Log In";
      document.login_form2.submit();
    }
  }
}
