/* Minification failed. Returning unminified contents.
(1,10): run-time error CSS1031: Expected selector, found 'LoadQuickView('
(1,10): run-time error CSS1025: Expected comma or open brace, found 'LoadQuickView('
(6,10): run-time error CSS1031: Expected selector, found 'Load('
(6,10): run-time error CSS1025: Expected comma or open brace, found 'Load('
(17,10): run-time error CSS1031: Expected selector, found 'countChars('
(17,10): run-time error CSS1025: Expected comma or open brace, found 'countChars('
(34,10): run-time error CSS1031: Expected selector, found 'ValidateValueLength('
(34,10): run-time error CSS1025: Expected comma or open brace, found 'ValidateValueLength('
(52,10): run-time error CSS1031: Expected selector, found 'VerifyDate('
(52,10): run-time error CSS1025: Expected comma or open brace, found 'VerifyDate('
(75,10): run-time error CSS1031: Expected selector, found 'ReformatDate('
(75,10): run-time error CSS1025: Expected comma or open brace, found 'ReformatDate('
(108,10): run-time error CSS1031: Expected selector, found 'CheckEmptyString('
(108,10): run-time error CSS1025: Expected comma or open brace, found 'CheckEmptyString('
(117,10): run-time error CSS1031: Expected selector, found 'checkMaxLength('
(117,10): run-time error CSS1025: Expected comma or open brace, found 'checkMaxLength('
(120,10): run-time error CSS1031: Expected selector, found 'ddlRequiredTrigger('
(120,10): run-time error CSS1025: Expected comma or open brace, found 'ddlRequiredTrigger('
(135,10): run-time error CSS1031: Expected selector, found 'changeObjectClass('
(135,10): run-time error CSS1025: Expected comma or open brace, found 'changeObjectClass('
(139,10): run-time error CSS1031: Expected selector, found 'trimWhitespace('
(139,10): run-time error CSS1025: Expected comma or open brace, found 'trimWhitespace('
(144,10): run-time error CSS1031: Expected selector, found 'checkAll('
(144,10): run-time error CSS1025: Expected comma or open brace, found 'checkAll('
(156,10): run-time error CSS1031: Expected selector, found 'checkAllWithState('
(156,10): run-time error CSS1025: Expected comma or open brace, found 'checkAllWithState('
(160,10): run-time error CSS1031: Expected selector, found 'checkAllWithStateClearBG('
(160,10): run-time error CSS1025: Expected comma or open brace, found 'checkAllWithStateClearBG('
(190,10): run-time error CSS1031: Expected selector, found 'endMarkerCheckAllWithState('
(190,10): run-time error CSS1025: Expected comma or open brace, found 'endMarkerCheckAllWithState('
(194,10): run-time error CSS1031: Expected selector, found 'endMarkerCheckAllWithStateClearBG('
(194,10): run-time error CSS1025: Expected comma or open brace, found 'endMarkerCheckAllWithStateClearBG('
(225,10): run-time error CSS1031: Expected selector, found 'checkAllWithState2In('
(225,10): run-time error CSS1025: Expected comma or open brace, found 'checkAllWithState2In('
(248,10): run-time error CSS1031: Expected selector, found 'flipImage('
(248,10): run-time error CSS1025: Expected comma or open brace, found 'flipImage('
(259,10): run-time error CSS1031: Expected selector, found 'confirmSuppressEvent('
(259,10): run-time error CSS1025: Expected comma or open brace, found 'confirmSuppressEvent('
(263,10): run-time error CSS1031: Expected selector, found 'popUpCal('
(263,10): run-time error CSS1025: Expected comma or open brace, found 'popUpCal('
(268,10): run-time error CSS1031: Expected selector, found 'popUpHelpNoParam('
(268,10): run-time error CSS1025: Expected comma or open brace, found 'popUpHelpNoParam('
(273,10): run-time error CSS1031: Expected selector, found 'popUpAdvisorNotes('
(273,10): run-time error CSS1025: Expected comma or open brace, found 'popUpAdvisorNotes('
(279,10): run-time error CSS1031: Expected selector, found 'popUpAdvisorNotesFromMVC('
(279,10): run-time error CSS1025: Expected comma or open brace, found 'popUpAdvisorNotesFromMVC('
(283,10): run-time error CSS1031: Expected selector, found 'popUpSASNotes('
(283,10): run-time error CSS1025: Expected comma or open brace, found 'popUpSASNotes('
(288,10): run-time error CSS1031: Expected selector, found 'popUpEMailAlert('
(288,10): run-time error CSS1025: Expected comma or open brace, found 'popUpEMailAlert('
(292,10): run-time error CSS1031: Expected selector, found 'popUpEMailTagGuide('
(292,10): run-time error CSS1025: Expected comma or open brace, found 'popUpEMailTagGuide('
(296,10): run-time error CSS1031: Expected selector, found 'popUpSelectEdit('
(296,10): run-time error CSS1025: Expected comma or open brace, found 'popUpSelectEdit('
(301,10): run-time error CSS1031: Expected selector, found 'popUpOneAdvisorNote('
(301,10): run-time error CSS1025: Expected comma or open brace, found 'popUpOneAdvisorNote('
(312,10): run-time error CSS1031: Expected selector, found 'popUpOneAdvisorNoteForInteraction('
(312,10): run-time error CSS1025: Expected comma or open brace, found 'popUpOneAdvisorNoteForInteraction('
(319,10): run-time error CSS1031: Expected selector, found 'popUpAddAddress('
(319,10): run-time error CSS1025: Expected comma or open brace, found 'popUpAddAddress('
(329,10): run-time error CSS1031: Expected selector, found 'popUpApptReminder('
(329,10): run-time error CSS1025: Expected comma or open brace, found 'popUpApptReminder('
(333,10): run-time error CSS1031: Expected selector, found 'popUpHelpWindow('
(333,10): run-time error CSS1025: Expected comma or open brace, found 'popUpHelpWindow('
(346,10): run-time error CSS1031: Expected selector, found 'popUpFormBlastWindow('
(346,10): run-time error CSS1025: Expected comma or open brace, found 'popUpFormBlastWindow('
(402,10): run-time error CSS1031: Expected selector, found 'popUpModalFormBlastWindow('
(402,10): run-time error CSS1025: Expected comma or open brace, found 'popUpModalFormBlastWindow('
(414,10): run-time error CSS1031: Expected selector, found 'cleanUpAfterWindowClosed('
(414,10): run-time error CSS1025: Expected comma or open brace, found 'cleanUpAfterWindowClosed('
(428,10): run-time error CSS1031: Expected selector, found 'popUpFormBlastModalWindow('
(428,10): run-time error CSS1025: Expected comma or open brace, found 'popUpFormBlastModalWindow('
(439,10): run-time error CSS1031: Expected selector, found 'popUpFormLetterWindow('
(439,10): run-time error CSS1025: Expected comma or open brace, found 'popUpFormLetterWindow('
(448,10): run-time error CSS1031: Expected selector, found 'OpenPopUp('
(448,10): run-time error CSS1025: Expected comma or open brace, found 'OpenPopUp('
(453,10): run-time error CSS1031: Expected selector, found 'popUpAbout('
(453,10): run-time error CSS1025: Expected comma or open brace, found 'popUpAbout('
(479,10): run-time error CSS1031: Expected selector, found 'popUpLink('
(479,10): run-time error CSS1025: Expected comma or open brace, found 'popUpLink('
(490,10): run-time error CSS1031: Expected selector, found 'fillMultiLineOptionalDDL('
(490,10): run-time error CSS1025: Expected comma or open brace, found 'fillMultiLineOptionalDDL('
(494,10): run-time error CSS1031: Expected selector, found 'fillCityOfBirth('
(494,10): run-time error CSS1025: Expected comma or open brace, found 'fillCityOfBirth('
(499,10): run-time error CSS1031: Expected selector, found 'fillJCode('
(499,10): run-time error CSS1025: Expected comma or open brace, found 'fillJCode('
(503,10): run-time error CSS1031: Expected selector, found 'fillJCodeOD('
(503,10): run-time error CSS1025: Expected comma or open brace, found 'fillJCodeOD('
(514,10): run-time error CSS1031: Expected selector, found 'guessCity('
(514,10): run-time error CSS1025: Expected comma or open brace, found 'guessCity('
(538,10): run-time error CSS1031: Expected selector, found 'guessJCode('
(538,10): run-time error CSS1025: Expected comma or open brace, found 'guessJCode('
(575,10): run-time error CSS1031: Expected selector, found 'SubjectFieldFillOD('
(575,10): run-time error CSS1025: Expected comma or open brace, found 'SubjectFieldFillOD('
(590,10): run-time error CSS1031: Expected selector, found 'valJCode('
(590,10): run-time error CSS1025: Expected comma or open brace, found 'valJCode('
(615,10): run-time error CSS1031: Expected selector, found 'valJCodeOD('
(615,10): run-time error CSS1025: Expected comma or open brace, found 'valJCodeOD('
(647,10): run-time error CSS1031: Expected selector, found 'valJobCode('
(647,10): run-time error CSS1025: Expected comma or open brace, found 'valJobCode('
(673,10): run-time error CSS1031: Expected selector, found 'fillCityOnFocus('
(673,10): run-time error CSS1025: Expected comma or open brace, found 'fillCityOnFocus('
(680,10): run-time error CSS1031: Expected selector, found 'fillJCodeOnFocus('
(680,10): run-time error CSS1025: Expected comma or open brace, found 'fillJCodeOnFocus('
(687,10): run-time error CSS1031: Expected selector, found 'fillJCodeOnFocusOD('
(687,10): run-time error CSS1025: Expected comma or open brace, found 'fillJCodeOnFocusOD('
(700,10): run-time error CSS1031: Expected selector, found 'isHidden('
(700,10): run-time error CSS1025: Expected comma or open brace, found 'isHidden('
(711,10): run-time error CSS1031: Expected selector, found 'valDate('
(711,10): run-time error CSS1025: Expected comma or open brace, found 'valDate('
(761,10): run-time error CSS1031: Expected selector, found 'valDateWithoutMsg('
(761,10): run-time error CSS1025: Expected comma or open brace, found 'valDateWithoutMsg('
(796,10): run-time error CSS1031: Expected selector, found 'valDateNo1900('
(796,10): run-time error CSS1025: Expected comma or open brace, found 'valDateNo1900('
(826,10): run-time error CSS1031: Expected selector, found 'chkdate('
(826,10): run-time error CSS1025: Expected comma or open brace, found 'chkdate('
(952,10): run-time error CSS1031: Expected selector, found 'LeapYear('
(952,10): run-time error CSS1025: Expected comma or open brace, found 'LeapYear('
(963,10): run-time error CSS1031: Expected selector, found 'valOtherParam('
(963,10): run-time error CSS1025: Expected comma or open brace, found 'valOtherParam('
(987,10): run-time error CSS1031: Expected selector, found 'valNoResChars('
(987,10): run-time error CSS1025: Expected comma or open brace, found 'valNoResChars('
(1003,10): run-time error CSS1031: Expected selector, found 'valNoQuotes('
(1003,10): run-time error CSS1025: Expected comma or open brace, found 'valNoQuotes('
(1004,32): Scanner error CSS1002: Unterminated string: '"]*$/)
(1020,36): Scanner error CSS1002: Unterminated string: ']*$/)
 */
