function WriteSidePanel()
{
var blnShowButton=false;
	var strHTML='';

	if(parent.UserHasAccessToView(62, parent.m_strValidViewIDs)){
		strHTML+=m_objMqButton.GetTextButtonHTML("MyAssets", g_MqRef.RESX["ASSET_REQ.BUTTON_MY_ASSETS"], "parent.LoadView('View=Resources%2FMy%5FAssets')", "", 65, "", "", 150);
	}
	
	if(parent.UserHasAccessToView(64, parent.m_strValidViewIDs)){
		strHTML+=m_objMqButton.GetTextButtonHTML("MyRequestedAssets", g_MqRef.RESX["ASSET_REQ.BUTTON_MY_REQ_ASSETS"], "parent.LoadView('View=Actions%2FMy%5FRequested%5FAssets');", "", 65, "", "", 150);
	}

	document.write(strHTML);
}

function RequestAsset(lngAssetTypeID)
{
	SetFieldValueOnNewRecord("<F.ID:Asset Type>", lngAssetTypeID);
	SetFieldValueOnNewRecord("<F.ID:Allocated to Person (Overview Tab)>", parent.m_strCurrentUserID);
	
	var strName="Request";
	var strAssetType=GetChoiceVal(lngAssetTypeID, "<F.ID:Asset Type>");
	var strOwner=GetChoiceVal(parent.m_strCurrentUserID, "<F.ID:Allocated to Person (Overview Tab)>");
	
	if(strAssetType!=""){
		if(strOwner!=""){
			strName=g_MqRef.MqStr.FormatString(g_MqRef.RESX["ASSET_REQ.REQUESTED_ASSET_SUMMARY"], strAssetType + "," + strOwner);
		}else{
			strName=g_MqRef.MqStr.FormatString(g_MqRef.RESX["ASSET_REQ.REQUESTED_ASSET_SUMMARY_SIMPLE"], strAssetType);
		}
	}
	SetFieldValueOnNewRecord("<F.ID:Name>", strName);
	
	if("<F.ID:Associated Cost (Request Details Tab)>"!=""){
		SetFieldValueOnNewRecord("<F.ID:Associated Cost (Request Details Tab)>", GetFieldVal(lngAssetTypeID, "<F.ID:Associated Cost (Request Details Tab)>"));
	}
	
	parent.onClickControls('AddNew');
}

function GetChoiceVal(strID, lngFieldID)
{
	var strVal="";
	if(parent){
		if(parent.objRequest){
			var strHttpRequest=g_MqRef.MqFS.GetCurrentLocation(window) +
					"wcTopToolbar.asp?WCI=wciGetLookupName&FieldID="+lngFieldID+"&ItemID="+strID;
			
			var co=parent.objRequest.Get(strHttpRequest);

			if (co!=parent.objRequest.CANCEL_PROCESS){
				var objResponse=parent.objRequest.Response(co);
				if (objResponse.HasErrors()){
					objResponse.ProcessErrors("",true);
				}else{
					var objMsg=objResponse.GetContent();
					if (objMsg){
						strVal=g_MqRef.MqStr.MqDecodeURIComponent(objMsg.GetText());
					}				
				}
			}
		}
	}
	return strVal;
}

function GetFieldVal(strID, lngFieldID)
{
	var strVal="";
	if(parent){
		if(parent.objRequest){
			var strHttpRequest=g_MqRef.MqFS.GetCurrentLocation(window) +
					"wcProdInv.asp?WCI=wciGetValuesForIssue&Flds="+lngFieldID+"&rid="+strID;

			var co=parent.objRequest.Get(strHttpRequest);

			if (co!=parent.objRequest.CANCEL_PROCESS){
				var objResponse=parent.objRequest.Response(co);
				if (objResponse.HasErrors()){
					objResponse.ProcessErrors("",true);
				}else{
					var arrVals=co.split("&");
					
					for(x=0;x<arrVals.length;x++){
						var arrVal=arrVals[x].split("=");
						if(arrVal[0]==lngFieldID){
							strVal=arrVal[1];
							break;
						}
					}
				}
			}
		}
	}
	return strVal;
}

function SetFieldValueOnNewRecord(strFieldID, strValue)
{
	var arrSetVals;
	if(parent){
		if(!parent.m_objCustomSetVals){
			parent.m_objCustomSetVals=new parent.CMqDefVals();
		}
		arrSetVals = parent.m_objCustomSetVals.GetDefVals();
		arrSetVals[strFieldID]=strValue;
		parent.m_objCustomSetVals.SetDefVals(arrSetVals);
	}
}
