<!--
var crossPlatform = window.crossPlatform || {};

if (document.location.host.search('.gmodules.com') > -1)
{
  crossPlatform.api = 'igoogle';
  crossPlatform.emptyPref = '';
  if ((window.gadgets == null) || (window.gadgets.util == null))
    crossPlatform.igoogle = {version: 'legacy'};
  else
    crossPlatform.igoogle = {version: 'gadgets.*'};

  var referer = document.referer;
  if (!referer)
    referer = _args()['parent'];
  if (!referer || !(referer.search instanceof Function))
    crossPlatform.igoogle.host = 'other_google/unknown';
  else if ((referer.search('//maps.google') > -1) ||
           (referer.search(/google\.[.a-z]+\/maps/) > -1))
    crossPlatform.igoogle.host = 'gmaps';
  else if (referer.search('//www.google') > -1)
    crossPlatform.igoogle.host = 'igoogle';
  else if (referer.search('//mail.google') > -1)
    crossPlatform.igoogle.host = 'gmail';
  else
    crossPlatform.igoogle.host = 'other_google/' + referrer.split('/')[2];

  try 
  {
    if (crossPlatform.igoogle.version == 'legacy')
      crossPlatform.igoogle.prefs = new _IG_Prefs();
    else
      crossPlatform.igoogle.prefs = new gadgets.Prefs();
  } catch (e) {}
}
else if (window.System != null)
  crossPlatform.api = 'windows';
else if (window.widget != null)
{
  if (window.widget.originURL != null)
    crossPlatform.api = 'opera';
  else
    crossPlatform.api = 'mac';
}
else
  crossPlatform.api = 'other';


crossPlatform.loadPref = function (name, defaultValue)
{
  var result;
  switch (crossPlatform.api)
  {
    case 'igoogle':   result = crossPlatform.igoogle.prefs.getString(name); break;
    case 'windows':   result = System.Gadget.Settings.readString(name); break;
    case 'opera':     result = widget.preferenceForKey(name); break;
    default:          if (window.setCookie != null) return getCookie(name);
  }
  if (result == crossPlatform.emptyPref)
    result = defaultValue;
  return result;
};
crossPlatform.savePref = function (name, value)
{
  switch (crossPlatform.api)
  {
    case 'igoogle':   crossPlatform.igoogle.prefs.set(name, value); break;
    case 'windows':   System.Gadget.Settings.writeString(name, value); break;
    case 'opera':     widget.setPreferenceForKey(value, name); break;
    default:          if (window.setCookie != null) setCookie(name, value);
  }
};

crossPlatform.fetchText = function (url, callback)
{
  switch (crossPlatform.api)
  {
    case 'igoogle':
      if (crossPlatform.igoogle.version == 'legacy')
        _IG_FetchContent(url, callback);
      else
        gadgets.io.makeRequest(url, callback);
      break;
    case 'windows':   
    case 'opera':     
    default:
      if (window.fetch != null) 
        fetch(url, callback, 'responseText');
  }
};
crossPlatform.fetchXml = function (url, callback)
{
  switch (crossPlatform.api)
  {
    case 'igoogle':
      if (crossPlatform.igoogle.version == 'legacy')
        _IG_FetchXmlContent(url, callback);
      else
        gadgets.io.makeRequest(url, function (response) {callback(response.data)}, 
          {'CONTENT_TYPE': gadgets.io.ContentType.DOM});
      break;
    default:
      if (window.fetch != null) 
        fetch(url, callback, 'responseXML')
        
  }
};

crossPlatform.getWidth = function (element)
{
  if (element == null)
    return Math.max(document.body.scrollWidth, document.body.offsetWidth);
  else if (element.innerWidth)
    return element.innerWidth;
  else
    return element.offsetWidth;
};
crossPlatform.getHeight = function (element)
{
  if (element == null)
    return Math.max(document.body.scrollHeight, document.body.offsetHeight);
  else if (element.innerHeight)
    return element.innerHeight;
  else
    return element.clientHeight;
};
crossPlatform.adjustHeight = function ()
{
  switch (crossPlatform.api)
  {
    case 'igoogle':
      if (crossPlatform.igoogle.version == 'legacy')
        _IG_AdjustIFrameHeight();
      else
        gadgets.window.adjustHeight();
      break;
    case 'opera':
      window.resizeTo(crossPlatform.getWidth(), crossPlatform.getHeight()); 
      break;
    default:
      document.body.style.height = crossPlatform.getHeight() + 'px';
  }
};

// -->