function LoadQuickView(id) {
	var url = '/RecordNavigator/Home/OnClickRecNavRecord?Id=' + id;
	Load(url);
}

function Load(url) {
	$.get(url, function (data) {
		/* data is the pure html returned from action method, load it to your page */
		$('#partialPlaceHolder').html(data);
		/* little fade in effect */
		$('#partialPlaceHolder').fadeIn('fast');
	});
}


// Check the textbox character count and show the remaining character
function countChars(obj, maxlength, element) {
	var maxLength = maxlength;
	var numberOfLineBreaks = (obj.value.match(/\n/g) || []).length;
	var strLength = obj.value.length;
	var charRemain = (maxLength - (strLength + numberOfLineBreaks));


	if (charRemain < 0) {
		document.getElementById(element).innerHTML = '<span style="color: red;">Limit exceeded by ' + ((strLength + numberOfLineBreaks) - maxLength) + ' characters</span>';
		return false;
	}
	else {
		document.getElementById(element).innerHTML = charRemain + ' characters remaining';
		return true;
	}
}

function ValidateValueLength(maxLength, textBoxObject, message) {

	var numberOfLineBreaks = (textBoxObject.val().match(/\n/g) || []).length;
	var strLength = textBoxObject.val().length;
	var charRemain = (maxLength - (strLength + numberOfLineBreaks));

	if (charRemain < 0) {
		event.preventDefault();
		showAlertPopUp(message);
		return false;
	}
	else {
		return true;
	}
}

//Checks if any option is selected in the drop down
//You can use this function with any drop down and custom message
function VerifyDate(date1, date2, message) {

	// AP [Apr-25-2012] - Zen#322 - The Request Start and End Dates for Work Auth OPT, CPT, and Off-Camp do not handle mm/dd/yy format
	date1 = ReformatDate(date1);
	date2 = ReformatDate(date2);

	var tempDate1 = new Date(date1);
	var tempDate2 = new Date(date2);

	if (tempDate2 != '') {
		if (tempDate1 < tempDate2) {
			if (message != '') {
				alert(message);
			}
			return false;
		}
		else {
			return true;
		}
	}
}

// AP [Apr-25-2012] - Zen#322 - The Request Start and End Dates for Work Auth OPT, CPT, and Off-Camp do not handle mm/dd/yy format
function ReformatDate(date1) {

	// if the date field is empty do nothing
	if (date1 != '') {

		// Replace "-" to "/" i.e., if date is 04-22-2012 change it to 04/22/2012
		// this is a very rare case, but still as we will be using split for "/", it better to cross check.
		date1 = date1.replace(/-/gi, "/");

		// Split the Date into array arr[0] = mm,arr[1] = dd, arr[2] = yy
		var arr = date1.split("/");

		// If the Year Part is of length 2, which means by default the JS will cantatenate the value with "19"
		// If the year part is between 0 and 29 then concatenate it with "20"
		// If the year part is between 30 and above then concatenate it with "19"
		// This is to keep the Date functionality in sync with .Net Date Functionality
		if (arr[2] != null) {
			if (arr[2].length == 2) {
				if (arr[2] <= 29) {
					arr[2] = "20" + arr[2];
				}
				else {
					arr[2] = "19" + arr[2];
				}
				// Put Back the date values
				date1 = arr[0] + "/" + arr[1] + "/" + arr[2];
			}
		}
	}

	return date1;
}

