<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title translate="yes" data-res="TERMINATE_CONFIRM.TITLE"></title>
	<!--MqRelPath--><link rel="stylesheet" href="../../theme/css/censusmain.css" type="text/css" /><!--/MqRelPath--><!--MqAbsPath><link rel="stylesheet" href="<BASE_VD>/theme/css/censusmain.css" type="text/css" /></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/images.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/images.js"></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqsysmsg.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqsysmsg.js"></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqsysutils.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqsysutils.js"></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/window.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/window.js"></script></MqAbsPath-->
	
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/dhtmlxdataview.css">
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/dhtmlxgrid.css">
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/skins/dhtmlxgrid_dhx_skyblue.css">
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxcommon.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxgrid.js"></script>      
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxgridcell.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/ext/dhtmlxgrid_filter.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/ext/dhtmlxgrid_group.js"></script>


	<script type="text/javascript">
		// always define this object for the system messages
		var objSysMsg = new CMqSysMsg;
		var m_objMqButton=new MqButton();
		var mDataGrid;
			
		var m_objRef;
		var SUCCESS_SAVE=-3;
		
		if(parent){
			m_objRef=parent;
		}			
		
		function TerminateEmployees()
		{
			if(m_objRef){
				
				var strSelectedEmployeeIDs=GetSelectedIDs();
				var regExp=new RegExp(",","g");
				strSelectedEmployeeIDs=strSelectedEmployeeIDs.replace(regExp,";");
				
				if(strSelectedEmployeeIDs!=""){
					var strSelNames=GetSelectedNames();
					if(parent){
						if(parent.objFrames){
							var winSummaryList=parent.objFrames.GetFrameWindow(parent.SUMMARY_LIST_FRAME_ID);
	        
							if (winSummaryList){
								var strUrl=winSummaryList.GetVDURL("connect", "View=Users%26Contacts%2FBatch%5FTerminate&BS=1&txtPostData=" + g_MqRef.MqStr.MqEncodeURIComponent("103=1&102=1&101=2") + "&IDs=" + strSelectedEmployeeIDs + "&Nms=" + g_MqRef.MqStr.MqEncodeURIComponent(strSelNames));//"wcCmdBar.asp?wci=wciBatchUpdateMain"
								document.location.replace(strUrl);
							}
						}	
					}
				}else{
					alert(g_MqRef.RESX['WARNING_MESSAGE_SELECT_EMPLOYEES_UPDATE']);
				}
			}
		}
		
		function GetSelectedIDs()
		{
			var strSelIDs="";
			if(mDataGrid){
				strSelIDs=mDataGrid.getCheckedRows(0);
			}
			return strSelIDs;
		}

		function GetSelectedNames()
		{
			var strNames="";
			
			if(mDataGrid){
				mDataGrid.forEachRow(function(id){
					if(mDataGrid.cells(id,0).getValue()==1){
						strNames+=mDataGrid.cells(id,1).getValue() + ";";
					}
				});
			}
			
			strNames=g_MqRef.MqStr.StripTrailing(strNames, ";");
			
			return strNames;
		}
		
		function ClosePopup()
		{
			if(m_objRef){
				m_objRef.CloseModalWindow();
			}
		}
		
		function Form_OnLoad()
		{
			g_MqRef.ResMgr.ProcessAll(document);				
			LoadDataList();
			ResizeGrid();
		}
		
		function LoadDataList()
		{
			if(!mDataGrid){		
				mDataGrid = new dhtmlXGridObject('gridbox');
				mDataGrid.setImagePath("../../js/codebasegrid/imgs/");
				mDataGrid.setHeader(g_MqRef.RESX['LIST_HEADER_SUMMARY_LIST_TERMINATE']+","+g_MqRef.RESX['LIST_HEADER_SUMMARY_LIST_NAME']+","+g_MqRef.RESX['LIST_HEADER_SUMMARY_LIST_DEPARTMENT']+","+g_MqRef.RESX['LIST_HEADER_SUMMARY_LIST_JOBPOSITION']+","+g_MqRef.RESX['LIST_HEADER_SUMMARY_LIST_EMAIL']);
				mDataGrid.setNoHeader(false);
				mDataGrid.setInitWidthsP("10,*,20,20,20");
				mDataGrid.setColAlign("Center,Left,Left,Left,Left");
				mDataGrid.setColTypes("ch,ro,ro,ro,ro");
				mDataGrid.setColSorting("str,str,str,str,str");
				mDataGrid.init();
				mDataGrid.setSkin("dhx_skyblue");
			}else{
				mDataGrid.clearAll();
			}
			
			mDataGrid.attachEvent("onRowSelect", ClickRow);
			
			mDataGrid.parse(document.getElementById("dataContainerList").value);	
		}
		
		function ClickRow(lngRowID, lngCell)
		{
			if(mDataGrid){
				if(mDataGrid.cells){
					if(mDataGrid.cells(lngRowID,0)){
						
						var currentValue=mDataGrid.cells(lngRowID,0).getValue();
						var newValue=1;
						
						if(currentValue==1){
							newValue=0;
						}
			
						mDataGrid.cells(lngRowID,0).setValue(newValue);
					}
				}
			}
		}

		function ResizeGrid()
		{
			var objGrid=document.getElementById("gridbox");
			
			if(objGrid){
				
				var intBodyHeight;
				
				if (document.all){
					if (document.documentElement && document.documentElement.offsetHeight){
						intBodyHeight=document.documentElement.offsetHeight;
					}else{
						intBodyHeight=document.body.offsetHeight;
					}
				}else{
					intBodyHeight=window.innerHeight;
				}
			
				objGrid.style.height=(intBodyHeight-160) + "px";	
			}
		}
		
		CloseWindowByEscKey(false);
	</script>
