//////////////////////////////////////////////////////////////////////////////////
//  File:         u_featurset.js
//  Descruption:  This file contains feature set information. it should contain
//                the same set of information as FeatureSet.java. It gets its
//                values through the StatusFeatureSet API handler in 
//                FeatureSetHandler.java
//  Created By:   Jonathan J. Smith (jonathan.smith@polycom.com)
//////////////////////////////////////////////////////////////////////////////////

function getDocCameraID ()
{
  return (getMaxNoOfCameras () <= 2 || isChurchill) ? -1 : 2
}

function getVCRCameraID ()
{
  var nMaxCameras = getMaxNoOfCameras ()
  if (nMaxCameras < 2) return -1
  return (nMaxCameras == 2) ? 2 : 3
}

function getAUXCameraID ()
{
  return (getMaxNoOfCameras () < 4) ? -1 : 4
}

function getAUX2CameraID ()
{
  return (getMaxNoOfCameras () < 5) ? -1 : 5
}

function getMaxNoOfCameras ()
{
  if (IsVSeries ()|| IsSSeries ()) return 1
  if (Is3000Family () || Is5000Family () ||
     Is6000Family () || isReagan || isJFK) return 2
  if (isTruman || isIke || isChurchill) return 4
  if (isRoosevelt) return 5
  else return 3
}

function isVCRInputAvailable ()
{
  return getVCRCameraID () > 0
}

function IsFIPSSupported ()
{
 return doesSupportEncryption &&
  !(is7000 || is3000 || IsVSeries () || is6000)
}

function IsSimH323SIPSupported ()
{
  return (is8000 || is7000e || IsCharlesFamily () || is5000 || is700 || isHDX)
}

function getNumSerialPorts ()
{
  if (!IsSSeries ())
  {
  if (is8000A) return 3
  else if (isJFK) return 0
  else if (is8000 || isRoosevelt || isGuadalupe) return 2
  else if (Is5000Family () || Is6000Family () ||
           Is7000Family () || isTruman || isIke || isChurchill || isReagan) return 1
  }
  return 0
}

// Camera 1 is ether always PTZ or never PTZ
function isCamera1PTZCapable ()
{
  return !(Is3000Family () || IsVSeries ())
}

function isVCROutputAvailable ()
{
  return Is8000Family () || is7000S || (isNG && !isReagan && !isJFK)
}

function isSingleMonitorVGACapable ()
{
  return IsCharlesFamily () || Is8000Family () || is5000 || isNG
}

function isSubwooferCapable ()
{
  return !IsSSeries && !Is6000Family() && !isHDX
}

function isVGAOutputConfigurable ()
{
  return is8000 || is7000e || is7000S || is6000A ||
         is5000 || Is9000Family () || isIke || isJFK
}

function needToMonitorVisualConcertAudioInputOption ()
{
  return Is8000Family () || isNG
}

function isPOTSCapable ()
{
  return !(IsSSeries () || Is3000Family() || IsVSeries () || isChurchill || isJFK)
}

function isSystemEmbeddedVisualConcertCapable ()
{
  return Is8000Family () || isNG
}

function isConferenceLinkCapable ()
{
  return !(IsVSeries () || Is3000Family() || isNG)
}

function IsContentSupported ()
{
  return isConferenceLinkCapable () ||
   isSystemEmbeddedVisualConcertCapable ()
}

function isContentAudioSupported()
{
  return (isRoosevelt || isIke || isReagan || isChurchill || isJFK)
}

function isUsingFixedCamera ()
{
  return IsVSeries () || Is3000Family() || is5000 || isReagan
}

function isMultiPointCapable ()
{
  return !(IsVSeries () || IsSSeries () || is5000 || Is6000Family() || isJFK)
}

function getMaxConference () {return 1}

// These functions are not static and must be in a html or ssi file
//function getMaxEndpointsPerConference () {return getVariable ("session.feature.getendpointsperconf")}
//function getMaxVideoEndpointsPerConference () {return %%%session.feature.getvideoendpointsperconf%%%}
//function getMaxAudioEndpointsPerConference () {return %%%session.feature.getaudioendpointsperconf%%%}

function isStereoCapable () {return !(IsVSeries ())}
function isPathNavigatorCapable () {return true}

function isOuputSpeakerCapable ()
{
  return !(IsVSeries () || Is3000Family () || is5000 || is6000 || isReagan)
}

function getMaxSpeed ()
{
  return (is400 ? 384 : 
         (is500 || is700 || is5000 || is6000 || is6000A) ? 768 : 1920)
}

function isCameraTrackingCapable () {return Is8000Family () || isNG}

function getEchoCancellerFieldName ()
{
  if (is7000S || is7000e) return "lineinechocanceller"
  if (is8000 || isNG) return "echocanceller"
  else return "lineinredechocanceller"
}

