var formatHome = function(dataItem) {
	                	    	var resultStr = "";
	                	    	if (dataItem == 0) {
	                	    		resultStr = "Away";
	                	    	} else {
	                	    		resultStr = "Home";
	                	    	}
	                	    	
	                	    	return resultStr;
	                	    };


/***********************************************************************************************
  general grid cell formatting functions for dojox.grid; functions that may apply to many different grids
  Todd Eischeid, 2010 IBM Corporation
***********************************************************************************************/


//general date and time formatter function. This function does not serve as a formatter directly; 
//you would call this general function from your real formatter functions, and pass in the appropriate date and time format strings.
function formatDateAndTimeGeneral(dataItem, dateFormatStr, timeFormatStr)
{
	if (dataItem == "") return "";
	if (dataItem == "0000-00-00T00:00:00") return "";
	
	var nullTime = new RegExp("T00:00:00", "i");

	
    //if doing time only
    if (dateFormatStr == "") {
      if (dataItem.search(nullTime) > -1) return "";
      return dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {timePattern: timeFormatStr, selector: "time"});    
    }		
    
    var _d = new Date();    
    var _d2 = new Date();    
    
    //subtract 24 hours
    _d2.setTime(_d.getTime() - 86400000);   
    
   	
    itemDate = dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {datePattern: dateFormatStr, selector: "date"});
    today = dojo.date.locale.format(_d, {datePattern: dateFormatStr, selector: "date"});
    yesterday = dojo.date.locale.format(_d2, {datePattern: dateFormatStr, selector: "date"});
    
    	
    if (itemDate == today)
    {
      if (dataItem.search(nullTime) > -1)
	    return "Today";
      else
        return "Today " + dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {timePattern: timeFormatStr, selector: "time"});    
    }
    else
    {
      if (itemDate == yesterday)
      {
        if (dataItem.search(nullTime) > -1)
	      return "Yesterday";
        else
          return "Yesterday " + dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {timePattern: timeFormatStr, selector: "time"});    
      }
      else
      {
        if ((dataItem.search(nullTime) > -1) || (timeFormatStr == ""))
	      return dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {datePattern: dateFormatStr, selector: "date"});
        else
          return dojo.date.locale.format(dojo.date.stamp.fromISOString(dataItem), {datePattern: dateFormatStr, timePattern: timeFormatStr});        
      }  
         
    }

}

//grid cell formatter for date; returns formatted date portion only
function formatDate_DateOnly(dataItem)
{
	return formatDateAndTimeGeneral(dataItem, "MMM d, y", "");  
}

//grid cell formatter for date; returns formatted date and time
function formatDate_DateAndTime(dataItem)
{
	return formatDateAndTimeGeneral(dataItem, "MMM d, y", "hh:mm a");
}

//grid cell formatter for date; returns formatted date and time
function formatDate_DateAndTimeWithSec(dataItem)
{
	return formatDateAndTimeGeneral(dataItem, "MMM d, y", "hh:mm:ss a");
}


//grid cell formatter for date; returns formatted time portion only
function formatDate_TimeOnly(dataItem)
{
    return formatDateAndTimeGeneral(dataItem, "", "hh:mm a");  
}


//date and time format with milliseconds included
function formatDate_DateAndTimeMsec(dataItem)
{  
   return formatDateAndTimeGeneral(dataItem, "MMM d, y", "hh:mm:ss.SSS a"); 
}