</head>

<body class="MainBackgroundPopup" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" onload="Form_OnLoad()">
	
	<div class="TopToolBarPopup">
		<table width="100%" class="TopToolBarWizard">
			<tr>
				<td>
					<script type="text/javascript">document.write('<img src="../../theme/images/buttons/termemployee.png" style="height:75px" \/>');</script>
				</td>
		        <td valign="top" style="padding-top:15px; padding-left:10px" width="100%">
		            <div class="WizardTitle" translate="yes" data-res="TERMINATE_CONFIRM.TITLE"></div>
		            <div class="WizardDescription" translate="yes" data-res="WIZARD_EMPLOYEE_TERMINATION_DESCRIPTION"></div>
		        </td>
		    </tr>
		</table>
	</div>

	
	<WC@XML_LIST_FORMAT>
		<row id="{tblUser_nID}">
			<cell></cell>
			<cell>{tblUser_First_Name} {tblUser_Last_Name}</cell>
			<cell>{tblDts_Department}</cell>
			<cell>{tblDts_Contact_Job_Position}</cell>
			<cell>{tblUser_tEmailName}</cell>
		</row>
	</WC@XML_LIST_FORMAT>
	
	<div id='GridContainer' >
		<div id="gridbox" style="margin-left:10px; margin-right:10px; margin-top:10px; background-color:white; width:98.5%;height:400px"></div>
	</div>	

	<textarea id="dataContainerList" name="dataContainerList" style="display:none"><WC@XML_CONTENTS></WC@XML_CONTENTS></textarea>
	
<table width="100%" align="right" style="margin-right:5px">
    <tr>
		<td align="right">
				<table>
					<tr>
						<td>
							<script type="text/javascript">
								<!--
								m_objMqButton.WriteTextButtonHTML("Next", g_MqRef.RESX["BUTTON_NEXT"], 'TerminateEmployees()', "", 32, "", g_MqRef.RESX["BUTTON_NEXT"], 90);
								//-->
							</script>
						</td>
						<td>
							<script type="text/javascript">
								<!--
								m_objMqButton.WriteTextButtonHTML("Cancel", g_MqRef.RESX["BUTTON_CANCEL"], 'ClosePopup()', "", 32, "", g_MqRef.RESX["BUTTON_CANCEL"], 90);
								//-->
							</script>				
						</td>
					</tr>
				</table>
		</td>
    </tr>
</table>

</body>
</html>

