// JavaScript Document
<!--
var    chasm	=   screen.availWidth;
var    mount    =   screen.availHeight;
var    IpAddress =   0;
var    LivexExist =false;

var    sizeFlag1 = 1;
var    sizeFlag2 = 1;



var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();




function ShowSystemMenu()
{  

 if( LivexExist ){     
  try{   
        document.WebCamX1.ShowSYSMenu();  
      
   }catch(e){
	alert("ActiveX downloading please refresh");
   }   
 }   
}


function FileSave()
{
 if( LivexExist ){
   try{
   
       document.WebCamX1.SaveX();
     
   }catch(e){
	alert("ActiveX downloading please refresh");
   }
 }
}


function Stop()
{
 if( LivexExist ){
  try{
   
       document.WebCamX1.StopX();  
      
   }catch(e){
	alert("ActiveX downloading please refresh");
   }
 }     	
}

function Zoom()
{
 if( LivexExist ){
   try{       
    document.WebCamX1.ShowZoomMenu();
	document.WebCamX1.FullScreenX();
     
     }catch(e){
	alert("ActiveX downloading please refresh");
   }
 }
}





function SnapShot()
{
 if( LivexExist ){
  try{
  
   document.WebCamX1.SnapShotX();
       
   }catch(e){
	alert("ActiveX downloading please refresh");
  }
 }
}


function ShowCamMenu()
{    
 if( LivexExist ){   
  try{    
       document.WebCamX1.ShowCamMenuX();
    
   }catch(e){
	alert("ActiveX downloading please refresh");
  }
 }  
}

function ChangeQuality()
{
  if( LivexExist ){     
   try{
   	document.WebCamX1.ShowQulMenuX();  
   }catch(e){
	alert("ActiveX downloading please refresh");
   }
  }   
}

function AudioControl()
{     
 if( LivexExist ){
   try{
   	document.WebCamX1.AudioControlX();  
   }catch(e){
	alert("ActiveX downloading please refresh");
   }
 }  
}


function CreateX()
{ 
 
  try{
  	//document.WebCamX1.CreateX();
  	if(IpAddress == 0) 
  	{
  	  document.WebCamX1.IpAddress= document.location;  	
  	}
  	else
  	{
  	  document.WebCamX1.IpAddress= IpAddress;
  	}
 	document.WebCamX1.CommandPort = CommandPort;
	    document.WebCamX1.DataPort = DataPort;
	    document.WebCamX1.AudioDataPort = AudioPort;
	    document.WebCamX1.AutoSetCamera = 1;
	   
	    document.WebCamX1.SetInfo(125,1,0,"","");
	    document.WebCamX1.SetInfo(129,1,0,"","");	    
	    document.WebCamX1.SetUpdateInfo(100, "WebCam", 0, "", 8200, 0,0);
	     LivexExist=true;
    
   }catch(e){
	alert("ActiveX downloading please refresh");
	LivexExist=false;
   }
 
}

function DestroyX()
{  
 if( LivexExist ){
  try{
    document.WebCamX1.DestroyX();
  }catch(e){
	alert("ActiveX downloading please refresh");
  }
 }
}

function OCXChecker()
{
	OCXChecker1.StartOCXChecker("LiveXOCXChecker.txt",document.location);

}
//-->"clientEventHandlersJS" language="javascript"> <!-- 

function OCXCheckerComplete() { 
	LivexExist=true;
	CreateX();
	Play();
} 

function OCXCheckerDownloadComplete() {	
   window.location.reload();   
} 

function OCXCheckerDownloadCancel() { 
   window.close();
} 

function LoginFail() { 
   //parent.location.href = "index.htm";
   
} 

function v82_ExtraEvent(index, iCmdID, iValue, sMsg, Reserve1, Reserve2) {    
    
   // Login fail for time out
   if(iCmdID == 1  ){   
//      parent.location.href = "Invalid.htm?ErrorID=1";
   }  
   // Kick out user
   else if(iCmdID == 3  ){
//      parent.location.href = "Invalid.htm?ErrorID=3";
   }   
} 

