function WriteSidePanel()
{
	var blnShowAddButton=false;
	var blnShowDelButton=false;
	var strHTML="";
	
	if(parent){
		if(parent.objFrames){
			var winTopTB=parent.objFrames.GetFrameWindow(parent.TOPTOOLBAR_FRAME_ID);
			if (winTopTB){
				blnShowAddButton=winTopTB.blnHasFeature122;
				blnShowDelButton=winTopTB.blnHasFeature123;
			}
		}
	}
	
	if(blnShowAddButton){
		if(parent.UserHasAccessToView(22, parent.m_strValidViewIDs)){
			strHTML+=m_objMqButton.GetTextButtonHTML("cmdOnboard", g_MqRef.RESX['BUTTON_EMPLOYEE_ONBOARD'], "AddNewEmployee()", "", 65, "", "", 150);		
		}
	}
	
	if(blnShowDelButton){
		if(parent.UserHasAccessToView(33, parent.m_strValidViewIDs)){
			strHTML+=m_objMqButton.GetTextButtonHTML("cmdTerminate", g_MqRef.RESX['BUTTON_EMPLOYEE_TERMINATION'], "TerminateEmployees()", "", 65, "", "", 150);			
		}
	}
	document.write(strHTML);
}

function AddNewEmployee()
{
	parent.OpenModalWindow(GetVDURL(parent.g_VWS.URL().BaseVDName(), "View=Users%26Contacts%2FAdd"), 870, 820, true);
}

function EditEmployeeInfo(lngID)
{
	parent.LoadRecord(lngID, -1, false);
}

function EditEmpResInfo(lngID)
{
	parent.LoadRecord(lngID, -1, false, 9);
}

function EditEmployeeRoleInfo(lngID)
{
	parent.LoadRecord(lngID, -1, false, 8);
}

function GetEditView(lngEmpID)
{
	var strEmpStatus=GetEmpStatus(lngEmpID);
	var strView="View=Users%26Contacts%2FEdit";
	var STATUS_PENDING_SUBMIT="4";
	if(strEmpStatus==STATUS_PENDING_SUBMIT){
		strView="View=Users%26Contacts%2FAdd";
	}
	
	return strView;
}

function TerminateEmployee(lngEmpID)
{
	parent.OpenModalWindow(GetVDURL(parent.g_VWS.URL().BaseVDName(), "View=Users%26Contacts%2FTerminate&UEID=" + lngEmpID), 870, 820, true);
}

function TerminateEmployees()
{
	parent.OpenModalWindow("HRIT.asp?wci=wciTerminateEmployees", 900, 600, true);
}

function GetVDURL(strBaseVD, strAddRedirQS)
{
	var co = parent.objRequest.Get(parent.mstrCurrentLocation + "wcProdInv.asp?WCI=wciGetDiffVDURL&Base=" + strBaseVD + 
										"&AddQS=" + g_MqRef.MqStr.MqEncodeURIComponent(strAddRedirQS));
	if (co!=parent.objRequest.CANCEL_PROCESS){

		var objResponse=parent.objRequest.Response(co);
									
		if (objResponse){
			if (objResponse.HasErrors()){
				objResponse.ProcessErrors("",true,window);
			}else{
				return co;
			}
		}
	}
				
	return true;
}

function GetEmpStatus(lngEmpID)
{
	var STATUS_ACTIVE="1";
	var empStatus=STATUS_ACTIVE;
	var co = parent.objRequest.Get(parent.mstrCurrentLocation + "HRIT.asp?WCI=wciGetEmpStatus&PID=" + lngEmpID);
	if (co!=parent.objRequest.CANCEL_PROCESS){

		var objResponse=parent.objRequest.Response(co);
									
		if (objResponse){
			if (objResponse.HasErrors()){
				objResponse.ProcessErrors("",true,window);
			}else{
				if(co!=""){
					empStatus=co;
				}
			}
		}
	}
	return empStatus;
}