//this file is a mess, must clean upvar dirtyBit = false;var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;var httpRegEx = /^(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*[^\.\,\)\(\s]$/i;function setDirtyBit(){	dirtyBit = true;}function good2Go(){	if(dirtyBit)	{		return confirm('You have already made changes on this page. Are you sure you want to continue and lose these changes? Click \"OK\" to proceed without saving your changes.');	}	return true;}function linkToForm(formName){    if(good2Go())    {        document.forms[formName].submit();    }}function cleanArrayStr(str){	//replace characters that are gonna screw up the trickiness below...	str = str.replace(/http:\/\//g, "http_prefix");	str = str.replace(/https:\/\//g, "https_prefix");	str = str.replace(/\|/g, " ");	str = str.replace(/:/g, " ");	str = str.replace(/;/g, " ");	return str;}function myLoginSubmit(){	var myForm		= document.forms["loginForm"];	if(myForm.elements["memberLogin"].value == "" || myForm.elements["memberPW"].value == "")	{		alert("Empty credentials are not allowed. Please fill in both the username and the password to login.");		return false;	}	return true}function myScionSubmit(){	var myForm		= document.forms["scionForm"];	if(myForm.elements["deadYear"].value == "" || myForm.elements["deadMonth"].value == "" || myForm.elements["deadDay"].value == "")	{		alert("You must specify a deadline.\n\nNote on Deadlines: For opportunities and announcements without deadlines, indicate the date when this opportunity should discontinue appearing on SCION.");		return false;	}	myForm.elements["displayDeadline"].value = myForm.elements["deadYear"].value+"-"+myForm.elements["deadMonth"].value+"-"+myForm.elements["deadDay"].value;	var addArray	= "";	if(myForm.elements["add_addressID"].length != null)	{		for(j=0;j<myForm.elements["add_addressID"].length; j++)		{			if(			((myForm.add_line1[j].value != "") && (myForm.add_city[j].value == "" || myForm.add_country[j].value == "")) ||			((myForm.add_city[j].value != "") && (myForm.add_line1[j].value == "" || myForm.add_country[j].value == "")) ||			((myForm.add_country[j].value != "") && (myForm.add_line1[j].value == "" || myForm.add_city[j].value == ""))			)			{				alert("Some required address information is missing. Please fill in the missing information and resubmit.");				return false;			}			if(			(myForm.add_country[j].value == "USA" || myForm.add_country[j].value == "Canada") && 			(myForm.add_stateProvince[j].value == "" || myForm.add_postalCode[j].value == "")			)			{				alert("Postal addresses in the United States and Canada require a state, or province, and a postal code. Please fill in the missing information and resubmit.");				return false;			}						addArray		+= "addressID:" + cleanArrayStr(myForm.add_addressID[j].value);			addArray		+= "|isVisible:1";			addArray		+= "|line1:" + cleanArrayStr(myForm.add_line1[j].value);			addArray		+= "|line2:" + cleanArrayStr(myForm.add_line2[j].value);			addArray		+= "|line3:" + cleanArrayStr(myForm.add_line3[j].value);			addArray		+= "|city:" + cleanArrayStr(myForm.add_city[j].value);			addArray		+= "|stateProvince:" + cleanArrayStr(myForm.add_stateProvince[j].value);			addArray		+= "|postalCode:" + cleanArrayStr(myForm.add_postalCode[j].value);			addArray		+= "|country:" + cleanArrayStr(myForm.add_country[j].value) + ";";			if(j == 0)			{				myForm.elements["region"].value = determineRegion(myForm.add_stateProvince[j].value, myForm.add_postalCode[j].value, myForm.add_country[j].value);			}		}	}	else	{		if(myForm.elements["add_addressID"] != null)		{			if(			((myForm.add_line1.value != "") && (myForm.add_city.value == "" || myForm.add_country.value == "")) ||			((myForm.add_city.value != "") && (myForm.add_line1.value == "" || myForm.add_country.value == "")) ||			((myForm.add_country.value != "") && (myForm.add_line1.value == "" || myForm.add_city.value == ""))			)			{				alert("Some required address information is missing. Please fill in the missing information and resubmit.");				return false;			}			if(			(myForm.add_country.value == "USA" || myForm.add_country.value == "Canada") && 			(myForm.add_stateProvince.value == "" || myForm.add_postalCode.value == "")			)			{				alert("Postal addresses in the United States and Canada require a state, or province, and a postal code. Please fill in the missing information and resubmit.");				return false;			}						addArray		+= "addressID:" + cleanArrayStr(myForm.add_addressID.value);			addArray		+= "|isVisible:1";			addArray		+= "|line1:" + cleanArrayStr(myForm.add_line1.value);			addArray		+= "|line2:" + cleanArrayStr(myForm.add_line2.value);			addArray		+= "|line3:" + cleanArrayStr(myForm.add_line3.value);			addArray		+= "|city:" + cleanArrayStr(myForm.add_city.value);			addArray		+= "|stateProvince:" + cleanArrayStr(myForm.add_stateProvince.value);			addArray		+= "|postalCode:" + cleanArrayStr(myForm.add_postalCode.value);			addArray		+= "|country:" + cleanArrayStr(myForm.add_country.value) + ";";		}	}	myForm.elements["addresses"].value = addArray;		var ciArray	= "";	if(myForm.elements["ci_contactInfoID"].length != null)	{		for(j=0;j<myForm.elements["ci_contactInfoID"].length; j++)		{			if(			(myForm.ci_type[j].value != "" && myForm.ci_info[j].value == "") ||			(myForm.ci_info[j].value != "" && myForm.ci_type[j].value == "")			)			{				alert("Some required contact information is missing. Please fill in the missing information and resubmit..");				return false;			}     		if((myForm.ci_type[j].value == "E"))      		{     			var trimmedEmail = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type[j].value == "U")      		{     			var trimmedURL = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}			ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.ci_contactInfoID[j].value);			ciArray		+= "|isVisible:1";			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type[j].value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label[j].value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info[j].value) + ";";		}	}	else	{		if(myForm.elements["ci_contactInfoID"] != null)		{			if(			(myForm.ci_type.value != "" && myForm.ci_info.value == "") ||			(myForm.ci_info.value != "" && myForm.ci_type.value == "")			)			{				alert("Your email address or some other contact information is missing a \"Value\". Please fill in the missing \"Value\" and resubmit.");				return false;			}     		if((myForm.ci_type.value == "E"))      		{     			var trimmedEmail = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type.value == "U")      		{     			var trimmedURL = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}						ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.elements["ci_contactInfoID"].value);			ciArray		+= "|isVisible:1";			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type.value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label.value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info.value) + ";";		}	}	myForm.elements["contactInfos"].value = ciArray;	return true;		/**/}//I really hate these scripts...//really need to break the validation into smaller funcions...function mySubmit(){	var myForm		= document.forms["memberForm"];	var lpArray	= "";	if(myForm.elements["pword"].value.length < 6)	{		alert("Passwords must be at least six characters long.");		return false;	}	if(myForm.elements["pword"] != null && myForm.elements["pword_confirm"].value != null )	{		if(myForm.elements["pword"].value != myForm.elements["pword_confirm"].value)		{			alert("Passwords don't match.");			return false;		}	}	if(myForm.elements["lp_lifetimePaymentID"] != null)	{        if(myForm.elements["lp_lifetimePaymentID"].length != null)        {            for(j=0;j<myForm.elements["lp_lifetimePaymentID"].length; j++)            {                lpArray		+= "lifetimePaymentID:" + cleanArrayStr(myForm.lp_lifetimePaymentID[j].value);                lpArray		+= "|memberID:" + cleanArrayStr(myForm.lp_memberID[j].value);                lpArray		+= "|payDate:" + cleanArrayStr(myForm.lp_payDate[j].value);                lpArray		+= "|comment:" + cleanArrayStr(myForm.lp_comment[j].value) + ";";            }        }        else        {            lpArray		+= "lifetimePaymentID:" + cleanArrayStr(myForm.lp_lifetimePaymentID.value);            lpArray		+= "|memberID:" + cleanArrayStr(myForm.lp_memberID.value);            lpArray		+= "|payDate:" + cleanArrayStr(myForm.lp_payDate.value);            lpArray		+= "|comment:" + cleanArrayStr(myForm.lp_comment.value) + ";";        }	}	myForm.elements["lifetimePayments"].value = lpArray;		var addArray	= "";	if(myForm.elements["add_addressID"].length != null)	{		for(j=0;j<myForm.elements["add_addressID"].length; j++)		{			if((myForm.add_line1[j].value == "") || (myForm.add_city[j].value == "") || (myForm.add_country[j].value == ""))			{				alert("Some required address information is missing. Please fill in the missing information and resubmit.");				return false;			}			if(			(myForm.add_country[j].value == "USA" || myForm.add_country[j].value == "Canada") && 			(myForm.add_stateProvince[j].value == "" || myForm.add_postalCode[j].value == "")			)			{				alert("Postal addresses in the United States and Canada require a state, or province, and a postal code. Please fill in the missing information and resubmit.");				return false;			}			addArray		+= "addressID:" + cleanArrayStr(myForm.add_addressID[j].value);			addArray		+= "|isVisible:";			if(myForm.add_isVisible[j].checked == true)			{				addArray		+= "1";			}			else			{				addArray		+= "0";			}			addArray		+= "|label:" + cleanArrayStr(myForm.add_label[j].value);			addArray		+= "|line1:" + cleanArrayStr(myForm.add_line1[j].value);			addArray		+= "|line2:" + cleanArrayStr(myForm.add_line2[j].value);			addArray		+= "|line3:" + cleanArrayStr(myForm.add_line3[j].value);			addArray		+= "|city:" + cleanArrayStr(myForm.add_city[j].value);			addArray		+= "|stateProvince:" + cleanArrayStr(myForm.add_stateProvince[j].value);			addArray		+= "|postalCode:" + cleanArrayStr(myForm.add_postalCode[j].value);			addArray		+= "|country:" + cleanArrayStr(myForm.add_country[j].value) + ";";			if(j == 0)			{				myForm.elements["region"].value = determineRegion(myForm.add_stateProvince[j].value, myForm.add_postalCode[j].value, myForm.add_country[j].value);			}		}	}	else	{		if(myForm.elements["add_addressID"] != null)		{			if(myForm.add_line1.value == "" || myForm.add_city.value == "" || myForm.add_country.value == "")			{				alert("Some required address information is missing. Please fill in the missing information and resubmit.");				return false;			}			if(			(myForm.add_country.value == "USA" || myForm.add_country.value == "Canada") && 			(myForm.add_stateProvince.value == "" || myForm.add_postalCode.value == "")			)			{				alert("Postal addresses in the United States and Canada require a state, or province, and a postal code. Please fill in the missing information and resubmit.");				return false;			}						addArray		+= "addressID:" + cleanArrayStr(myForm.add_addressID.value);			addArray		+= "|isVisible:";			if(myForm.add_isVisible.checked == true)			{				addArray		+= "1";			}			else			{				addArray		+= "0";			}			addArray		+= "|label:" + cleanArrayStr(myForm.add_label.value);			addArray		+= "|line1:" + cleanArrayStr(myForm.add_line1.value);			addArray		+= "|line2:" + cleanArrayStr(myForm.add_line2.value);			addArray		+= "|line3:" + cleanArrayStr(myForm.add_line3.value);			addArray		+= "|city:" + cleanArrayStr(myForm.add_city.value);			addArray		+= "|stateProvince:" + cleanArrayStr(myForm.add_stateProvince.value);			addArray		+= "|postalCode:" + cleanArrayStr(myForm.add_postalCode.value);			addArray		+= "|country:" + cleanArrayStr(myForm.add_country.value) + ";";			myForm.elements["region"].value = determineRegion(myForm.add_stateProvince.value, myForm.add_postalCode.value, myForm.add_country.value);		}			}	myForm.elements["addresses"].value = addArray;			var ciArray	= "";	if(myForm.elements["ci_contactInfoID"].length != null)	{		for(j=0;j<myForm.elements["ci_contactInfoID"].length; j++)		{			if(myForm.ci_type[j].value == "" || myForm.ci_info[j].value == "")			{				alert("Your primary email address or some other required contact information is missing. Please fill in the missing information and resubmit.");				return false;			}     		if((myForm.ci_type[j].value == "L" || myForm.ci_type[j].value == "E"))      		{     			var trimmedEmail = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type[j].value == "U")      		{     			var trimmedURL = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}			ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.ci_contactInfoID[j].value);			ciArray		+= "|isVisible:";			if(myForm.ci_isVisible[j].checked == true  || myForm.ci_isVisible[j].value == "login")			{				ciArray		+= "1";			}			else			{				ciArray		+= "0";			}			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type[j].value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label[j].value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info[j].value) + ";";		}	}	else	{		if(myForm.elements["ci_contactInfoID"] != null)		{			if(myForm.ci_type.value == "" || myForm.ci_info.value == "")			{				alert("Your primary email address or some other required contact information is missing. Please fill in the missing information and resubmit.");				return false;			}     		if((myForm.ci_type.value == "L" || myForm.ci_type.value == "E"))      		{     			var trimmedEmail = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type.value == "U")      		{     			var trimmedURL = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}			ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.ci_contactInfoID.value);			ciArray		+= "|isVisible:";			if(myForm.ci_isVisible.checked == true  || myForm.ci_isVisible.value == "login")			{				ciArray		+= "1";			}			else			{				ciArray		+= "0";			}			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type.value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label.value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info.value) + ";";		}	}	myForm.elements["contactInfos"].value = ciArray;	if(myForm.elements["code"].value == 0)	{		alert("Please enter a code for this new member.");		return false;	}		if(myForm.elements["year"].value == 0)	{		alert("Please enter a year for this new member.");		return false;	}	if(myForm.elements["monthJoined"].value == 0)	{		alert("Please enter a month joined for this new member.");		return false;	}	return true;}//I really fucking hate these scripts...//really need to break the validation into smaller funcions...function myCreateSubmit(){	var myForm		= document.forms["memberForm"];	var lpArray	= "";	if(myForm.elements["lp_lifetimePaymentID"] != null)	{        if(myForm.elements["lp_lifetimePaymentID"].length != null)        {            for(j=0;j<myForm.elements["lp_lifetimePaymentID"].length; j++)            {                lpArray		+= "lifetimePaymentID:" + cleanArrayStr(myForm.lp_lifetimePaymentID[j].value);                lpArray		+= "|memberID:" + cleanArrayStr(myForm.lp_memberID[j].value);                lpArray		+= "|payDate:" + cleanArrayStr(myForm.lp_payDate[j].value);                lpArray		+= "|comment:" + cleanArrayStr(myForm.lp_comment[j].value) + ";";            }        }        else        {            lpArray		+= "lifetimePaymentID:" + cleanArrayStr(myForm.lp_lifetimePaymentID.value);            lpArray		+= "|memberID:" + cleanArrayStr(myForm.lp_memberID.value);            lpArray		+= "|payDate:" + cleanArrayStr(myForm.lp_payDate.value);            lpArray		+= "|comment:" + cleanArrayStr(myForm.lp_comment.value) + ";";        }	}	myForm.elements["lifetimePayments"].value = lpArray;		var addArray	= "";	if(myForm.elements["add_addressID"] != null)	{		if(		((myForm.add_line1.value != "") && (myForm.add_city.value == "" || myForm.add_stateProvince.value == "" || myForm.add_postalCode.value == "")) ||		((myForm.add_city.value != "") && (myForm.add_line1.value == "" || myForm.add_stateProvince.value == "" || myForm.add_postalCode.value == "")) ||		((myForm.add_stateProvince.value != "") && (myForm.add_line1.value == "" || myForm.add_city.value == "" || myForm.add_postalCode.value == "")) ||		((myForm.add_postalCode.value != "") && (myForm.add_line1.value == "" || myForm.add_city.value == "" || myForm.add_stateProvince.value == ""))		)		{			alert("Some required address information is missing. Please fill in the missing information and resubmit.");			return false;		}				addArray		+= "addressID:" + cleanArrayStr(myForm.add_addressID.value);		addArray		+= "|isVisible:";		if(myForm.add_isVisible != null && myForm.add_isVisible.checked == true)		{			addArray		+= "1";		}		else		{			addArray		+= "0";		}		if(myForm.add_label != null)		{			addArray		+= "|label:" + cleanArrayStr(myForm.add_label.value);		}		else		{			addArray		+= "|label:Main";		}		addArray		+= "|line1:" + cleanArrayStr(myForm.add_line1.value);		addArray		+= "|line2:" + cleanArrayStr(myForm.add_line2.value);		addArray		+= "|line3:" + cleanArrayStr(myForm.add_line3.value);		addArray		+= "|city:" + cleanArrayStr(myForm.add_city.value);		addArray		+= "|stateProvince:" + cleanArrayStr(myForm.add_stateProvince.value);		addArray		+= "|postalCode:" + cleanArrayStr(myForm.add_postalCode.value);		addArray		+= "|country:" + cleanArrayStr(myForm.add_country.value) + ";";		myForm.elements["region"].value = determineRegion(myForm.add_stateProvince.value, myForm.add_postalCode.value, myForm.add_country.value);	}	myForm.elements["addresses"].value = addArray;			var ciArray	= "";	if(myForm.elements["ci_contactInfoID"].length != null)	{		for(j=0;j<myForm.elements["ci_contactInfoID"].length; j++)		{			if((myForm.ci_type[j].value != "" && myForm.ci_info[j].value == "") || (myForm.ci_type[j].value == "" && myForm.ci_info[j].value != "") || (myForm.ci_type[j].value == "L" && myForm.ci_info[j].value == ""))			{				alert("A primary email address or some required contact information is missing. Please fill in the missing information and resubmit.");				return false;			}     		if((myForm.ci_type[j].value == "L" || myForm.ci_type[j].value == "E"))      		{     			var trimmedEmail = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type[j].value == "U")      		{     			var trimmedURL = myForm.ci_info[j].value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}			ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.ci_contactInfoID[j].value);			ciArray		+= "|isVisible:";			if(myForm.ci_isVisible[j].checked == true  || myForm.ci_isVisible[j].value == "login")			{				ciArray		+= "1";			}			else			{				ciArray		+= "0";			}			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type[j].value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label[j].value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info[j].value) + ";";		}	}	else	{		if(myForm.elements["ci_contactInfoID"] != null)		{			if((myForm.ci_type.value != "" && myForm.ci_info.value == "") || (myForm.ci_type.value == "" && myForm.ci_info.value != "") || (myForm.ci_type.value == "L" && myForm.ci_info.value == ""))			{				alert("Your primary email address or some required contact information is missing. Please fill in the missing information and resubmit.");				return false;			}     		if((myForm.ci_type.value == "L" || myForm.ci_type.value == "E"))      		{     			var trimmedEmail = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedEmail.search(emailRegEx) == -1)     			{          			alert("Please enter a valid email address.");          			return false;          		}     		}     		if(myForm.ci_type.value == "U")      		{     			var trimmedURL = myForm.ci_info.value.replace(/^\s+|\s+$/g, '') ;     			if(trimmedURL.search(httpRegEx) == -1)     			{					alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");					return false;				}     		}			ciArray		+= "contactInfoID:" + cleanArrayStr(myForm.ci_contactInfoID.value);			ciArray		+= "|isVisible:";			if(myForm.ci_isVisible.checked == true  || myForm.ci_isVisible.value == "login")			{				ciArray		+= "1";			}			else			{				ciArray		+= "0";			}			ciArray		+= "|type:" + cleanArrayStr(myForm.ci_type.value);			ciArray		+= "|label:" + cleanArrayStr(myForm.ci_label.value);			ciArray		+= "|info:" + cleanArrayStr(myForm.ci_info.value) + ";";		}	}	myForm.elements["contactInfos"].value = ciArray;	if(myForm.elements["code"].value == 0)	{		alert("Please enter a code for this new member.");		return false;	}		if(myForm.elements["year"].value == 0)	{		alert("Please enter a year for this new member.");		return false;	}	if(myForm.elements["monthJoined"].value == 0)	{		alert("Please enter a month joined for this new member.");		return false;	}	return true;}function myPageSubmit(){	alert("Depending on the size and number of files you have chosen to upload, the page may take a long time to refresh. \n\n Do not click other links on the page or use your back button while the files are uploading. \n\n Please be patient and allow the page to refresh on its own.");}function determineRegion(state, pc, country){    var thisState = state;    var thisPostalCode = pc;    var thisCountry = country;    if(thisCountry != "USA" && thisCountry != "Canada")    {        return "9";    }    if (thisState == "AL")    {        return "4";    }    if (thisState == "AK")    {        return "8";    }    if (thisState == "AZ")    {        return "7";    }    if (thisState == "AR")    {        return "6";    }    if (thisState == "CA")    {        if (thisPostalCode >= "93500")        {            return "8";        }        else        {            return "7";        }	    }    if (thisState == "CO")    {        return "7";    }    if (thisState == "CT")    {        return "1";    }    if (thisState == "DE")    {        return "3";    }    if (thisState == "DC")    {        return "3";    }    if (thisState == "FL")    {        return "4";    }    if (thisState == "GA")    {        return "4";    }    if (thisState == "HI")    {        return "7";    }    if (thisState == "ID")    {        return "8";    }    if (thisState == "IL")    {        return "5";    }    if (thisState == "IN")    {        return "5";    }    if (thisState == "IA")    {        return "5";    }    if (thisState == "KS")    {        return "6";    }    if (thisState == "KY")    {        return "4";    }    if (thisState == "LA")    {        return "4";    }    if (thisState == "ME")    {        return "1";    }    if (thisState == "MD")    {        return "3";    }    if (thisState == "MA")    {        return "1";    }    if (thisState == "MI")    {        return "5";    }    if (thisState == "MN")    {        return "5";    }    if (thisState == "MS")    {        return "4";    }    if (thisState == "MO")    {        return "6";    }    if (thisState == "MT")    {        return "8";    }    if (thisState == "NE")    {        return "6";    }    if (thisState == "NV")    {        return "7";    }    if (thisState == "NH")    {        return "1";    }    if (thisState == "NJ")    {        return "2";    }    if (thisState == "NM")    {        return "7";    }    if (thisState == "NY")    {        return "2";    }    if (thisState == "NC")    {        return "4";    }    if (thisState == "ND")    {        return "5";    }    if (thisState == "OH")    {        return "5";    }    if (thisState == "OK")    {        return "6";    }    if (thisState == "OR")    {        return "8";    }    if (thisState == "PA")    {        return "3";    }    if (thisState == "RI")    {        return "2";    }    if (thisState == "SC")    {        return "4";    }    if (thisState == "SD")    {        return "5";    }    if (thisState == "TN")    {        return "4";    }    if (thisState == "TX")    {        return "6";    }    if (thisState == "UT")    {        return "7";    }    if (thisState == "VT")    {        return "1";    }    if (thisState == "VA")    {        return "3";    }    if (thisState == "WA")    {        return "8";    }    if (thisState == "WV")    {        return "3";    }    if (thisState == "WI")    {        return "5";    }    if (thisState == "WY")    {        return "8";    }	    //The Canadians	    if (thisState == 'AB')    {        return "8";        //$country="CANADA"    }	        if (thisState == 'BC')    {        return "8";        //$country="CANADA"    }            if (thisState == 'MB')    {        return "5";        //$country="CANADA"    }            if (thisState == 'NB')    {        return "1";        //$country="CANADA"    }	        if (thisState == 'NL')    {        return "1";        //$country="CANADA"    }	        if (thisState == 'NS')    {        return "1";        //$country="CANADA"    }        if (thisState == 'ON')    {        return "5";        //$country="CANADA"    }        if (thisState == 'PE')    {        return "1";        //$country="CANADA"    }        if (thisState == 'QC')    {        return "1";        //$country="CANADA"    }    if (thisState == 'SK')    {        return "8";        //$country="CANADA"    }}function addAnAlternativeForm(formName){	if(good2Go())	{		document.forms[formName].submit();	}	return false;}function submitListServForm(formName){	if(good2Go())	{		document.forms[formName].submit();	}	return false;}function submitAlternativeForm(formName){	var myForm		= document.forms[formName];	if(formName == "addContactInfo")	{		if(myForm.elements["type"].value == "" || myForm.elements["info"].value == "")		{			alert("Some required information is missing. Please fill in the missing information and resubmit.");			return false;		}		if(myForm.elements["type"].value == "E" && myForm.elements["info"].value.search(emailRegEx) == -1) 		{			alert("Please enter a valid email address.");			return false;		}		if(myForm.elements["type"].value == "U" && myForm.elements["info"].value.search(httpRegEx) == -1) 		{			alert("Please enter a valid web page address. \n\n A common error is to enter www.domainName.com.  Remember that all website addresses (URLs) must begin with \"http://\"");			return false;		}	}	if(formName == "addAddressInfo")	{		if(myForm.line1.value == "" || myForm.city.value == "" || myForm.stateProvince.value == "" || myForm.postalCode.value == "")		{			alert("Some required address information is missing. Please fill in the missing information and resubmit.");			return false;		}	}	    if(formName == "massEmailForm")	{		if(myForm.emailGroup.value == "")		{			alert("Please choose an SCI group to send your email to.");			return false;		}				if(myForm.emailRegion.value == "")		{			alert("Please select a which region you wish to target with your email.");			return false;		}				if(myForm.emailSubject.value == "")		{			alert("The Subject line cannot be blank.");			return false;		}		if(myForm.emailMessage.value == "")		{			alert("The Email Message cannot be blank. Please fill in the missing information and resubmit.");			return false;		}				}		return true;}function submitSearchForm(formName){	var myForm		= document.forms[formName];	if(formName == "memberSearchForm")	{		if(myForm.elements["memberSearch"].value == "" || myForm.elements["memberSearch"].value == null)		{			alert("Empty search strings are not allowed. Please enter some text in the search field and resubmit.");			return false;		}	}	if(formName == "scionSearchForm")	{		if(myForm.elements["scionSearch"].value == "" || myForm.elements["scionSearch"].value == null)		{			alert("Empty search strings are not allowed. Please enter some text in the search field and resubmit.");			return false;		}	}	if(formName == "advancedSearchForm")	{		if(			myForm.elements["firstName"].value == "" && 			myForm.elements["lastName"].value == "" &&			myForm.elements["memberID"].value == "" && 			myForm.elements["region"].value == "" &&			myForm.elements["mainEmail"].value == "" && 			myForm.elements["code"].value == ""		  )		{			alert("Empty search strings are not allowed. Please enter some text in the search field and resubmit.");			return false;		}	}	return true;}function deleteMemberCheck(formName){	if(good2Go())	{		if(confirm('Are you sure you want to delete this member?'))		{			document.forms[formName].submit();		}	}}function deletePageCheck(formName){	if(good2Go())	{		if(confirm('Are you sure you want to delete your mySCI Webpage? \n\n Click \"OK\" to delete your mySCI Webpage or \"Cancel\" to continue without deleting your mySCI Webpage.'))		{			document.forms[formName].submit();			return true;		}	}	return false;}function deleteWorkCheck(formName, wid){	if(good2Go())	{		if(confirm('Are you sure you want to delete this work?'))		{			document.forms[formName].elements['workID'].value = wid;			document.forms[formName].submit();			document.forms[formName].submit();		}	}}function deleteAddressCheck(formName, aid){	if(good2Go())	{		if(confirm('Are you sure you want to delete this address?'))		{			document.forms[formName].elements['addressID'].value=aid;			document.forms[formName].submit();			return false;		}	}}function deleteContactInfoCheck(formName, cid){	if(good2Go())	{		if(confirm('Are you sure you want to delete this contact info?'))		{			document.forms[formName].elements['contactInfoID'].value=cid;			document.forms[formName].submit();			return false;		}	}}function deleteScionCheck(formName){	if(good2Go())	{		if(confirm('Are you sure you want to delete this Scion Opportunity?'))		{			document.forms[formName].submit();			return false;		}	}}function replaceBanner(imageURL) {    theMast = document.getElementById("masthead");	theMast.style.backgroundImage = "url(" + imageURL + ")";}function randomizeBanner() {		var theImages = new Array();	theImages[0] = '/images/banners/banner1372a.jpg';	theImages[1] = '/images/banners/banner1372b.jpg';	theImages[2] = '/images/banners/banner1373a.jpg';	theImages[3] = '/images/banners/banner1373b.jpg';	theImages[4] = '/images/banners/banner1374.jpg';	theImages[5] = '/images/banners/banner1376.jpg';	theImages[6] = '/images/banners/banner1377.jpg';	theImages[7] = '/images/banners/banner1378a.jpg';	theImages[8] = '/images/banners/banner1378b.jpg';	theImages[9] = '/images/banners/banner1385a.jpg';	theImages[10] = '/images/banners/banner1385b.jpg';		var p = theImages.length;	var whichImage = Math.round(Math.random()*(p-1));		theMast = document.getElementById("masthead");	theMast.style.backgroundImage = "url(" + theImages[whichImage] + ")";}function replacePageLabel(theText) {	theLabel = document.getElementById("pageLabel");	if (theText == "") {		theLabel.innerHTML = "";	}	else {		theLabel.innerHTML = "<h4>" + theText + "</h4>";	}}function popUp(URL) {    day = new Date();    id = day.getTime();    eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=625,height=540,left = 327.5,top = 242');");}/* check for Paypal */function myChapterPayPal(){	var myForm		= document.forms["PaypalChapter"];		if(myForm.elements["os0"].value == "")	{		alert("Please select an SCI Student Chapter for this membership.");		return false;	}	return true}/*	    if(formName == "massEmailForm")	{		if(myForm.emailGroup.value == "")		{			alert("Please choose an SCI group to send your email to.");			return false;		}		*//* these are the visual display elements from moo.fx */var bodyAccordion;window.addEvent('domready', function() {	//create our Accordion instance on Body Elements	bodyAccordion = new Accordion('a.menuPopperBody', 'div.menuPopOutBody', {		opacity: false,		onActive: function(menuPopperBody, menuPopOutBody){			menuPopperBody.setStyle('color', '#f79239');		},		onBackground: function(menuPopperBody, menuPopOutBody){			menuPopperBody.setStyle('color', '#094fa3');		}	});});var myAccordion;window.addEvent('domready', function() {	//create our Accordion instance	myAccordion = new Accordion('a.menuPopper', 'ul.menuPopOut', {		opacity: false,		onActive: function(menuPopper, menuPopOut){			menuPopper.setStyle('color', '#f79239');		},		onBackground: function(menuPopper, menuPopOut){			menuPopper.setStyle('color', '#094fa3');		}	});}); /* window.addEvent('domready', function() {	bodyAccordion.display();}); */window.addEvent('domready', function() {    var SCIsection = 0 ;	var SCIdir = location.href.replace(/^http:\/\/[^\/]+\/([^\/]+).*$/i, "$1") ;	switch ( SCIdir ){		case "about": SCIsection=0; break;		case "join": SCIsection=1; break;		case "conferences": SCIsection=2; break;		case "mysci": SCIsection=3; break;		case "students": SCIsection=4; break;		case "publications": SCIsection=5; break;	}	myAccordion.display(SCIsection);}); /* The functions below are for the CSS pop-Window *//* for pop up window (McFerron) */function toggle(div_id) {	var el = document.getElementById(div_id);	if ( el.style.display == 'none' ) {	el.style.display = 'block';}		else {el.style.display = 'none';}}function PopUpBlanket_size(popUpDivVar) {		if (typeof window.innerWidth != 'undefined') {		viewportheight = window.innerHeight;	} else {		viewportheight = document.documentElement.clientHeight;	}		if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {		PopUpBlanket_height = viewportheight;	} else {		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {			PopUpBlanket_height = document.body.parentNode.clientHeight;		} else {			PopUpBlanket_height = document.body.parentNode.scrollHeight;		}}	var PopUpBlanket = document.getElementById('PopUpBlanket');	PopUpBlanket.style.height = PopUpBlanket_height + 'px';	var popUpDiv = document.getElementById(popUpDivVar);	popUpDiv_height=PopUpBlanket_height/2-150;//150 is half popup's height	popUpDiv.style.top = popUpDiv_height + 'px';	}function window_pos(popUpDivVar) {	if (typeof window.innerWidth != 'undefined') {		viewportwidth = window.innerHeight;	} else {		viewportwidth = document.documentElement.clientHeight;	}	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {		window_width = viewportwidth;	} else {		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {			window_width = document.body.parentNode.clientWidth;		} else {			window_width = document.body.parentNode.scrollWidth;		}	}	var popUpDiv = document.getElementById(popUpDivVar);	window_width=window_width/2-150;		/*150 is half popups width*/			popUpDiv.style.left = window_width + 'px';}function popup(windowname) {	PopUpBlanket_size(windowname);	window_pos(windowname);	toggle('PopUpBlanket');	toggle(windowname);		}//* END POP-UP SCRIPTS *//
