// Submit the given form if the given value is not empty
function submitForm(form,value) {
					
	if (value != "") {
		form.submit();
	}
}

// change the counselor form's register value, update the action and submit the form
function updateStateSubmit(form,registerInput,thisValue) {
					
	if (thisValue != "") {
		registerInput.value = 0;
		form.action = form.action + "#contactinfo";
		form.submit();
	}
}

// set the returnPageParams for the Career Planner login and then submit the form.
function set_CareerPlannerParams_submit(form,interests,goals,educational) {
	
	// set the params hidden field.
	form.returnPageParams.value="interestsSkills=" + escape(interests) +
		 "&GoalSetting=" + escape(goals) + "&EducationalRequirements=" + escape(educational);
		 
	// submit form.
	form.submit();

}


// reset the exiting global js var and submit form (used for forms on index page for
// the survey popup
function not_exiting_submit(form,url) {
	
	if (exiting) {
	
		exiting = false;
	}
	
	form.action = url;
	form.submit();
}


// Change the action of the form to include the anchor 
// for the next step, then increase the step value and submit the advanced search form 
// and load the next step
function submitAdvanceSearch(form,value,formStepInput,thisStep,nextStepName,alreadyLoadingInput) {
	
		// If form is already loading the next step, dont
		// let them select anything else until the page loads.
		//if (alreadyLoadingInput.value == 'yes') {
			//alert("Please wait for the search form to reload from your previous selection before proceeding");
			//return false;
		//}
	
		// submit the form and reload the page only if this isn't the last step
		if (thisStep < 4) {
			
			// if this is step 3 (tuition) make sure both tuition select boxes 
			// are entered before submitting the form
			if (thisStep != 3 ||
				(form.tuitionCombined.selectedIndex != 0)) {
				
				// reset all the form values in steps after the one being changed
				if (thisStep == 1) {
					
					if (form.stateprovinces) form.stateprovinces.selectedIndex = -1;
					if (form.tuitionCombined) form.tuitionCombined.selectedIndex = -1;
					if (form.enrollment) form.enrollment.selectedIndex = -1;
				}
				else if (thisStep == 2) {
					
					if (form.tuitionCombined) form.tuitionCombined.selectedIndex = -1;
					if (form.enrollment) form.enrollment.selectedIndex = -1;
				}
				else if (thisStep == 3) {
					
					if (form.enrollment) form.enrollment.selectedIndex = -1;
				}
				
				// increment the step only if the value isn't empty
				if (value != "") {
					formStepInput.value = thisStep+1;
				}
				else {
					formStepInput.value = thisStep;
				}
				
				// set the form to be already loading
				alreadyLoadingInput.value = 'yes';
			
				// update the form action
				form.action = "./search_advance.cfm#" + nextStepName;
				
				form.submit();
			}
		}

}


// popup new window with overview showing
function overview_popup (instid)
{
		var newwin, page, myHeight, myWidth, info;
		
		if (navigator.appName == 'Netscape') {
			page = "./overview.cfm?instid="+instid;
		}
		else {
			page = "./overview.cfm?instid="+instid;
		}
		
		myHeight = 400;
		myWidth = 500;
		info = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+myWidth+",height="+myHeight;

		newwin = window.open(page,"ControlWindow",info);
		newwin.open (page,"ControlWindow",info);
		if (newwin.opener == null) newwin.opener = self;
		newwin.focus();
}


// popup new window for Virtual Tour
function vtWindow (url,toolToggle,scrollToggle)
{
	window.open(url,"myPopUpWin","toolbar="+toolToggle+",location=no," + 
		"directories=no,status=yes,scrollbars="+scrollToggle+",resizable=yes," + 
		"width=600,height=600");
}


// popup new window for Related Careers list
function CareersWindow (url, height, width)
{
	var newwin, myHeight, myWidth;
	
	if (height && width && height != '' && width != '') {
		myHeight = height;
		myWidth = width;
	}
	else {
		myHeight = 400;
		myWidth = 250;
	}
	newwin = window.open(url,"myPopUpWin","toolbar=no,location=no," + 
		"directories=no,status=yes,scrollbars=yes,resizable=yes," + 
		"width="+myWidth+",height="+myHeight);
		
	newwin.open(url,"myPopUpWin","toolbar=no,location=no," + 
		"directories=no,status=yes,scrollbars=yes,resizable=yes," + 
		"width="+myWidth+",height="+myHeight);
		
	if (newwin.opener == null) newwin.opener = self;
	newwin.focus();
}


