/********************************************************************************
  functions to identify browser clients
  
  Author: Dima V. Fedorov <www.dimin.net>
  Copyright (C) VRL, UCSB <http://vision.ece.ucsb.edu>
  
  History:
    06/15/2004 15:12 - First creation
	
********************************************************************************/

/*
Mozilla 1.5:
appName -- Netscape
appCodeName -- Mozilla
userAgent -- Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
appVersion -- 5.0 (Windows; en-US)
product -- Gecko
productSub -- 20060909
vendor --

IE 7:
appName -- Microsoft Internet Explorer
appCodeName -- Mozilla
userAgent -- Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
appVersion -- 4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
product -- undefined
productSub -- undefined
vendor -- undefined 

Opera 7:
appName -- Microsoft Internet Explorer
appCodeName -- Mozilla
userAgent -- Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.03 [en]
appVersion -- 4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1)
product -- undefined
productSub -- undefined
vendor -- undefined 

-----------------------------------------------------------------
pocket pc
-----------------------------------------------------------------

Pocket IE (WinCE 4):
appName -- Microsoft Pocket Internet Explorer
appCodeName -- Mozilla
userAgent -- Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)
appVersion --  4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)
product -- undefined
productSub -- undefined
vendor -- undefined

Pocket PC - Minimo:
appName -- Netscape
appCodeName -- Mozilla
userAgent -- Mozilla/5.0 (Windows; U; Windows CE 4.2; rv:1.8.1a3) Gecko/20060610 Minimo/0.016
appVersion -- 5.0 (Windows;)
product -- Gecko
productSub -- 20060610
vendor --

Pocket PC - opera:
appName -- Microsoft Internet Explorer
appCodeName -- Mozilla
userAgent -- Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240x320)
appVersion --  4.0 (compatible; MSIE 6.0; Windows CE; PPC; 240x320)
product -- undefined
productSub -- undefined
vendor -- undefined

*/

function isIE(navigator) {
  if ( isOpera(navigator) ) return false;	
  if ( navigator.appName == "Microsoft Internet Explorer" )
    return true;

  return false;
}

function isKHTML(navigator) {
  if ( ( navigator.userAgent.indexOf("Konqueror") != -1 ) || 
       ( navigator.userAgent.indexOf("Safari") != -1 ) ||
       ( navigator.userAgent.indexOf("KHTML") != -1 ) ||
       ( (navigator.product != null) && ( navigator.product.indexOf("khtml") != -1 ) ) 
     ) 
    return true;

  return false;
}

function isMozilla(navigator) {
  if ( isOpera(navigator) ) return false;
  if ( isKHTML(navigator) ) return false;  
  if ( navigator.appName == "Netscape" )
    return true;

  return false;
}

function isFirefox(navigator) {
  if ( isOpera(navigator) ) return false;	
  if ( ( navigator.appName == "Netscape" ) &&
       ( navigator.appCodeName == "Mozilla" ) &&
       ( (navigator.product != null) && ( navigator.product == "Gecko") ) &&
       ( navigator.userAgent.indexOf("Firefox") != -1 )
     ) 
    return true;

  return false;
}

function isOpera(navigator) {
  if ( navigator.userAgent.indexOf("Opera") != -1 )
    return true;

  return false;
}

function isPocket(navigator) {
	
  // check if it's pocket IE
  if ( navigator.appName == "Microsoft Pocket Internet Explorer" )
    return true;

  // check if it's mozilla minimo
  if ( ( navigator.userAgent.indexOf("Windows CE") != -1 ) &&
       ( navigator.userAgent.indexOf("Minimo") != -1 )
     )  
    return true;

  // check if it's mobile opera
  if ( ( navigator.userAgent.indexOf("Windows CE; PPC;") != -1 ) &&
       ( navigator.appVersion.indexOf("Windows CE; PPC;") != -1 )
     )  
    return true;

  return false;
}


 