function hasMidRangeSpeakers () {return is6000 || is7000 || is7000S}
function shouldSecondMonitorRequireOptionKey () {return is5000 || is6000A}

function isOptionKeyRequiredForPPCIP ()
{
  return !(is8000 || is8000A || isNG)
}

function hasOrionCamera () {return is5000}
function isWeathermanCapable () {return isG3 && !isChurchill && !isJFK}

// These functions are not used on the embedded side
function HasSerialPort (){return (getNumSerialPorts() > 0)}
function IsEnternalMP () {return (isMultiPointCapable () && g_IsEnternalMP)}
function IsMP () {return (g_IsPNAvail || IsEnternalMP ())}
function NeedsMPKey () {return isMultiPointCapable ()}
function NeedsHDVideoIOKey () {return isIke}
function NeedsPPCIPContentKey () {return isIke || isReagan || isChurchill || isJFK}

function IsStreamingCapable ()
{
  return !is500 && !is400 && !isG3 && !IsSSeries ()
}

// Feature variables
function HasVOC () {return !isMarley}
function HasInternalRinger () {return (IsVSeries () || is3000)}
function SupportsPolcyomMics () {return (!IsVSeries () && !is3000)}

function MaxMonitors ()
{
  if (Is3000Family () || isReagan || IsVSeries () || isJFK) return 1
  if (isIke || isTruman || isChurchill) return 3
  if (isRoosevelt) return 4
  else return 2
}

function HasRestrictedVCRDVDOut () {return isIke || isChurchill}
function Is2ndMonCapable () {return (!isReno && !IsVSeries ())}
function IsPCVGACapable () {return (!isReno && !IsVSeries ())}
function IsPCASCapable () {return (!is400)}
function IsStereoCapable () {return !isTahoe && !is400}

// Option key stuff
function NeedsPCVGAKey ()
{
  return (IsPCVGACapable () &&
         (isSabreMinusC || isCharlesMinusC || isGuadalupe))
}

function NeedsPPCIPKey () {return (!isAnglefire)}
function Needs2ndMonKey () {return (is5000 || is6000A || is6000Ac || isChurchill)}
function IsCam1Configurable () {return !isMarley && !IsVSeries ()}

function IsProMotionCapable ()
{
  return (!isMarley && !IsVSeries () && !Is6000Family ())
}

function IsMon1Configurable () {return !isReno && !is700}

function IsMon1SourceConfigurable ()
{
  return IsMon1Configurable() && !is6000 && !isTahoe && !is7000 && !is400
}

function IsMon2Configurable ()
{
  return (!NeedsHDVideoIOKey() && !isChurchill) || (isChurchill && g_Is2ndMonitorEnabled) || (g_IsHDVideoIOEnabled && NeedsHDVideoIOKey()) || !isJFK
}

function IsSecondInputCapable () {return getMaxNoOfCameras () > 1}
function IsDigitCamera () {return (isReno || isMarley || IsVSeries ())}
function IsFTPSupported () {return !isNG}
function DoWeYahoo() {return false}
function AreCamerasConfigurable () {return  !IsVSeries ()}

function GetMaxCallsSupported ()
{
  if (isRoosevelt) return 7
  else if (isMultiPointCapable ()) return 3
  else return 1
}
function GetMaxLineRateSupported ()
{
  if (isRoosevelt) return 8
  else if (isIke) return 6
  else if (isTruman || isReagan || isChurchill) return 4
  else return 2
}

function HasBuiltInMics () {return isReagan}
function SupportsPhantomPower () {return !isReagan && !isIke && !isChurchill && !isJFK}
function HasVCROut (){return Is8000Family() || isSabreCharles}
function AreSessionVarsSupported () {return isHDX}
function IsWebUpgradable () {return isHDX}
function IsWebLogCapable () {return isHDX}
function IsTranscodingSupported () {return isHDX && !(isIkeNoBrutusT || isReaganNoBrutusT) && !isChurchill && !isJFK}
function IsDialingAllowed () {return !IsSSeries ()}
function Is323Supported () {return !IsSSeries ()}
function Is320Supported () {return !Is6000Family () && !IsSSeries () && !isJFK}
function GetMaxSIPServers () {return 1}
function IsMidrangeCapable () {return !IsSSeries ()}
function IsLDAPSupported () {return IsSSeries () || isHDX}
function IsEAPSupported () {return IsSimH323SIPSupported ()}
function IsCOSSupported () {return isHDX}
function IsVLANSupported () {return isHDX}

function canDoProvisioning ()
{
  return g_bFoundProvisioningServer || wasProvisioningOnUSB ()
}

function IsSmode ()
{
  return bProvisioningEnabled
}

function HasPCLANPort ()
{
  return !isJFK && !Is9000Family ()
}

function is1080Capable ()
{
  return isHDX8006 || is9006 || isChurchill || isJFK
}