// close the popup window and redirect the main window to the new
// location.  If there is no main window, open a new one.
function close_window_redirect_main(url) {

	var newwin, myHeight, myWidth, info;
	
	myHeight = 500;
	myWidth = 825;
	info = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width="+myWidth+",height="+myHeight;

	if (top.opener == null || top.opener == top || !top.opener || top.opener.closed) {
	
		// open new window
		newwin = window.open(url,"NewWin",info);
		newwin.open (url,"NewWin",info);
		if (newwin.opener == null) newwin.opener = self;
		newwin.focus();
		top.window.close();
	}
	else {
		// use current parent window	
		top.opener.location = url;
		top.opener.focus();
		top.close();
	}

}


// --------= BEGIN FUNCTIONS FOR REGISTRATION FORM =--------

function InputCheck(cfgarbage1, cfgarbage2, inputstring)
   {
   var str = inputstring;
   // Return false if characters are not in allowed set.
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch) && (ch != '-') && (ch != '_'))
         {
         return false;
         }
      }
   return true;
   }
   
function _CF_onError(form_object, input_object, object_value, error_message)
    {
	alert(error_message);
       	return false;	
    }

function _CF_hasValue(obj, obj_type)
{
	if (obj_type == "TEXT" || obj_type == "PASSWORD")
	{
		if (obj.value.length == 0) {
			return false;
		} else {
			return true;
		}
	} else if (obj_type == "SELECT") {
		for (i=0; i < obj.length; i++)
		{
			if (obj.options[i].selected && obj.value != "")
				return true;
		}		
		return false;	
	} else if (obj_type == "SINGLE_VALUE_RADIO" || obj_type == "SINGLE_VALUE_CHECKBOX") {
		if (obj.checked)
			return true;
		else
			return false;	
	} else if (obj_type == "RADIO" || obj_type == "CHECKBOX") {
		for (i=0; i < obj.length; i++)
		{
			if (obj[i].checked)
				return true;
		}
		return false;	
	}
}

function ltrim(str)
{
  re=/^ +/;
  var newstr=str.replace(re, "");
  return(newstr);
}
function rtrim(str)
{
  re=/ +$/;
  var newstr=str.replace(re, "");
  return(newstr);
}
function trim(str)
{
  var newstr=ltrim(str);
  return(rtrim(newstr));
}

function isCharacter(vString) {
	vString = trim(vString);
	if (vString == "")
		return false;
	var validChars = ".1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ ";
	for ( var i = new Number(0); i < vString.length; i++ )
		if (validChars.indexOf(vString.substring(i,i+1)) == -1)
			return false;
	return true;
}