function CheckEmptyString(strClientId, message) {
	var tempDdl = document.getElementById(strClientId);
	strDDLValue = new String(tempDdl.options[tempDdl.selectedIndex].value);

	if (strDDLValue == "") {
		alert(message);
		return false;
	}
}
function checkMaxLength(Object, MaxLen) {
	return (Object.value.length < MaxLen);
}
function ddlRequiredTrigger(ddlObj, strCriticalValue, changeObj) {
	// This function is used to check a DDL for a specific
	// value that, if found, sets another object's class
	// to "SEVISCell"

	var strDDLValue;

	strDDLValue = new String(ddlObj.options[ddlObj.selectedIndex].value);

	if (strDDLValue == strCriticalValue)
		changeObjectClass(changeObj, 'SEVISCell');
	else
		changeObjectClass(changeObj, '');
}

function changeObjectClass(cObj, strClassName) {
	cObj.className = strClassName;
}

function trimWhitespace(string) {
	var re = /^\s*|\s*$/g;
	return string.replace(re, "");
}

function checkAll(frmName, strIn, blnState) {
	for (i = 0; i < frmName.elements.length; i++) {
		if ((frmName.elements[i].name.substr(0, strIn.length) == strIn)
			&& (!frmName.elements[i].disabled)) {

			frmName.elements[i].checked = true;

		}
	}
	return false;
}

function checkAllWithState(frmName, strIn, blnState) {
	return checkAllWithStateClearBG(frmName, strIn, blnState, false);
}

function checkAllWithStateClearBG(frmName, strIn, blnState, blnClearBG) {
	for (i = 0; i < frmName.elements.length; i++) {
		if ((frmName.elements[i].name.substr(0, strIn.length) == strIn)
			&& (!frmName.elements[i].disabled)) {
			if (blnState == 'true') {
				frmName.elements[i].checked = true;
			}
			else {
				frmName.elements[i].checked = false;
			}

			if (blnClearBG) {
				//
				// clear the color of the row where these checkboxes are.
				strFormElementsName = new String(frmName.elements[i].name);
				strTableRowID = "TR" + strFormElementsName.substr(3); // the susbstr is the id of the row
				TableRow = document.getElementById(strTableRowID);
				TableRow.style.backgroundColor = "";
			}
		}
	}

	if (blnState == 'true') {
		return false;
	}
	else {
		return true;
	}
}

function endMarkerCheckAllWithState(frmName, strIn, blnState) {
	return endMarkerCheckAllWithStateClearBG(frmName, strIn, blnState, false);
}

function endMarkerCheckAllWithStateClearBG(frmName, strIn, blnState, blnClearBG) {
	for (i = 0; i < frmName.elements.length; i++) {
		if ((frmName.elements[i].name.substr(frmName.elements[i].name.length - strIn.length, (frmName.elements[i].name.length - 1)) == strIn)
			&& (!frmName.elements[i].disabled)) {
			if (blnState == 'true') {
				frmName.elements[i].checked = true;
			}
			else {
				frmName.elements[i].checked = false;
			}

			if (blnClearBG) {
				//
				// clear the color of the row where these checkboxes are.
				strFormElementsName = new String(frmName.elements[i].name);
				strTableRowID = "TR" + strFormElementsName.substr(3); // the susbstr is the id of the row
				TableRow = document.getElementById(strTableRowID);
				TableRow.style.backgroundColor = "";
			}
		}
	}

	if (blnState == 'true') {
		return false;
	}
	else {
		return true;
	}
}


function checkAllWithState2In(frmName, strIn, strIn2, blnState) {


	for (i = 0; i < frmName.elements.length; i++) {
		if ((frmName.elements[i].name.substr(0, strIn.length) == strIn || frmName.elements[i].name.substr(0, strIn2.length) == strIn2)
			&& (!frmName.elements[i].disabled)) {
			if (blnState == 'true') {
				frmName.elements[i].checked = true;
			}
			else {
				frmName.elements[i].checked = false;
			}
		}
	}

	if (blnState == 'true') {
		return false;
	}
	else {
		return true;
	}
}

function flipImage(strDivOn, strDivOff, blnState) {
	if (blnState == 'true') {
		document.getElementById(strDivOn).style.display = 'block';
		document.getElementById(strDivOff).style.display = 'none';
	}
	else {
		document.getElementById(strDivOn).style.display = 'none';
		document.getElementById(strDivOff).style.display = 'block';
	}
}

function confirmSuppressEvent() {
	return confirm('Are you sure you want to suppress this event?');
}

function popUpCal(field, monthNow, yearNow) {

	window.open("subCalendar.asp?Field=" + field + "&Month=" + monthNow + "&Year=" + yearNow, "Cal", "toolbar=false,directories=false,status=false,menubar=false,scrollbars=false,resizable=false,width=200,height=250")
}

function popUpHelpNoParam(fileName) {

	window.open("fsaAtlasHelp/ToolTips/" + fileName + ".asp", "ToolTips", "toolbar=false,directories=false,status=false,menubar=false,resizable,width=300,height=200")
}

function popUpAdvisorNotes(studentId) {
	// SK - [9/Apr/2018]- JIRA#: ISSM-3826 - v9.8.0 - ISSM - CR-000156764 - Migrating Note functionality from classic ASP to ASP.NET
	window.open("AdvisorNoteList.aspx?sysId=" + studentId, "NotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=1200,height=220,left=0,top=0")
}

//9.8.2 changes
function popUpAdvisorNotesFromMVC(studentId) {
	window.open("../../../AdvisorNoteList.aspx?sysId=" + studentId, "NotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=1200,height=220,left=0,top=0")
}

function popUpSASNotes(eventId, noteMode) {
	window.open("subSASNoteList.aspx?EventId=" + eventId + "&Mode=" + noteMode, "SASNotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=850,height=220,left=0,top=0")
	//window.open("subSASNoteList.asp?EventId=" + eventId + "&Mode=" + noteMode, "SASNotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=850,height=220,left=0,top=0")
}

