var appName = navigator.appName;
var sUserAgent = navigator.userAgent;
var appVersion = navigator.appVersion;
var platform = navigator.platform;
var isMoz = !isNS && (sUserAgent.indexOf("Mozilla")==0) && (navigator.appName=="Netscape") && (sUserAgent.indexOf("Navigator") > -1)==false;
var isNS = !isMoz && (sUserAgent.lastIndexOf("Gecko") > -1) && (sUserAgent.indexOf("Navigator") > -1);
var mac = (navigator.userAgent.indexOf("Mac") != -1);
var linux = (navigator.userAgent.indexOf("Linux") != -1);
var and = navigator.userAgent.match("Android");
var iPh = navigator.userAgent.match("iPhone");
var mob = navigator.platform == "Windows Mobile";
var ie = navigator.appName == "Microsoft Internet Explorer";
var cr = (navigator.userAgent.lastIndexOf("Chrome") != -1);
var sf = (navigator.userAgent.lastIndexOf("Safari") != -1);
var op = (navigator.userAgent.lastIndexOf("Opera") != -1);

var np_netizen_arr = new Array();
var np_netizen_ob_installer = 'http://update.nprotect2.net/netizenv55/gov/neis/nx/OB_nProtect_NetizenAndXGuard_Setup.exe'

np_netizen_arr['ob_installer'] = np_netizen_ob_installer

var firefox_install_running = false;

if ( and||mac||linux||iPh||mob ) 
{ 
  issupport=false;
}
else if ( ie ) { appName="IE"; issupport=true; }
else if ( sf ) { appName="Safari"; issupport=true; }
else if ( op ) { appName="Opera"; issupport=true; }
else if ( cr ) { appName="Chrome"; issupport=true; }
else if ( isMoz )
{
  var reMoz = new RegExp(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent));
  reMoz.test(sUserAgent);
  var ffversion = new Number(RegExp.$1)
  if ( ffversion >= 2.0)
  {
    //alert ("[Firefox] This Browser version is support.");
    appName = "FireFox";    
    issupport = true;
  }
  else
  {
    alert ("[Firefox] This Browser version does not supports.");
    issupport = false;
    }
}
else if ( isNS ) //netscape
{
  var reNS = new RegExp(/Navigator[\/\s](\d+\.\d+)/.test(navigator.userAgent));
  reNS.test(appName);
  if ( RegExp["$1"] >= 9.0)
  {
    //alert ("[Netscape] This Browser version is support.");
    appName = "FireFox";     
    issupport = true;
  }
  else
  {
    alert ("[Netscape] This Browser version does not supports.");
    issupport = false;
  }
}

if ( issupport == true ) 
{
  if ( appName == "IE" )
  { 
	document.write("<OBJECT classid='CLSID:F939FEB8-9518-4A4A-BE60-D10FFB9557F2'");
	document.write("codeBase='http://update.nprotect.net/netizenv55/gov/neis/nx/npenkIEInstall5.cab#version=2011,2,17,1' height='0' id='npenkIEInstall5' name='npenkIEInstall5' width='0'>");
	document.write("<PARAM name = 'CustomID' value = 'npenkPolicy_neis' >");
	document.write("<PARAM name = 'UpdateMainURL' value = 'http://update.nprotect2.net/netizenv55/gov/neis/nx/updateparam.dat' >" );
	document.write("<PARAM name = 'SetupURL' value = 'http://update.nprotect2.net/netizenv55/gov/neis/nx/IE_nProtect_Netizen55_Setup.exe' >" );
	document.write("<PARAM name = 'ScannerUpdateMainURL' value = 'http://update.nprotect2.net/netizen/update_xml/updateScannerParam_bwt.dat' >" );
	document.write("<PARAM name = 'ReloadUrl' value = 'http://neis.go.kr' >" );
	document.write("<PARAM name = 'InstallType' value = '' >" );
	document.write("<PARAM name = 'Version' value = '2011,02,16,1' >");
	document.write("<PARAM name = 'Option' value = '32' >");
	document.write("<PARAM name = 'ExitServicePolicy' value = '2' >");
	document.write("</OBJECT>");
  	
  }
  else
  {
	npenkOBInstall5_mz();
  
  document.write("<embed type='application/npenkOBInstall5' width='0' height='0' id='npenkOBInstall5'");
  document.write("CustomID='npenkPolicy_neis'");
  document.write("UpdateMainUrl='http://update.nprotect2.net/netizenv55/gov/neis/nx/updateparam.dat'");
  document.write("Version='2011,02,16,1'");
  document.write("Option='32'");
  document.write("InstallType=''");
  document.write("SetupUrl='http://update.nprotect2.net/netizenv55/gov/neis/nx/OB_nProtect_NetizenAndXGuard_Setup.exe'");
  document.write("ScannerUpdateMainURL='http://update.nprotect2.net/netizen/update_xml/updateScannerParam_bwt.dat'");
  document.write("ExitServicePolicy='2'>");
  document.write("</embed>");
  }
}

function detect_mz()
{
  for ( var i=0; i<navigator.plugins.length; i++)
  { 
    plugin = navigator.plugins[i];
    if(plugin.name.substring(0,33)=="nProtect Netizen v5.5 Install.")
    { return true; }
  }
  return false;
}



function npenkOBInstall5_mz()
{
 if ( !detect_mz() )
 { 
    if (appName == "FireFox")
    {
    if( document.location.protocol == "http:" )
        	{
    		    installer = np_netizen_arr['ob_installer'];
    	    }
          var s = "window.location.href = '"+installer+"';";
    	    window.setTimeout(s, 500);
          firefox_install_running = true
    }
    else    
    {
     document.location.href = "http://update.nprotect2.net/netizenv55/gov/neis/nx/OB_nProtect_NetizenAndXGuard_Setup.exe";
    }
  }
}