function checkRegisterForm(form) {
		

if  (!_CF_hasValue(form.first_name, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.first_name, form.first_name.value, "You must enter a first name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.first_name, form.first_name.value))
        {
        if  (!_CF_onError(form, form.first_name, form.first_name.value, "You must enter a first name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.last_name, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.last_name, form.last_name.value, "You must enter a last name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.last_name, form.last_name.value))
        {
        if  (!_CF_onError(form, form.last_name, form.last_name.value, "You must enter a last name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.email_value, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.email_value, form.email_value.value, "You must enter a valid email."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuDOBmon, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBmon, form.StuDOBmon.value, "You must enter the month that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBmon, form.StuDOBmon.value))
        {
        if  (!_CF_onError(form, form.StuDOBmon, form.StuDOBmon.value, "You must enter the month that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuDOBday, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBday, form.StuDOBday.value, "You must enter the day that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBday, form.StuDOBday.value))
        {
        if  (!_CF_onError(form, form.StuDOBday, form.StuDOBday.value, "You must enter the day that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuDOByear, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOByear, form.StuDOByear.value, "You must enter the year that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOByear, form.StuDOByear.value))
        {
        if  (!_CF_onError(form, form.StuDOByear, form.StuDOByear.value, "You must enter the year that you were born. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
// If stuDOBoutsideUSA has not been checked, then city and prov MUST be filled out
if (!form.stuDOBoutsideUSA.checked) {
	
if  (!_CF_hasValue(form.StuDOBcity, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBcity, form.StuDOBcity.value, "You must enter the city in the USA where you were born, or else check the box that you were born outside of the USA. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBcity, form.StuDOBcity.value))
        {
        if  (!_CF_onError(form, form.StuDOBcityame, form.StuDOBcity.value, "You must enter the city in the USA where you were born, or else check the box that you were born outside of the USA. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuDOBprov, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBprov, form.StuDOBprov.value, "You must enter the state in the USA where you were born, or else check the box that you were born outside of the USA. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBprov, form.StuDOBprov.value))
        {
        if  (!_CF_onError(form, form.StuDOBprov, form.StuDOBprov.value, "You must enter the state in the USA where you were born, or else check the box that you were born outside of the USA. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
}  // end if stuDOBoutsideUSA isn't checked.
if  (!_CF_hasValue(form.StuGradmon, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuGradmon, form.StuGradmon.value, "You must enter a graduation month. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuGradmon, form.StuGradmon.value))
        {
        if  (!_CF_onError(form, form.StuGradmon, form.StuGradmon.value, "You must enter a graduation month. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuGradyear, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuGradyear, form.StuGradyear.value, "You must enter a graduation year. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuGradyear, form.StuGradyear.value))
        {
        if  (!_CF_onError(form, form.StuGradyear, form.StuGradyear.value, "You must enter a graduation year. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
	
// bottom form
if  (!_CF_hasValue(form.login_name, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.login_name, form.login_name.value, "You must enter a user name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.login_name, form.login_name.value))
        {
        if  (!_CF_onError(form, form.login_name, form.login_name.value, "You must enter a user name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

    if  (!_CF_hasValue(form.password_value, "PASSWORD" )) 
        {
        if  (!_CF_onError(form, form.password_value, form.password_value.value, "You must enter a password. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.password_value, form.password_value.value))
        {
        if  (!_CF_onError(form, form.password_value, form.password_value.value, "You must enter a password. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

    if  (!_CF_hasValue(form.VerifyAnswer, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.VerifyAnswer, form.VerifyAnswer.value, "You must enter an answer to your chosen verification question.  You can use letters, numbers, a space, and a period."))
            {
            return false; 
            }
        }

if  (!isCharacter(form.VerifyAnswer.value))
        {
        if  (!_CF_onError(form, form.VerifyAnswer, form.VerifyAnswer.value, "You must enter an answer to your chosen verification question.  You can use letters, numbers, a space, and a period."))
            {	
            return false; 
            }
        }

    return true;
}



function checkCounselorRegisterForm(form) {
		
if  (!_CF_hasValue(form.first_name, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.first_name, form.first_name.value, "You must enter a first name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.first_name, form.first_name.value))
        {
        if  (!_CF_onError(form, form.first_name, form.first_name.value, "You must enter a first name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.last_name, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.last_name, form.last_name.value, "You must enter a last name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.last_name, form.last_name.value))
        {
        if  (!_CF_onError(form, form.last_name, form.last_name.value, "You must enter a last name. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.high_school, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.high_school, form.high_school.value, "You must enter the name of the High School to which you belong. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.phone, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.phone, form.phone.value, "You must enter your Phone Number (and area code). You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.street, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.street, form.street.value, "You must enter your Street Address. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.zipcode, "TEXT" )) 
        {
        if  (!_CF_onError(form, form.zipcode, form.zipcode.value, "You must enter your Zip/Postal Code. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
	
if  (!_CF_hasValue(form.StuDOBcity, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBcity, form.StuDOBcity.value, "You must enter your City. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBcity, form.StuDOBcity.value))
        {
        if  (!_CF_onError(form, form.StuDOBcityame, form.StuDOBcity.value, "You must enter your City. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }
		
if  (!_CF_hasValue(form.StuDOBprov, "SELECT" )) 
        {
        if  (!_CF_onError(form, form.StuDOBprov, form.StuDOBprov.value, "You must enter your State/Province. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!InputCheck(form, form.StuDOBprov, form.StuDOBprov.value))
        {
        if  (!_CF_onError(form, form.StuDOBprov, form.StuDOBprov.value, "You must enter your State/Province. You may enter only letters, numbers, or - _ characters (no spaces or other punctuation)."))
            {
            return false; 
            }
        }

if  (!_CF_hasValue(form.VerifyAnswer, "TEXT" )) 
    {
    if  (!_CF_onError(form, form.VerifyAnswer, form.VerifyAnswer.value, "You must enter an answer to your chosen verification question.  You can use letters, numbers, a space and a period."))
        {
        return false; 
        }
    }

if  (!isCharacter(form.VerifyAnswer.value))
        {
        if  (!_CF_onError(form, form.VerifyAnswer, form.VerifyAnswer.value, "You must enter an answer to your chosen verification question.  You can use letters, numbers, a space and a period."))
            {	
            return false; 
            }
        }
    return true;
}

// --------= END FUNCTIONS FOR REGISTRATION FORMS =--------


 // is c a String or a character?
function isAlpha(c) {
    // is c a String or a character?
	var letters="abcdefghijklmnopqrstuvwxyz ";
	var LETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    if(c.length>1) {
      for(j=0;j<c.length;j++) {
        // call isAlpha recursively for each character
        alpha=isAlpha(c.substring(j,j+1));
        if(!alpha) return alpha;
      }
      return alpha;
    }
    else {
      // if c is alpha return true
      if(letters.indexOf(c)>=0 || LETTERS.indexOf(c)>=0) return true;
	  
	  alert('Invalid keword!\n The keyword can be composed of letters only, and must contain at least 3 letters');
      return false;
    }
  }


// This function checks to see if an email address is valid
function IsEmailValid(ElemValue)
{
var AtSym    = ElemValue.indexOf('@')
var Period   = ElemValue.lastIndexOf('.')
var Space    = ElemValue.indexOf(' ')
var Length   = ElemValue.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
   {  
	  alert('Invalid email address!\nPlease enter a valid email address.');
	  return false;
   }
else
   {
   	  return true;
   }
}


/*
 * Validates integer strings.
 *
 * Parameter: sInteger - a string to validate as an integer
 * Returns:   true (is integer) or false (is not) boolean
 */
function isInteger(sInteger) {

    var isInt = true;
    inputStr = sInteger.toString(); // in case not a string already
    for (var i = 0; i < inputStr.length; i++) {
        var oneChar = inputStr.charAt(i);
        if (oneChar < "0" || oneChar > "9") {
            isInt = false;
            i = inputStr.length; // break out of loop when bad char found
        }
    } return isInt;
}

/*
 * Validates date strings.
 *
 * Parameter: field    - field containing the date string
 * Internal Calls: isInteger() and isNotBlank()
 * Returns:   true (valid date) or false (not valid) boolean
 */
function isDate(field) {

    var valid = true;
    var sDate = field.value;
    var Slash1Pos = sDate.indexOf("/",0);
    var Slash2Pos = sDate.indexOf("/",Slash1Pos + 1);
    var mm = sDate.substring(0,Slash1Pos);
    var dd = sDate.substring(Slash1Pos + 1,Slash2Pos);
    var yyyy = sDate.substring(Slash2Pos + 1,sDate.length);

    // Validate date
    if (isInteger(mm) == false || isInteger(dd) == false || isInteger(yyyy) == false)
        valid = false;

    if (yyyy.length != 4)
        valid = false;
    else if (mm < 1 || mm > 12)
        valid = false;
    else if (dd < 1 || dd > 31)
        valid = false;
    else if (mm == 2) {
        if (dd > 29)
            valid = false ;
        else if (dd == 29) {
            if (yyyy % 100 == 0 && yyyy % 400 != 0)
                valid = false;
            else if (yyyy % 4 != 0)
                valid = false;
        }
    } else if (mm == 4 || mm == 6 || mm == 9 || mm == 11) {
        if (dd > 30)
            valid = false;
    }

    return valid;
}


function SplitIT ( string, delimiter )
{
  var end;
  var aTemp = new Array ();
  var start = 0;
  var i = 0;
	
  len = string.length;
  while ( i < len )
  {
    end = string.indexOf ( delimiter, start );
    if ( end == -1 )
    {
      aTemp[i++] = string.substring ( start, len );
      return aTemp;
    }
    aTemp[i++] = string.substring ( start, end );
    start = end + 1;
  } return aTemp;
} 


function ValidateForm(theForm) {
	
	var reqList = "";
	var reqTitles = "";
	var fieldType = "";
	var invalid = true;
	var error = "";
	
	if (theForm.RequiredTitles)
	{
		reqTitles = SplitIT(theForm.RequiredTitles.value,",");
	}
	
	if (theForm.Required)
	{
	
		reqList = SplitIT(theForm.Required.value,",");
	
		for (i=0; i < reqList.length; i++) {
			
			invalid = true;
			// check for the field type to check
			fieldType = theForm.elements[reqList[i]].type;
			
			// type is text,password,textarea
			if (fieldType == "text" || fieldType == "password" || fieldType == "textarea")
			{
				if ((theForm.elements[reqList[i]].value).length > 0) {
					invalid = false;
				} else {
					error = "You must enter a value for ";
				}
			}
			// type is select
			if (fieldType == "select-one" || fieldType == "select-multiple")
			{
				if (theForm.elements[reqList[i]].value != "") {
					invalid = false;
				} else {
					error = "You must select a ";
				}
			}
			// type is checkbox
			if (fieldType == "checkbox" || fieldType == "radio")
			{
				if (theForm.elements[reqList[i]].checked == true) {
					invalid = false;
				} else {
					error = "You must select a ";
				}
			}
			
			if (invalid)
			{
				// Field is invalid
				if (reqTitles[i])
				{
					alert(error+''+reqTitles[i]);
				} else {
					alert(error+''+reqList[i]);
				}
				theForm.elements[reqList[i]].focus();
				return false;
			}
		}
		
		return true;
		
	} else {
		return true;
	}
	
}


//	script for budget builder added by Graham Mar. 1 2004 because
//	old scripts for DHTML made by Adrian didn't work in Netscape
//	NOTE:  this script does not fully work in NS4 because NS4 does not
//	support dynamic text unless you are in layers, and even then you
//	need absolute positioning, and EVEN then it is bugggy, so NS4 does
//	not have mouse-over descriptions in the budget builder (however the
//	special case for NS4 is still in the script incase a fix is found to make
//	it work for NS4).

// DHTML scripts added by Graham
// global DHMTL menu vars 
var budgetShow = 0;

// global DHMTL menu vars 
var n4, n6up, ie, tab;
var tabShow = 0;
var initCalled = 0;

// init the browser type
if (document.layers) {
	n4=1;
	n6up=0;
	ie=0;
}
else if (document.all) {
	n4=0;
	n6up=0;
	ie=1;
}
else if (document.getElementById) { 
	n4=0;
	n6up=1;
	ie=0;
}
else {
	n4=0;
	n6up=0;
	ie=0;
}


// show menu
function showBudgetMenu(obj,text) {
                
        if (budgetShow == 0) {
        	if (n4 && typeof document.eval(obj) != "undefined" && document.eval(obj) != null) {
				var thisObj = eval(obj);
				document.layers[obj].document.open();
				document.layers[obj].document.write = text;
				document.layers[obj].document.close();
                document.thisObj = "show";
                budgetShow = 1;
       		}
			if (ie && typeof eval(obj) != "undefined" && eval(obj) != null) {
			    document.all[obj].innerHTML = text;
                eval(obj).style.visibility = "visible";
                budgetShow = 1;
			}
			if (n6up && typeof document.getElementById(obj) != "undefined" 
				&& document.getElementById(obj) != null) {
				document.getElementById(obj).innerHTML = text;
                document.getElementById(obj).style.visibility = "visible";
                budgetShow = 1;
			}
		}
}


// hide menu
function hideBudgetMenu(obj) {
	
        if (budgetShow == 1) {
        	if (n4 && typeof document.eval(obj) != "undefined" && document.eval(obj) != null) {
                var thisObj = eval(obj);
				document.thisObj = "hide";
                budgetShow = 0;
                return;
           	}
			if (ie && typeof eval(obj) != "undefined" && eval(obj) != null) {
                eval(obj).style.visibility = "hidden";
                budgetShow = 0;
                return;
           }
			if (n6up && typeof document.getElementById(obj) != "undefined" 
				&& document.getElementById(obj) != null) {
                document.getElementById(obj).style.visibility = "hidden";
                budgetShow = 0;
                return;
           }
  		}

}

// end DHTML scripts added by Graham.

function firstFocus()
{
   if (document.forms.length > 0)
   {
      var TForm = document.forms[0];
      for (i=0;i<TForm.length;i++)
      {
         if ((TForm.elements[i].type=="text")||
           (TForm.elements[i].type=="textarea")||
           (TForm.elements[i].type.toString().charAt(0)=="s"))
         {
            document.forms[0].elements[i].focus();
            break;
         }
      }
   }
}


// This function does nothing, used in budget builder for the link of the href tags
// which control the dynamic tab layer (so clicking the links does nothing, only
// the mouseovers are used)
function doNothing() {

}

// end Budget Builder scripts


// This function resets the 3 select boxes on the career form in case someone uses the
// browser back buttons.
function resetCareerForm() {

	document.quicksearchform.workgroup.selectedIndex=0;
	document.quicksearchform2.salary.selectedIndex=0;
	document.quicksearchform3.educationReq.selectedIndex=0;
}