function popUpEMailAlert(alertId) {
	window.open("subViewEMailAlertDetails.asp?AlertId=" + alertId, "AlertView", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=700,height=500")
}

function popUpEMailTagGuide() {
	window.open("ViewContentTags.aspx", "TagGuide", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=400,height=500")
}

function popUpSelectEdit(customId) {
	window.open("CustomFieldSelectFrameSet.asp?customId=" + customId, "CustomEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=450,height=400")
}

// AP - 03-05-2009 - Modal Dialog box to view notes content
function popUpOneAdvisorNote(studentId, noteID) {
	// AP - 07-14-2009 - Defect 1693 - "Page cannot be found" message appears on click of Type value in Interactions tab
	// Included new parameter Interaction for identifing page type
	// AP - 07/03/2009 - Defect 1677 - On click of any "Type" value in Interactions tab, an error page is displayed on the screen

	// SK - [08/Jun/2018]- JIRA#: ISSM-3826 - v9.8.0 - ISSM - CR-000156764 - Migrating Note functionality from classic ASP to ASP.NET
	window.showModalDialog("AdvisorNoteAddEdit.aspx?Mode=Edit&Interaction=N&History=Y&sysId=" + studentId + "&noteId=" + noteID, "NotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=1200,height=220");
}

// AP - 07-14-2009 - Defect 1693 - "Page cannot be found" message appears on click of Type value in Interactions tab
// New method for displaying data In Interaction Tab.
function popUpOneAdvisorNoteForInteraction(studentId, noteID) {
	// AP - 07/03/2009 - Defect 1677 - On click of any "Type" value in Interactions tab, an error page is displayed on the screen
	// AP - 07/17/2009 - Defect 1721 - On Click of email blast or adhoc type value in Interaction tab does not display correct information

	// SK - [08/Jun/2018]- JIRA#: ISSM-3826 - v9.8.0 - ISSM - CR-000156764 - Migrating Note functionality from classic ASP to ASP.NET
	window.open("AdvisorNoteAddEdit.aspx?Mode=Edit&Interaction=Y&History=Y&sysId=" + studentId + "&noteId=" + noteID, "NotesEdit", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable,width=1200,height=220");
}
function popUpAddAddress(link) {
	winwidth = 510; // width of the new window
	winheight = 660; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...

	window.open(link, "AddressInformation", "toolbar=true,directories=false,status=true,menubar=false,scrollbars= false,resizable=false," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
}

function popUpApptReminder(noteID) {
	window.open("ClientSchedulerPrintableAppt.asp?Id=" + noteID, "AppointmentReminder", "toolbar=1,directories=false,status=false,menubar=1,scrollbars,resizable,width=700,height=250")
}

function popUpHelpWindow(link) {
	winwidth = 700; // width of the new window
	winheight = 575; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...

	window.open(link, "HelpSystem", "toolbar=true,directories=false,status=true,menubar=false,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
}
// JK - Display history of emails sent to an individual, via email broadcasts, this is already tracked in the DB; 
// need to show this in the UI, possibly on the Tasks/Notes/Alerts screen as email alerts are already displayed there.  
// Would also need to track emails that get sent via enhancement for RPE 1-JCW5H.
// DEFECT- 1 1-5AZBP & 1-1JC0RY
function popUpFormBlastWindow(link) {
	winwidth = 850; // width of the new window
	winheight = 645; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom

	// the values get inserted into the features parameter of the window.open command...
	if (window.showModalDialog) {

		var bodyElementRef = null;
		//          var currentColor = '';

		var elementArray = document.getElementsByTagName('BODY');
		//          var tbody = document.ownerDocument.getElementsByTagName("frameset")[0];  
		//           alert(tbody);
		//     var tnode = document.createElement('div');           // Create the layer.  
		//         tnode.style.position='absolute';                 // Position absolutely  
		//         tnode.style.top='0px';                           // In the top  
		//         tnode.style.left='0px';                          // Left corner of the page  
		//         tnode.style.overflow='hidden';                   // Try to avoid making scroll bars              
		//         tnode.style.display='none';                      // Start out Hidden  
		//         tnode.id='darkenScreenObject';                   // Name it so we can find it later  
		//     tbody.appendChild(tnode);                            // Add it to the web page  
		//     dark=document.getElementById('darkenScreenObject');  // Get the object.  
		//     dark.style.filter='alpha(opacity=' + 5*10 + ')';


		// AP - 07/03/2009 - Defect 1677 - On click of any "Type" value in Interactions tab, an error page is displayed on the screen
		//          if ( elementArray.length > 0 )
		//          {
		//           bodyElementRef = elementArray[0];
		//           currentColor = bodyElementRef.style.backgroundColor;
		//           bodyElementRef.style.opacity=50/100;
		//           bodyElementRef.style.filter = 'alpha(opacity=' + 5*10 + ')';

		//          }


		// AP - 07/17/2009 - Defect 1721 - On Click of email blast or adhoc type value in Interaction tab does not display correct information
		retVal = window.open(link, "EmailBlast", "toolbar=false,directories=false,status=false,menubar=false,modal=yes,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);


		//if ( retVal != null && controlid != '' )
		// document.getElementById(controlid).value = retVal;               

		//if ( bodyElementRef != null )
		//bodyElementRef.style.backgroundColor = currentColor;


	}
	else
		// AP - 07/17/2009 - Defect 1721 - On Click of email blast or adhoc type value in Interaction tab does not display correct information
		window.open(link, "EmailBlast", "toolbar=false,directories=false,status=false,menubar=false,modal=yes,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);
	//window.open(link,"EmailBlast","toolbar=false,directories=false,status=false,menubar=false,modal=yes,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
}

function popUpModalFormBlastWindow(link) {
	winwidth = 850; // width of the new window
	winheight = 645; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...
	if (window.showModalDialog) {
		retVal = window.showModalDialog(link, "EmailBlast", "toolbar=false,directories=false,status=false,menubar=false,modal=yes,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);
	}
	else
		window.open(link, "EmailBlast", "toolbar=false,directories=false,status=false,menubar=false,modal=yes,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);
}
function cleanUpAfterWindowClosed() {
	var elementArray = window.opener.document.getElementsByTagName('BODY');
	if (elementArray.length > 0) {
		bodyElementRef = elementArray[0];
		currentColor = bodyElementRef.style.backgroundColor;
		bodyElementRef.style.opacity = 100 / 100;
		bodyElementRef.style.filter = 'alpha(opacity=' + 5 * 10 + ')';

	}
}

// JK -- Added this new Function for showing Modal window of new EmailBlast screen 
// due to size and width problem we have kept the window as normal window.open
// 04-24-2009
function popUpFormBlastModalWindow(link) {
	winwidth = 850; // width of the new window
	winheight = 750; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...

	// window.showModalDialog(link,"EmailBlast","toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
	window.open(link, "EmailBlast", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
}

function popUpFormLetterWindow(link) {
	winwidth = 750; // width of the new window
	winheight = 425; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...

	window.open(link, "FormLetter", "toolbar=false,directories=false,status=false,menubar=false,scrollbars,resizable," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)
}
function OpenPopUp(link) {
	//document.getElementById("BatchGuid").value=batchGuid;
	window.open(link);

}
function popUpAbout(link) {
	winwidth = 800; // width of the new window
	winheight = 600; // height of the new window
	var browseWidth, browseHeight;

	if (typeof (window.innerWidth) == 'number') {
		//Non-IE
		browseWidth = window.innerWidth;
		browseHeight = window.innerHeight;
	}
	else if (document.layers) {
		browseWidth = window.outerWidth;
		browseHeight = window.outerHeight;
	}
	else if (document.all) {
		browseWidth = document.body.offsetWidth;
		browseHeight = document.body.offsetHeight;
	}

	winleft = (browseWidth / 2) - (winwidth / 2); // center the window right to left
	wintop = (browseHeight / 2) - (winheight / 2); // center the window top to bottom

	window.open(link, null, "location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=no," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)

}

function popUpLink(link) {

	winwidth = 700; // width of the new window
	winheight = 575; // height of the new window
	winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
	wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
	// the values get inserted into the features parameter of the window.open command...
	window.open(link, null, "location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=no," + 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth)

}

function fillMultiLineOptionalDDL(objText, objSelect) {
	objText.value = objSelect.options[objSelect.selectedIndex].value;
}

function fillCityOfBirth(objText, objSelect) {
	// SK [07-Sep-2020] - v9.8.7 - JIRA#: ISSM-5577 - On selecting black from dropdown after selecting a value before it introduce space.
	objText.value = trimWhitespace(objSelect.options[objSelect.selectedIndex].value);
}

function fillJCode(objText, objSelect) {
	objText.value = objSelect.value;
}

function fillJCodeOD(objText, objSelect) {
	var strSubject;
	var strArray;

	strSubject = objSelect.value;
	strArray = strSubject.split("!!!!");

	objText.value = strArray[0];

}

function guessCity(objText, objSelect) {
	var i, blnFound, subStringVal

	blnNotFound = true;

	for (i = 0; i < objSelect.length; i++) {
		subStringVal = objSelect.options[i].text;
		subStringVal = subStringVal.substring(0, objText.value.length);

		if ((objText.value.toUpperCase() == subStringVal.toUpperCase()) && blnNotFound) {
			objSelect.options[i].selected = true;
			blnNotFound = false;
		}

		if (blnNotFound) {
			objSelect.options[0].selected = true;
		}

		if (objText.value == "") {
			objSelect.options[0].selected = true;
		}
	}
}

function guessJCode(objText, objSelect) {
	var i, blnFound, subStringVal, strODText

	blnNotFound = true;

	for (i = 0; i < objSelect.length; i++) {
		subStringVal = objSelect.options[i].value;
		subStringVal = subStringVal.substring(0, objText.value.length);

		if ((objText.value.toUpperCase() == subStringVal.toUpperCase()) && blnNotFound) {
			objSelect.options[i].selected = true;
			blnNotFound = false;
		}

		if (blnNotFound) {
			objSelect.options[0].selected = true;
		}

		if (objText.value == "") {
			objSelect.options[0].selected = true;
		}
	}
	//RV - [12/feb/2018] - JIRA#:ISSM - 3620(v9.7.1) - CR - 000141523 : Open Doors Major Field of Specialization is not populated.
	//This is specifically used for OpenDoor : Populates field of specialzation from Major/Subject code.
	if (document.getElementById('ctl06_ODFieldSpecialization') != null) {
		strODText = document.getElementById('ctl06_ODFieldSpecialization');
	}
	if (document.getElementById('ctl07_ODFieldSpecialization') != null) {
		strODText = document.getElementById('ctl07_ODFieldSpecialization');
	}
	if (document.getElementById('ctl08_ODFieldSpecialization') != null) {
		strODText = document.getElementById('ctl08_ODFieldSpecialization');
	}
	//SubjectFieldFillOD(strODText, objSelect);
	SubjectFieldFillOD(strODText, objSelect);
}

function SubjectFieldFillOD(objText, objSelect) {
	if (objSelect.value != "") {
		var strSubject;
		var strArray;

		strSubject = objSelect.value;
		strArray = strSubject.split("!!!!");

		objText.value = strArray[1];
	}
	else {
		objText.value = "";
	}
}

function valJCode(objText, objSelect) {
	var i, blnFound, subStringVal

	blnNotFound = true;

	for (i = 0; i < objSelect.length; i++) {
		subStringVal = objSelect.options[i].value;

		if ((objText.value.toUpperCase() == subStringVal.toUpperCase()) && blnNotFound) {
			objSelect.options[i].selected = true;
			blnNotFound = false;
		}

	}

	if (blnNotFound) {
		alert("The J Code must be containted in select list");
		return false;
	}
	else {
		return true;
	}

}

function valJCodeOD(objText, objSelect) {
	var i, blnFound, subStringVal
	var strSubject;
	var strArray;

	blnNotFound = true;

	for (i = 0; i < objSelect.length; i++) {

		strSubject = objSelect.options[i].value;
		strArray = strSubject.split("!!!!");

		subStringVal = strArray[0];
		//subStringVal = strSubject;

		if ((objText.value.toUpperCase() == subStringVal.toUpperCase()) && blnNotFound) {
			objSelect.options[i].selected = true;
			blnNotFound = false;
		}

	}

	if (blnNotFound) {
		alert("The J Code must be containted in select list");
		return false;
	}
	else {
		return true;
	}

}

function valJobCode(objText, objSelect) {
	var i, blnFound, subStringVal

	blnNotFound = true;

	for (i = 0; i < objSelect.length; i++) {
		subStringVal = objSelect.options[i].value;

		if ((objText.value.toUpperCase() == subStringVal.toUpperCase()) && blnNotFound) {
			objSelect.options[i].selected = true;
			blnNotFound = false;
		}

	}

	if (blnNotFound) {
		alert("The DS-2019 Job Code must be containted in select list");
		return false;
	}
	else {
		return true;
	}

}


function fillCityOnFocus(objText, objSelect) {

	if (objSelect.options[objSelect.selectedIndex].text !== "") {
		objText.value = objSelect.options[objSelect.selectedIndex].text;
	}
}

function fillJCodeOnFocus(objText, objSelect) {

	if (objSelect.value !== "") {
		objText.value = objSelect.value;
	}
}

function fillJCodeOnFocusOD(objText, objSelect) {
	var strSubject;
	var strArray;

	strSubject = objSelect.value;
	strArray = strSubject.split("!!!!");

	if (strArray[0] !== "") {
		objText.value = strArray[0];
	}

}

function isHidden(objName) {
	if (objName.type.toUpperCase() != 'HIDDEN') {
		return true;
	}
	else {
		return false;
	}
}

//This is the function that should be used to validate dates - it allows the user to specify the name of the field
//in the pop up box
function valDate(objName, txtName) {
	if (objName.value != "") {
		if (objName.value.toUpperCase() != "{NULL}") {
			var re = new RegExp(/^\d?\d[\/]\d?\d[\/]\d\d\d\d$/)

			objName.value = trimWhitespace(objName.value)
			if (objName.value.search(re) == -1) {
				alert("The date entered into " + txtName + " must be formatted mm/dd/yyyy");
				if (isHidden(objName)) {
					objName.focus();
				}
				return false;
			}
			else {
				if (chkdate(objName) == false) {
					alert("The date entered into " + txtName + " is invalid");
					if (isHidden(objName)) {
						objName.focus();
					}
					return false;
				}
				else {
					var REYear = new RegExp(/[\/]\d*$/);
					var pos = objName.value.search(REYear);
					var myYear = objName.value.substring(pos + 1, pos + 5);
					if (myYear < 1900) {
						alert("The date entered cannot be less than 1/1/1900.");
						if (isHidden(objName)) {
							objName.focus();
						}
						return false;
					}
					else {
						return true;
					}
				}
			}
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}
}

//RS - 20/Feb/2015 : ISSM-1996 : CR-000146140 - I-129 form date issue
//This is the function that should be used to validate dates - it just have date validation
//in the pop up box
function valDateWithoutMsg(objName) {
	if (objName.value != "") {
		if (objName.value.toUpperCase() != "{NULL}") {
			var re = new RegExp(/^\d?\d[\/]\d?\d[\/]\d\d\d\d$/)

			objName.value = trimWhitespace(objName.value)
			if (objName.value.search(re) == -1) {
				return false;
			}
			else {
				if (chkdate(objName) == false) {
					return false;
				}
				else {
					var REYear = new RegExp(/[\/]\d*$/);
					var pos = objName.value.search(REYear);
					var myYear = objName.value.substring(pos + 1, pos + 5);
					if (myYear < 1900) {
						return false;
					}
					else {
						return true;
					}
				}
			}
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}
}

function valDateNo1900(objName, txtName) {
	if (objName.value != "") {
		var re = new RegExp(/^\d?\d[\/]\d?\d[\/]\d\d\d\d$/)

		if (objName.value.search(re) == -1) {
			alert("The date entered into " + txtName + " must be formatted mm/dd/yyyy");
			return false;
		}
		else {
			if (chkdate(objName) == false) {
				alert("The date entered into " + txtName + " is invalid");
				if (isHidden(objName)) {
					objName.focus();
				}
				return false;
			}
			else {
				return true;

			}
		}
	}
	else {

		return true;
	}
}


//This is a function I got on the internet to check dates - it returns a boolean if the date is valid or not
function chkdate(objName) {
	var strDatestyle = "US"; //United States date style
	//var strDatestyle = "EU";  //European date style
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var intday;
	var intMonth;
	var intYear;
	var booFound = false;
	var datefield = objName;
	var strSeparatorArray = new Array("-", " ", "/", ".");
	var intElementNr;
	var err = 0;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	strDate = datefield.value;
	if (strDate.length < 1) {
		return true;
	}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) {
				err = 1;
				return false;
			}
			else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
		}
	}
	if (booFound == false) {
		if (strDate.length > 5) {
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
		}
	}
	if (strYear.length == 2) {
		strYear = '20' + strYear;
	}
	// US style
	if (strDatestyle == "US") {
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
	}
	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
		err = 2;
		return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
		for (i = 0; i < 12; i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i + 1;
				strMonth = strMonthArray[i];
				i = 12;
			}
		}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
		}
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
		err = 4;
		return false;
	}
	if (intMonth > 12 || intMonth < 1) {
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
	}
	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
			}
		}
		else {
			if (intday > 28) {
				err = 10;
				return false;
			}
		}
	}
	//if (strDatestyle == "US") {
	//datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
	//}
	//else {
	//datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
	//}
	return true;
}
function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
	}
	else {
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}

//Function used to raise alert box if a field does not contain a integer between 1-30
function valOtherParam(objName) {

	if (isNaN(objName.value) == true) {
		alert("All fields in this screen must be filled with an integer between 1-30");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		if (parseInt(objName.value) < 1 || parseInt(objName.value) > 30) {
			alert("All fields in this screen must be filled with an integer between 1-30");
			if (isHidden(objName)) {
				objName.focus();
			}
			return false;
		}
		else {
			return true;
		}
	}

}

function valNoResChars(objName, txtName) {
	var re = new RegExp(/^[\w\s]*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " contains reserved characters - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valNoQuotes(objName, txtName) {
	var re = new RegExp(/^[^'"]*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " contains quotes - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valNoResCharsExPer(objName, txtName) {
	var re = new RegExp(/^[\w\s\%']*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " contains reserved characters - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valNoResCharsNoSpaces(objName, txtName) {
	var re = new RegExp(/^\w*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " contains reserved characters - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valNoResCharsExSlash(objName, txtName) {
	var re = new RegExp(/^[\s\w\/]*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " contains reserved characters - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valTextArea(objName, size, txtName) {
	var extra = 0;
	if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5) {
		var index = objName.value.indexOf('\n');
		while (index != -1) {
			extra += 1;
			index = objName.value.indexOf('\n', index + 1);
		}
	}

	if (objName.value.length + extra > size) {
		alert("The data in " + txtName + " field is longer than the allowed limit of " + size + " characters.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valInteger(objName, txtName) {
	var re = new RegExp(/^\d*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " must be an integer and contain only numeric characters - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}


function valReqText(objName, txtName) {
	if (objName.value.length <= 0) {
		alert(txtName + " must contain some text - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}
}


function valReqTextOption(objName, txtName) {
	if (objName.value.length <= 0) {
		if (confirm("SEVIS requires that " + txtName + " contain some text - please correct.")) {
			if (isHidden(objName)) {
				objName.focus();
			}
			return false;
		}
		else {
			return true;
		}

	}
	else {
		return true;
	}
}


function valLength(object, maxlength, name) {
	var length = object.value.length;
	if (length != 0 && length != maxlength) {
		alert('The value in ' + name + ' must be exactly ' + maxlength + ' characters long');
		if (isHidden(object)) {
			object.focus();
		}
		return false;
	} else {
		return true;
	}
}

function valIntLength(object, maxlength, name) {
	if (!valInteger(object, name)) {
		return false;
	}

	return valLength(object, maxlength, name);
}


function valDouble(objName, txtName) {
	var re = new RegExp(/^\d*[.]{0,1}\d*$/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		alert("The data in " + txtName + " must be a number - please correct.");
		if (isHidden(objName)) {
			objName.focus();
		}
		return false;
	}
	else {
		return true;
	}

}

function valSevisUserId(objName, txtName) {
	var re = new RegExp(/((([a-zA-Z]{6})|([a-zA-Z]{1}-[a-zA-Z]{4})|([a-zA-Z]{2}-[a-zA-Z]{3})|([a-zA-Z]{3}-[a-zA-Z]{2})|([a-zA-Z]{4}-[a-zA-Z]{1})|([a-zA-Z]{5}-))\d{4})/)
	var re2 = new RegExp(/((([a-zA-Z]{5})|([a-zA-Z]{1}-[a-zA-Z]{3})|([a-zA-Z]{2}-[a-zA-Z]{2})|([a-zA-Z]{3}-[a-zA-Z]{1})|([a-zA-Z]{4}-))\d{5})/)
	var re3 = new RegExp(/((([a-zA-Z]{4})|([a-zA-Z]{1}-[a-zA-Z]{2})|([a-zA-Z]{2}-[a-zA-Z]{1})|([a-zA-Z]{3}-))\d{6})/)
	var re4 = new RegExp(/((([a-zA-Z]{3})|([a-zA-Z]{1}-[a-zA-Z]{1})|([a-zA-Z]{2}-))\d{7})/)

	if (objName.value.search(re) == -1 && objName.value.search(re2) == -1 && objName.value.search(re3) == -1 && objName.value.search(re4) == -1 && objName.value != "") {
		if (confirm("To the best of our current knowledge the SEVIS User Id entered into " + txtName + " does not conform to the SEVP specifications.  We suggest that you correct this User Id.  Press OK to correct.")) {
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}

}


function valSevisSchoolCode(objName, txtName) {
	var re = new RegExp(/[A-Z]{3}214F\d{8}/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		if (confirm("To the best of our current knowledge the SEVIS School Code entered into " + txtName + " does not conform to the SEVP specifications.  We suggest that you correct this School Code.  Press OK to correct.")) {
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}

}

function valSevisProgramNumber(objName, txtName) {
	var re = new RegExp(/(P-[1-4]-\d{5})|(G-[1-6]-\d{5})/)

	if (objName.value.search(re) == -1 && objName.value != "") {
		if (confirm("To the best of our current knowledge the SEVIS Program Number entered into " + txtName + " does not conform to the SEVP specifications.  We suggest that you correct this Program Number.  Press OK to correct.")) {
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}

}


function webDemoAlert() {
	alert("This function has been disabled for the Web Demo");
}

function webDemoSEVISAlert() {
	alert("You may not add a new profile for this idividual because they are SEVIS Active and this is the web demo.");
}
//confirm and then redirect to the url
function confirmAndRedirect(msg, url) {
	if (confirm(msg)) {
		window.location.href = url;
		return true;
	}
}
function confirmDelete(type, destination) {
	if (confirm("Are you sure you want to delete this " + type + "?")) {
		window.location.href = destination;
	}
}

function codeDropChange(codeFieldName, selectFieldName) {
	var strCode = eval('document.MainForm.' + selectFieldName + '.value');
	strCodeArray = strCode.split('!!!!');
	//eval('document.MainForm.' + selectFieldName + '.value = strCodeArray[1]');
	eval('document.MainForm.' + codeFieldName + '.value = strCodeArray[0]');

	return;
}

function diffDateAfter(startDate, endDate, startName, endName) {
	var blnOK;
	if (Date.parse(startDate.value) < Date.parse(endDate.value)) {
		blnOK = true;
	}
	else {
		if (confirm(endName + " should be after " + startName + ".  It is likely that SEVIS will not accept this event. Click OK to correct the dates.")) {
			if (isHidden(startDate)) {
				startDate.focus();
			}
			blnOK = false;
		}
		else {
			blnOK = true;
		}
	}
	return blnOK;
}

function valDateAfterToday(objName, txtName) {
	var blnOK;
	var now = new Date();
	var dat = new Date(Date.parse(objName.value));

	if ((now.getYear() == dat.getYear()) &&
		(now.getMonth() == dat.getMonth()) &&
		(now.getDate() == dat.getDate())) {

		blnOK = true;
	}
	else if (now > dat) {
		if (confirm(txtName + " is before today's date. It is likely that SEVIS will not accept this event.  Click OK to correct the date.")) {
			if (isHidden(objName)) {
				objName.focus();
			}
			blnOK = false;
		}
		else {
			blnOK = true;
		}

	}
	else {
		blnOK = true;
	}

	return blnOK;
}

// =================================================
// JavaScript function to display hover message for Wizard Menu
// =================================================

function Is() {   // convert all characters to lowercase to simplify testing
	var agt = navigator.userAgent.toLowerCase()

	// *** BROWSER VERSION ***
	this.major = parseInt(navigator.appVersion)

	this.nav = ((agt.indexOf('mozilla') != -1) && ((agt.indexOf('spoofer') == -1)
		&& (agt.indexOf('compatible') == -1)))
	this.nav4 = (this.nav && (this.major == 4))
	this.nav4up = this.nav && (this.major >= 4)

	this.ie = (agt.indexOf("msie") != -1)
	this.ie4 = (this.ie && (this.major == 4))
	this.ie4up = this.ie && (this.major >= 4)
}

function maketheBalloon(id, width, message) {
	var theString = '<STYLE TYPE="text/css">#' + id + '{width:' + width + ';}</STYLE>';
	theString += '<DIV CLASS="balloon" id="' + id + '">' + message + '</DIV>';
	document.write(theString);
}

function makeItVisible(id, event) {

	if (is.nav4up) {
		document.layers[id].left = event.pageX + 10;
		document.layers[id].top = event.pageY + 10;
		document.layers[id].visibility = "show";
	}
	else {
		document.all[id].style.pixelLeft = (document.body.scrollLeft + event.clientX) + 10;
		document.all[id].style.pixelTop = (document.body.scrollTop + event.clientY) + 10;
		document.all[id].style.visibility = "visible";
	}

}

function hideHelp(id) {
	is.nav4up ? document.layers[id].visibility = "hide" : document.all[id].style.visibility = "hidden";
}

// End of JavaScript for WizardMenu

// JavaScript for application log out
function LogOut() {
	if (confirm("Are you sure to log out of International Student and Scholar Management?")) {
		if (window.top != window.self) {
			window.top.location = '/Logout.aspx';
			// window.top.location = 'logout.asp';
		}
		else {
			top.location = '/Logout.aspx';
			//top.location = 'logout.asp';
		}
	}
	else {
		parent.location.reload();
	}
}

// Javascript for Rollover button
function MM_preloadImages() { //v3.0
	var d = document; if (d.images) {
		if (!d.MM_p) d.MM_p = new Array();
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
			if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
	}
}

function MM_swapImgRestore() { //v3.0
	var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.0
	var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
	for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
	if (!x && document.getElementById) x = document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
		if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

///This function is for validating SEVIS Email textbox max length (hardcoded as 255)
//SEVIS 6.21 changes - Email address upto 255 characters is allowed by SEVIS
function MaxLengthValidate(source, args) {

	if (args.Value.length > 255) {
		args.IsValid = false;
	}
	else {
		args.IsValid = true;
	}
}
///Hide and show fields based on Resdential address type
function FieldsViewWithResAddrType(vEventType, ResAddrType, HSTDIV, BRDDIV, HSTFieldArr, BRDFieldArr) {

	var e = document.getElementById(ResAddrType);
	if (e != null) {
		var strValue = e.options[e.selectedIndex].value;
		if (strValue == "HST" || strValue == "") {
			document.getElementById(HSTDIV).style.display = "block";
			document.getElementById(BRDDIV).style.display = "none";
		}
		else {
			document.getElementById(HSTDIV).style.display = "none";
			document.getElementById(BRDDIV).style.display = "block";
		}

		if (vEventType != "ONLOAD") {
			for (i = 0; i < HSTFieldArr.length; i++)
				document.getElementById(HSTFieldArr[i]).value = "";
			for (i = 0; i < BRDFieldArr.length; i++)
				document.getElementById(BRDFieldArr[i]).value = "";

		}
	}
}
///Hide and show fields based on JCategory
function FieldsViewWithJCategory(vCategoryID, vEventType, ResAddrType, HSTBRDDIV, LCDIV, ResAddrTypeDIV, ResAddrType2DIV, HSTDIV, BRDDIV, PContactDIV, LCArr, HSTArr, BRDArr, PCArr) {
	//Student (Secondary)
	if (vCategoryID == "1A") {

		//RS
		document.getElementById(PContactDIV).style.display = "block";
		document.getElementById(HSTBRDDIV).style.display = "block";
		document.getElementById(LCDIV).style.display = "block";
		document.getElementById(ResAddrTypeDIV).style.display = "block";
		document.getElementById(ResAddrType2DIV).style.display = "block";
		if (vEventType != "ONLOAD") {
			var e = document.getElementById(ResAddrType);
			if (e != null) {
				e.selectedIndex = 0;
			}
			for (i = 0; i < LCArr.length; i++)
				document.getElementById(LCArr[i]).value = "";
			//RS
			for (i = 0; i < PCArr.length; i++)
				document.getElementById(PCArr[i]).value = "";


		}
		FieldsViewWithResAddrType(vEventType, ResAddrType, HSTDIV, BRDDIV, HSTArr, BRDArr);
	}
	//Au Pair
	else if (vCategoryID == "13") {
		//RS
		document.getElementById(PContactDIV).style.display = "block";
		document.getElementById(LCDIV).style.display = "block";
		document.getElementById(HSTBRDDIV).style.display = "block";
		document.getElementById(ResAddrTypeDIV).style.display = "none";
		document.getElementById(ResAddrType2DIV).style.display = "none";
		document.getElementById(HSTDIV).style.display = "block";
		document.getElementById(BRDDIV).style.display = "none";
		if (vEventType != "ONLOAD") {
			for (i = 0; i < HSTArr.length; i++)
				document.getElementById(HSTArr[i]).value = "";

			for (i = 0; i < LCArr.length; i++)
				document.getElementById(LCArr[i]).value = "";

			//RS
			for (i = 0; i < PCArr.length; i++)
				document.getElementById(PCArr[i]).value = "";

		}
	}
	else {
		//RS
		document.getElementById(PContactDIV).style.display = "none";
		document.getElementById(HSTBRDDIV).style.display = "none";
		document.getElementById(LCDIV).style.display = "none";
		document.getElementById(ResAddrTypeDIV).style.display = "none";
		document.getElementById(ResAddrType2DIV).style.display = "none";
		for (i = 0; i < LCArr.length; i++)
			document.getElementById(LCArr[i]).value = "";

		var e = document.getElementById(ResAddrType);
		if (e != null) {
			e.selectedIndex = 0;
		}

		for (i = 0; i < HSTArr.length; i++)
			document.getElementById(HSTArr[i]).value = "";

		//RS
		for (i = 0; i < PCArr.length; i++)
			document.getElementById(PCArr[i]).value = "";

		for (i = 0; i < BRDArr.length; i++)
			document.getElementById(BRDArr[i]).value = "";

	}
}
// Handling the width of RAD ComboBox 
function SetWidthForRadComboBox(sender, args) {

	var i = 0, length = 0;
	var combo = sender;
	var items = combo.get_items();
	for (i = 0; i < items.get_count(); i++) {
		var comboItem = items.getItem(i);
		if (comboItem.get_text().length > length) {
			length = comboItem.get_text().length;
		}
	}
	var setwidth = length * 10;
	combo._dropDownWidth = setwidth;
}


//SEVIS RTI Browser access code

function openRTI() {
	xmlhttpPost("../../SevisRTIBrowser.aspx?chkRTI=Y", "")
}
function xmlhttpPost(strURL, qstr) {
	var xmlHttpReq = false;
	var self = this;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open('POST', strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function () {
		if (self.xmlHttpReq.readyState == 4) {
			updatepage(self.xmlHttpReq.responseText);
		}
	}
	self.xmlHttpReq.send(qstr);
}

function updatepage(str) {
	var isRTIOpened = str;
	var width = window.screen.availWidth;
	var height = window.screen.availHeight;
	if (isRTIOpened == "YES") {
		alert("The RTI Access feature is already opened, please use the existing browser window.");
	}
	else {
		var w = window.open("../../SevisRTIBrowser.aspx", "", "width=" + width + ",height=" + height + ",screenX=0,screenY=0,top=0,left=0,status=1,resizable=1", true);
		w.focus();
	}
}
//RM- Bug 4248 ( Gets the querystring value)
function GetParameterByName(name) {
	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
	var regexS = "[\\?&]" + name + "=([^&#]*)";
	var regex = new RegExp(regexS);
	var results = regex.exec(window.location.href);
	if (results == null)
		return "";
	else
		return decodeURIComponent(results[1].replace(/\+/g, " "));
}

//NJ - 06/01/2012 ZEN 335, This general purpose function provides the facility to reload the parent window.
function ReloadParent() {
	if (window.opener && !window.opener.closed) {
		window.opener.location.reload();
	}
}

// 21-July-2014 -soumyab Zen 611 :Tooltip over E-mail disabled TextBox for Event Pages
function onCtrlMouseOver(e) {
	e = e || window.event;
	var el = e.srcElement || e.target;
	if (el && el.disabled) {
		var divToolTip = document.getElementById("divToolTip");
		divToolTip.innerText = el.title;
		divToolTip.top = e.x;
		divToolTip.left = e.y;
		divToolTip.style.display = "block";
	}
}

function onCtrlMouseOut(e) {
	var divToolTip = document.getElementById("divToolTip");
	divToolTip.style.display = "none";
}
// End  21-July-2014 -soumyab Zen 611 :Tooltip over E-mail disabled TextBox


function GetTodaysDate() {

	var today = new Date();

	var dd = today.getDate();
	var mm = today.getMonth() + 1; //January is 0!
	var yyyy = today.getFullYear();

	if (dd < 10) {
		dd = '0' + dd
	}
	if (mm < 10) {
		mm = '0' + mm
	}
	var today = mm + '/' + dd + '/' + yyyy;
	return today;
}

//9.8.2 Karan
function VerifyDates(date1, date2, message) {

	// AP [Apr-25-2012] - Zen#322 - The Request Start and End Dates for Work Auth OPT, CPT, and Off-Camp do not handle mm/dd/yy format
	date1 = ReformatDate(date1);
	date2 = ReformatDate(date2);

	var tempDate1 = new Date(date1);
	var tempDate2 = new Date(date2);

	if (tempDate2 != '') {
		if (tempDate1 < tempDate2) {
			if (message != '') {
				showAlertPopUp(message);
			}
			return false;
		}
		else {
			return true;
		}
	}
}

function EmailAddressValidation(_emailAddress, _controlName) {
	var flag = true;
	var reg = /^[A-Za-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-_]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-_]*[A-Za-z0-9])?$/;
	var _emailValue = _emailAddress.value;
	if (_emailValue != "") {
		if (reg.test(_emailValue) == false) {
			flag = false;
		}
	}
	if (flag) {
		return true;
	}
	else {
		showAlertPopUp(_controlName + ' address is invalid');
		return false;
	}
}

function showAlertPopUp(message) {
	$.modal("<div class='esg-modal-dialog' style='width:600px'><div class='esg-modal-dialog__body'><p>" + message + "</p></div><div class='esg-modal-dialog__action-section esg-button-group esg-button-group--fluid' role='group' aria-label='button group'><div class='esg-button-group__item' role='group'><button class='esg-button esg-button--secondary esg-modal-dialog__button simplemodal-close' type='button'>Ok</button></div></div></div><div class='esg-modal-overlay'></div>",
		{
			close: true,
			escClose: false,
			overlayClose: false,
			overlayCss: {
				backgroundColor: 'grey'
			}
		});
}

function showConfirmPopUp(message, obj) {
	$.modal("<div class='esg-modal-dialog' style='width:600px'><h3 class='esg-modal-dialog__title'></h3><div class='esg-modal-dialog__body' style='padding-top: 0px;'><p class='esg-modal-dialog__title__ISSMcolor'>" + message + "</p></div><div class='esg-modal-dialog__action-section esg-button-group esg-button-group--fluid' role='group' aria-label='button group'><div class='esg-button-group__item' role='group'><button class='esg-button esg-button--secondary esg-modal-dialog__button simplemodal-close no' type='button'>No</button></div><div class='esg-button-group__item' role='group'><button class='esg-button esg-button--primary esg-modal-dialog__button simplemodal-close yes' type='button'>Yes</button></div></div></div>",
		{
			close: true,
			escClose: false,
			overlayClose: false,
			overlayCss: {
				backgroundColor: 'grey'
			},
			onShow: function () {
				$('.yes').click(function () {
					return true;
				});
				$('.no').click(function () {
					obj.value = '';
					return false;
				});
			}
		});
}

//(v 9.8.1) : ISSM - 5009 - CR - 000151660 - Task with no task type
function validateRequired(objName, txtName) {
	var x = objName.value;
	if (trimWhitespace(x) == "") {
		alert(txtName + " is required");
		return false;
	}
	else
		return true;
}

// KG [26/Apr/2021] - (v9.8.9) - JIRA#: ISSM-5885 - Accessibility issue fixing - For radG:RadEditor
function OnClientLoad(editor) {
	var area = editor.get_textArea(); //get reference to the textarea of RadEditor in Html mode
	area.setAttribute("aria-label", "HTML mode textarea");
}


