function WriteSidePanel()
{
	var blnShowButton=false;
	var strHTML='';
	
	if(parent){
		if(parent.objFrames){
			var winTopTB=parent.objFrames.GetFrameWindow(parent.TOPTOOLBAR_FRAME_ID);
			if (winTopTB){
				blnShowButton=winTopTB.blnHasFeature116;
			}
		}
	}
	
	if(blnShowButton){
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewUnit", g_MqRef.RESX['BUTTON_ADD_UNIT'], "AddNewRole(4)", "", 50, "", "", 150);
		
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewDept", g_MqRef.RESX['BUTTON_ADD_DEPARTMENT'], "AddNewRole(5)", "", 50, "", "", 150);
					
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewTeam", g_MqRef.RESX['BUTTON_ADD_WORK_TEAM'], "AddNewRole(6)", "", 50, "", "", 150);
					
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewJob", g_MqRef.RESX['BUTTON_ADD_JOB_TITLE'], "AddNewRole(1)", "", 50, "", "", 150);			
					
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewPos", g_MqRef.RESX['BUTTON_ADD_POSITION_TITLE'], "AddNewRole(2)", "", 50, "", "", 150);
	
		strHTML+=m_objMqButton.GetTextButtonHTML("cmdAddNewProj", g_MqRef.RESX['BUTTON_ADD_PROJECT'], "AddNewRole(3)", "", 50, "", "", 150);
	}
	document.write(strHTML);
}

function AddNewRole(lngType)
{
	var strType="";
	var ROLE_TYPE_FIELD="808";
	if(lngType){
		strType="&txtPostData=" + g_MqRef.MqStr.MqEncodeURIComponent(ROLE_TYPE_FIELD + "=" + lngType);
	}
	parent.OpenModalWindow(GetVDURL(parent.g_VWS.URL().BaseVDName(), "View=Roles%2FAdd" + strType), 870, 740, true);
}
function EditRoleInfo(lngID)
{
	parent.LoadRecord(lngID, -1, false);
}
function EditRoleResInfo(lngID)
{
	parent.LoadRecord(lngID, -1, false, 22);
}

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;
}
