var bFull=0;
var nTitle=0;
var n=0;

function OnConnect()
{
	if(WebAgent) WebAgent.OpenConnectionDialog();
}

function OnDisConnect()
{
	if(WebAgent) WebAgent.DisConnect(-1);
}

function OnAllDisConnect()
{
	if(WebAgent) WebAgent.DisConnectAll();
}

function DoChangeCh(nCh)
{
	if(WebAgent) WebAgent.ChangeChannel(-1,nCh);
}

function DoChangeMode(nMode)
{
	if(WebAgent) WebAgent.ChangeMode(nMode);
}

function StartSequence()
{
	if(WebAgent) WebAgent.DoStartSequence(0,1000);	//1ÃÊ°£°Ý
}

function StopSequence()
{
	if(WebAgent) WebAgent.DoStopSequence();
}

//PAN/TILT
function DoPanTilt(nMode)
{
	if(WebAgent) WebAgent.RemCtrlPanTilt(nMode);
			
}
		
//ZOOM
function DoZoom(nZoomst)
{
	if(WebAgent) WebAgent.RemCtrlZoom(nZoomst);
}
		
//Focus
function DoFocus(nFocst)
{
	if(WebAgent) WebAgent.RemCtrlFocus(nFocst);
}

//full
function DoFull()
{
	if(WebAgent)
	{
		if(bFull)
			bFull = 0;	
		else 
			bFull = 1;
		
		WebAgent.OneChFullScreen = bFull;
	}
}

function DoPauseContinue()
		{
			if(WebAgent) WebAgent.PauseContinue();
		}

function ChangeTitle()
{
		
		if( nTitle == 0)
		{
			nTitle=1;
			WebAgent.ShowFPS=0;
		}
		else if( nTitle == 1)
		{
			nTitle=2;
			WebAgent.ShowFPS=0;
			WebAgent.ShowStatus=0;
		}
		else if( nTitle == 2)
		{
			nTitle=3;
			WebAgent.ShowFPS=0;
			WebAgent.ShowStatus=0;
			WebAgent.ShowTime=0;
		}
		else if( nTitle == 3)
		{
			nTitle=4;
			WebAgent.ShowFPS=0;
			WebAgent.ShowStatus=0;
			WebAgent.ShowTime=0;
			WebAgent.ShowTitle=0;
		}
		else if( nTitle == 4)
		{
			nTitle=5;
			WebAgent.ShowBW=1;
			WebAgent.ShowFPS=1;
			WebAgent.ShowStatus=1;
			WebAgent.ShowTime=1;
			WebAgent.ShowTitle=1;
		}
		else if( nTitle ==5)
		{
			nTitle=0;
			WebAgent.ShowBW=0;
			WebAgent.ShowFPS=1;
			WebAgent.ShowStatus=1;
			WebAgent.ShowTime=1;
			WebAgent.ShowTitle=1;
		}
}

function about()
{
		
		if( n == 0)
		{
			n=1;
		}
		else if( n == 1)
		{
			n=0;
			javascript:openWindow();
		}
}

function openWindow()
{
		aboutWin = open("","About","width=280,height=110, status=no,menubar=no,resizable=no,scroolbar=no,fullscreen=no,titlebar=no");
		aboutWin.document.open();
		aboutWin.document.write("<html><head><title>Version Infomation");
		aboutWin.document.write("</title></head><body bgcolor=#BDB9B9>");
		aboutWin.document.write("<font size=2 color=black face=verdana><center><b>Version Infomation</b><br></font><font size=1 color=#BDB9B9>============================</center>");
		aboutWin.document.write("<IFRAME ALIGN=Middle FRAMEBORDER=yes FRAMESPACING=0 BORDER=0 SRC='js/version.vif' marginHeight=0 marginWidth=0 width=260 height=55></IFRAME>");
		aboutWin.document.write("</font>");
		aboutWin.document.write("</body></html>");
		aboutWin.document.close("");
}

function next_img_src(name, nsdoc)
{
  var img = eval((navigator.appName == 'Netscape') ? nsdoc+'.'+name : 'document.all.'+name);
  var src     = img.src;
  var index = src.substr(src.length-8,2);
	
  index	   =  (eval(index)+3)%16 +1;
  if(index < 10)
      img.src     = src.substr(0,src.length-8)+"0"+index+"_n.jpg";
  else
     img.src     = src.substr(0,src.length-8)+index+"_n.jpg";
}
function prev_img_src(name, nsdoc)
{
  var img = eval((navigator.appName == 'Netscape') ? nsdoc+'.'+name : 'document.all.'+name);
  var src     = img.src;
  var index = src.substr(src.length-8,2);
  if(eval(index) <= 4)
   index = (eval(index)+16);
  index	   =  (eval(index)-4);
  if(index < 10)
      img.src     = src.substr(0,src.length-8)+"0"+index+"_n.jpg";
  else
     img.src     = src.substr(0,src.length-8)+index+"_n.jpg";
}
function callch(name, nsdoc)
{
  var img = eval((navigator.appName == 'Netscape') ? nsdoc+'.'+name : 'document.all.'+name);
  var src     = img.src;
  var index = src.substr(src.length-8,2);
	if(index < 10)
      index = src.substr(src.length-7,1);
	DoChangeCh(index);
}


function help()
{
	var txt;
	txt=  clientInformation.systemLanguage;
	if ( txt == "ko"){
			window.open("help/help.html","webAgent","width=676,height=544,status=no,toolbar=no,menubar=no,resizable=no,fullscreen=no,directories=no,location=no,scrollbars=no");
	}
	else {
			window.open("help/help_eng.html","webAgent","width=676,height=544,status=no,toolbar=no,menubar=no,resizable=no,fullscreen=no,directories=no,location=no,scrollbars=no");
	}			
}
