var MV_BROWSERTYPE_UNKNOWED = 0;
var MV_BROWSERTYPE_IE = 1;
var MV_BROWSERTYPE_MOZILLA = 2;
var MV_BROWSERTYPE_OPERA = 3;
var MV_BROWSERTYPE_SAFARI = 4;
var MV_BROWSERTYPE_KONQUERER = 5;

function mv_tools_GetBrowserType()
{
  var lUserAgent = navigator.userAgent;
  
  if(lUserAgent.indexOf('Safari') != -1)
  {
    // Safari
    return MV_BROWSERTYPE_SAFARI;
  }
  else if(lUserAgent.indexOf('Konqueror') != -1)
  {
    // Konquerer: Safari sometimes identifies iteself as Konquerer/Safari
    //  This test must be after the safari test
    return MV_BROWSERTYPE_KONQUERER;
  }
  else if(lUserAgent.indexOf('Gecko') != -1)
  {
    // Gecko (Firefox): Both safari and konquerer use the gecko engine.
    //      This means they identify themselves as  Konquerer/Gecko and Safari/Gecko
    //      Make sure the gecko test is after safari and konquerer
    return MV_BROWSERTYPE_MOZILLA;
  }

  // Detect non Gecko based browser
  
  // Opera
  if(lUserAgent.indexOf('Opera') != -1)
  {
    return MV_BROWSERTYPE_OPERA;
  }
  else if(lUserAgent.indexOf('MSIE') != -1)
  {
    // Internet explorer: Opera identifies iteself as IE, 
    //    so this test must come after the opera test
    return MV_BROWSERTYPE_IE;
  }
  
  // The browser was not identified
  return MV_BROWSERTYPE_UNKNOWED;
}

// ----------------------------------------------------------------------------
function ws_tools_GetWindowInnerHeight()
{
  var myHeight = 0;
  
  if( typeof( window.innerWidth ) == 'number' )
  {
    // Non-IE
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
    // IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    // IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  
  return myHeight;
}

// ----------------------------------------------------------------------------
function ws_tools_GetWindowInnerWidth()
{
  var myWidth = 0;
  
  if( typeof( window.innerWidth ) == 'number' )
  {
    // Non-IE
    myWidth = window.innerWidth;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
    // IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    // IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  
  return myWidth;
}
