CRM 2011 JS: Change Subgrid View JScript

// Change Subgrid View Java Script
 
Change the Fetch XML and set the subgrid ID
function UpdateSubGrid()
{
    var leadGrid = document.getElementById("Contact");//Set Subgrid ID 
  //If this method is called from the form OnLoad, make sure that the grid is loaded before proceeding
  if (leadGrid.readyState != "complete")
  {
      //The subgrid hasn't loaded, wait 1 second and then try again
      setTimeout('UpdateLeadSubGrid()', 1000);
      return;
  }
 
 
var fetchXml = "              ";//Set Fetch XML
  //Inject the new fetchXml
  leadGrid.control.setParameter("fetchXml", fetchXml);
  //Force the subgrid to refresh
  leadGrid.control.refresh();
 
}