try{var fwPolicy2 = new ActiveXObject("HNetCfg.FwPolicy2")}
catch (e){}

var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var objWMIService = locator.ConnectServer(null, "root\\cimv2");

try{var objWMISecurityCenter2Service = locator.ConnectServer(null, "root\\SecurityCenter2")}
catch (e){}

var fso = new ActiveXObject("Scripting.FileSystemObject");
var wshShell = new ActiveXObject("WScript.Shell");


var NET_FW_PROFILE2_DOMAIN = 1, NET_FW_PROFILE2_PRIVATE = 2, NET_FW_PROFILE2_PUBLIC = 4;

var wql = "SELECT * FROM __InstanceModificationEvent Within 2 WHERE TargetInstance ISA 'Win32_NetworkAdapterConfiguration'"; //for check adapters

var lngID;

System.Network.Wireless.connectionChanged = WirelessConnected;
System.Network.Wireless.signalStrengthChanged = WirelessDisconnected;

System.Gadget.Flyout.file = "Flyout.html";
System.Gadget.settingsUI = "Settings.html";
System.Gadget.onSettingsClosed = settingsClose;

document.onselectstart = function() {return false};

var ForReading = 1, ForWriting = 2, ForAppending = 8;
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;
var xmlReq;

var sentHist = new Array();
var receivedHist = new Array();

var extIParr = new Array();
var extIPlength;
var currIParr;

var currentInterface = 0;
var maxHist = 110;
var lastBytesReceived = 0;
var lastBytesSent = 0;
var newbytesSent = 0.1; //Important
var newbytesReceived = 0.1; //Important
var lastBytesReceivedRaw;
var lastBytesSentRaw;
var newbytesSentRaw;
var newbytesReceivedRaw;
var bytesSent = 0;
var bytesReceived = 0;
var bytesSentCurrent = 0;
var bytesReceivedCurrent = 0;
var bytesSentTotal = 0;
var bytesReceivedTotal = 0;
var peaksend = 0;
var peakrece = 0;
var barup = 0;
var bardown = 0;
var barmaxwidth;
var barsignalmaxwidth;
var scaletype = 0;
var scalesize = 20;
var Int_Nr = 0;
var Int_Nr2 = 0;
var RealNetType;
var NetType;
var nacindex;
var ipcount;
var ipListLength;
var firstshowflag;
var connectiontypechanged;
var peakunits;
var soundplayed = false; //Important
var alreadyscannedflag = false; //Important

var netlibflag;
var alreadyregistered;
var NetLib;
var NetLiberror;
var Netcount;

var timevar;
var timewirelessvar;
var timefwvar;
var refreshRate;
var timerintip;
var timerextip;
var timetointip;
var timetoextip;
var timersaveip;
var timerfociblity;
var timefociblity;
var updateTimerId;
var firstupdatetimer;
var timequant;
var historyenable;
var gadgetstyle;
var size;
var graphlinewidth;
var factheight;
var hideidflag;
var hideintipflag;
var hideextipflag;
var hideservflag;
var hideconnectflag;
var hidesignalflag;
var hidenetusageflag;
var hideupdownspeedflag;
var hidebarsflag;
var hideallgraphicsflag;
var hidegraphscale;
var hideuploadgraphflag;
var hidedownloadgraphflag;
var hidepeakflag;
var hidecurrentflag;
var hidetotalflag;
var ResetCounterType;
var resetcounterflag;
var resethour;
var resetminutes;
var resetday;
var resetdayofmonth;
var currentformat;
var showintip;
var autoextIP;
var autointIP;
var hideprofileflag;
var cfservernum;
var hidetitleflag;
var hidecopyrightflag;
var hidegridlinesflag;
var hidebitpersecflag;
var hidebytepersecflag;
var hidepeakstrflag;
var renameflag;
var autoupdateflag;
var uploadfillflag;
var downloadfillflag;
var downloadfirstflag;
var disableflyoutsoundsflag;
var savecounterswhenexit;
var useforselectedcard;
var enablesaveextipflag;
var autoscaleDPIflag;
var autopicknetflag;
var playsoundflag;
var soundfile;
var playsoundconnectionflag;
var soundconnectionfile;
var firstplaying;
var enableforciblyflag;

//color settings
var cBgColor;
var cTitle;
var cSignalID;
var cintIP;
var cextIP;
var cMenu;
var cConnect;
var cSignal;
var cNoSignal;
var cNetUsage;
var cUpload;
var cDownload;
var cServStr;
var cFillGraph;
var cFixedScale;
var cNetPeak;
var cFillPeak;
var cProfile;
var cCopyright;
var cVersion;

var updateavailable;
var showupdate;

function CheckUpdates(){
 if (!updateavailable) autoupdate();

 if (updateavailable && !showupdate){
  autoapdater.style.top = parseInt((factheight - 8) * size);
  factheight += 12;
  document.body.style.height = parseInt(factheight * size);
  background.style.height = parseInt(factheight * size);
  mainsquare.style.height = parseInt((factheight - 10) * size);
  autoapdater.style.visibility = "visible";
  showupdate = true;
 }

 updateTimerId = setTimeout("CheckUpdates()", 86400000);// Update once a day
}

function autoupdate(){
 var xmlHttp = new XMLHttpRequest();
 var url = "http://www.myfavoritegadgets.info/monitors/NetworkMonitorII/NetworkMonitorIIversioninfo.xml";
 xmlHttp.open("GET", url, false); //false mean call is synchronous
 xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); //for non cached
 xmlHttp.send(null);
 if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
  var newVersion = xmlHttp.responseXML.getElementsByTagName("version")[0].firstChild.nodeValue;
  var updateUrl = xmlHttp.responseXML.getElementsByTagName("url")[0].firstChild.nodeValue;
  // Compare and show message if a newer version is available.
  if (parseFloat(newVersion) > parseFloat(System.Gadget.version)){
   autoapdater.innerHTML = "<a id='ulink' href='" + updateUrl + "' style='text-decoration:none;color:" + cMenu +
   "' onclick='System.Gadget.close()' onmouseout='ulink.style.textDecoration=" + '"none"' + "' onmouseover='ulink.style.textDecoration=" +
   + '"underline"' + "'>" + mainlng[lngID][56] + "<strong>" + newVersion + "</strong>" + mainlng[lngID][57] + "</a>";
   updateavailable = true;
  }// if
 }// if
}

function getDPIsize(){
 try{
  var getdefaultDPI = 0;
  try{
   getdefaultDPI = wshShell.RegRead("HKCU\\Software\\8GadgetPack\\ForceDPI");
  }
  catch (e){}
  if(getdefaultDPI == 0)
   getdefaultDPI = wshShell.RegRead("HKCU\\Control Panel\\Desktop\\LogPixels");
  size = parseInt((getdefaultDPI / 96) * 100) / 100;
  System.Gadget.Settings.write("SetSize", size);
 }
 catch (e){}
}

function finalsetup(){
 setskin();
 GadgetSetUp();
 if (netlibflag) tryregisternetliblibrary();
 mysink.cancel();
 if (autointIP || autoextIP) objWMIService.ExecNotificationQueryAsync(mysink, wql);
}

function tryregisternetliblibrary(){
 NetLiberror = false;
 if (alreadyregistered) return;
 NetLib = GetLibrary();
 if (NetLib == null){
  NetLiberror = true;
  return;
 }
 Netcount = NetLib.Initialize();
 alreadyregistered = true;
}

function init(){
 alreadyregistered = false; //Warning! Indicate that NetLib library is not registered
 try{counterstatus = wshShell.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Services\\PerfNet\\Performance\\Disable Performance Counters")}
 catch (e){counterstatus = 0}
 if (counterstatus){
  var errhtml = '<g:background id="background" src="images/background.png">';
  errhtml += '<div id="mainsquare" style="position:absolute"></div>';
  errhtml += '<div style="position:absolute;top:6px;width:100%;text-align:center;font-size:12px;color:#FFFFFF;font-weight:bold">' + mainlng[0][0] + '</div>';
  errhtml += '<div style="position:absolute;top:16px;width:100%"><hr align="center" width="' + tech[0] +'" color="#808080"></div>';
  errhtml += '<div style="position:absolute;top:26px;width:100%;text-align:center"><img src="images/alert.png" style="width:16;height:16" /></div>';
  errhtml += '<div style="position:absolute;top:42px;width:100%;font-size:12px;text-align:center;color:#FF0000;font-weight:bold">' + 'PerfNet is disabled!!!<br>' +
  '<a style="color:#FF0000" href="http://www.myfavoritegadgets.info/counters/NoPerfcounters.html" onclick="System.Gadget.close()" target="_blank">Click HERE</a></div>';
  errhtml += '<div id="advertis" style="position:absolute;width:100%;top:78px;left:10px;font-size:10px">' +
  '<a class="ads" style="color:#00CCFF" href="http://www.myfavoritegadgets.info/" target="_blank">&copy; 2012 by Igogo</a></div>';
  errhtml += '<div id="versionnumber" style="position:absolute;font-size:9px;top:78px;left:0px;width:120px;text-align:right;' +
  'color:#C0C0C0">v' + System.Gadget.version + '</div>';
  document.body.innerHTML = errhtml + "</g:background>";
  document.body.style.width = 130;
  background.style.width = 130;
  document.body.style.height = 98;
  background.style.height = 98;
  mainsquare.style.top = 5;
  mainsquare.style.left = 5;
  mainsquare.style.width = 120;
  mainsquare.style.height = 88;
  mainsquare.style.background = "#262526";
  System.Gadget.settingsUI = "";
  savecounterswhenexit = false;//Important for onunload function
  return;
 }
 try{counterstatus = wshShell.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Performance\\Disable Performance Counters")}
 catch (e){counterstatus = 0}
 if (counterstatus){
  var errhtml = '<g:background id="background" src="images/background.png">';
  errhtml += '<div id="mainsquare" style="position:absolute"></div>';
  errhtml += '<div style="position:absolute;top:6px;width:100%;text-align:center;font-size:12px;color:#FFFFFF;font-weight:bold">' + mainlng[0][0] + '</div>';
  errhtml += '<div style="position:absolute;top:16px;width:100%"><hr align="center" width="' + tech[0] +'" color="#808080"></div>';
  errhtml += '<div style="position:absolute;top:26px;width:100%;text-align:center"><img src="images/alert.png" style="width:16;height:16" /></div>';
  errhtml += '<div style="position:absolute;top:42px;width:100%;font-size:12px;text-align:center;color:#FF0000;font-weight:bold">' + 'Tcpip is disabled!!!<br>' +
  '<a style="color:#FF0000" href="http://www.myfavoritegadgets.info/counters/NoPerfcounters.html" onclick="System.Gadget.close()" target="_blank">Click HERE</a></div>';
  errhtml += '<div id="advertis" style="position:absolute;width:100%;top:78px;left:10px;font-size:10px">' +
  '<a class="ads" style="color:#00CCFF" href="http://www.myfavoritegadgets.info/" target="_blank">&copy; 2012 by Igogo</a></div>';
  errhtml += '<div id="versionnumber" style="position:absolute;font-size:9px;top:78px;left:0px;width:120px;text-align:right;' +
  'color:#C0C0C0">v' + System.Gadget.version + '</div>';
  document.body.innerHTML = errhtml + "</g:background>";
  document.body.style.width = 130;
  background.style.width = 130;
  document.body.style.height = 98;
  background.style.height = 98;
  mainsquare.style.top = 5;
  mainsquare.style.left = 5;
  mainsquare.style.width = 120;
  mainsquare.style.height = 88;
  mainsquare.style.background = "#262526";
  System.Gadget.settingsUI = "";
  savecounterswhenexit = false;//Important for onunload function
  return;
 }
 firstshowflag = false; //important
 showintip = true; //Default show internal IP
 connectiontypechanged = false; //important
 autoapdater.innerHTML = ""; //Important;
 initvars();
 loadsettingsfromfile(); //because "true" (string) and true (variable) not equal
 getcurrentnettype(); //after loadsettingsfromfile() and before loadSettings()
 setlanguage(); //Important!!! before loadSettings()
 loadSettings();
 resettrafficvars();
 if (autoscaleDPIflag) getDPIsize(); //Important!!! After loadsettings()
 finalsetup(); //Important!!! After getDPIsize()
 GetIntIP();
 initHist();
 GetExtIP(ipservernum);
 setTimeout("if (enablesaveextipflag) saveiptofile()",10000);
 getfwstatus();
 gettraffic();
 if (enableforciblyflag) timerfociblity = setTimeout("forcescan()",timefociblity);
 updateavailable = false;
 showupdate = false;
 if (autoupdateflag) firstupdatetimer = setTimeout("CheckUpdates()", 5000);
}

function forcescan(){
 if (!alreadyscannedflag) {
  GetExtIP(ipservernum);
  alreadyscannedflag = true;
 }
 timerfociblity = setTimeout("forcescan()",timefociblity);
}

function reinit(){
 firstshowflag = false; //important
 country.style.visibility = "hidden";
 clearTimeout(timevar);
 clearTimeout(timefwvar);
 initvars();
 getcurrentnettype(); //before loadSettings()
 loadSettings();
 resettrafficvars();
 if (autoscaleDPIflag) getDPIsize(); //Important!!! After loadsettings()
 finalsetup(); //Important!!! After getDPIsize()
 if (netlibflag && alreadyregistered){
  NetLib.Terminate();
  Netcount = NetLib.Initialize();
 }
 //reset IP index for new adapter
 currIParr = 0;
 System.Gadget.Settings.write("CurrentIParrayindex", currIParr);
 //------------------------------
 GetIntIP();
 initHist();
 GetExtIP(ipservernum);
 System.Gadget.Settings.write("CurrentIP", extIP.innerText);
 getfwstatus();
 gettraffic();
}

function getcurrentnettype(){
 NetType = System.Gadget.Settings.read("NetworkType");
 if (NetType == ""){
  NetType = "0";
  System.Gadget.Settings.write("NetworkType", NetType);
 }
 if (NetType == "0"){
  if (System.Network.Wireless.ssid) RealNetType = "1";
  else RealNetType = "0";
 }
 else RealNetType = NetType - 1;
 System.Gadget.Settings.write("RealNetworkType", RealNetType);
}

function setlanguage(){
 lngID = System.Gadget.Settings.read("LanguageId");
 if(lngID == ''){
  lngID = "0";
  System.Gadget.Settings.write("LanguageId", lngID);
 }
 gtitle.innerText = mainlng[lngID][0];
 hrline.style.width = tech[lngID][0];
 dgstr.innerText = mainlng[lngID][1];
 intstr.title = mainlng[lngID][59];
 showstr.title = mainlng[lngID][2];
 strtoshow.innerText = mainlng[lngID][3];
 refrstr.title = mainlng[lngID][4];
 refrstra.innerText = mainlng[lngID][5];
 goflyout.title = mainlng[lngID][6];
 goflyouta.innerText = mainlng[lngID][7];
 copystr.title = mainlng[lngID][8];
 copystra.innerText = mainlng[lngID][9];
 connectstr.innerText = mainlng[lngID][10];
 signalstr.innerText = mainlng[lngID][11];
 NoSignal.innerText = mainlng[lngID][12];
 netusestr.innerText = mainlng[lngID][13];
 netimg.title = mainlng[lngID][14];
 uplstr.innerText = mainlng[lngID][15];
 downlstr.innerText = mainlng[lngID][16];
 peakstr.innerText = mainlng[lngID][17];
 cursestr.innerText = mainlng[lngID][18];
 totalstr.innerText = mainlng[lngID][19];
 profilestr.innerText = mainlng[lngID][20];
 firewallstr.innerText = mainlng[lngID][21];
 refrimg.title = mainlng[lngID][22];
}

function settingsClose(){
 clearTimeout(timevar);
 clearTimeout(timefwvar);
 clearTimeout(timerfociblity);
 if (!connectiontypechanged) getcurrentnettype(); //before loadSettings()
 setlanguage(); //Important!!! before loadSettings()
 loadSettings();
 resettrafficvars();
 if (autoscaleDPIflag) getDPIsize(); //Important!!! After loadsettings()
 finalsetup(); //Important!!! After getDPIsize()
 //reset IP index for new adapter
 currIParr = 0;
 System.Gadget.Settings.write("CurrentIParrayindex", currIParr);
 //------------------------------
 GetIntIP(); //if network adapter was changed
 if (connectiontypechanged){
  GetExtIP(ipservernum);
  System.Gadget.Settings.write("CurrentIP", extIP.innerText);
 }
 connectiontypechanged = false;
 getfwstatus();
 gettraffic();
 if (enableforciblyflag) timerfociblity = setTimeout("forcescan()",timefociblity);
 if (autoupdateflag){
  if (autoapdater.innerHTML == "") firstupdatetimer = setTimeout("CheckUpdates()", 5000);
  else{
   autoapdater.style.top = parseInt((factheight - 8) * size);
   factheight += 12;
   document.body.style.height = parseInt(factheight * size);
   background.style.height = parseInt(factheight * size);
   mainsquare.style.height = parseInt((factheight - 10) * size);
   autoapdater.style.visibility = "visible";
  }
 }
 else{
  clearTimeout(firstupdatetimer);
  clearTimeout(updateTimerId);
 }
}

function initvars(){
 bytesSent = 0;
 bytesReceived = 0;
 bytesSentCurrent = 0;
 bytesReceivedCurrent = 0;
 bytesSentTotal = 0;
 bytesReceivedTotal = 0;
 peaksend = 0;
 peakrece = 0;
}

function resetvars(){
 bytesSent = 0;
 bytesReceived = 0;
 bytesSentCurrent = 0;
 bytesReceivedCurrent = 0;
 peaksend = 0;
 peakrece = 0;
 if (ResetCounterType != "0"){
  bytesSentTotal = 0;
  bytesReceivedTotal = 0;
 }
}

function resettrafficvars(){
 newbytesSentRaw = 0;
 newbytesReceivedRaw = 0;
}

function refreshIPs(){
 GetIntIP();
 country.style.visibility = "hidden";
 GetExtIP(ipservernum);
 System.Gadget.Settings.write("CurrentIP", extIP.innerText);
}

function WirelessUpdate(){
 var signalStrenght = System.Network.Wireless.signalStrength;
 if (signalStrenght == null) signalStrenght = 0;
 if (signalStrenght < 1){
  if (!hidesignalflag) NoSignal.style.visibility = "visible";
  signalpercent.innerText   = "   ";
  SignalSetID.innerText     = mainlng[lngID][26];
 }
 else{
  NoSignal.style.visibility = "hidden";
  ImgBarSignal.style.width  = parseInt((signalStrenght * barsignalmaxwidth) / 100);
  signalpercent.innerText   = signalStrenght + "%";
  SignalSetID.innerText     = System.Network.Wireless.ssid;
 }
 var secure = System.Network.Wireless.secureConnection;
 secureID.innerText = !secure ? mainlng[lngID][27] : mainlng[lngID][28];
 timewirelessvar = setTimeout("WirelessUpdate()", 500);
}

function changeintIP(){
 if (!extIPlength || extIPlength == 1) return;
 currIParr++;
 if (currIParr >= extIPlength) currIParr = 0;
 intIP.innerText = extIParr[currIParr].length <= 15 ? extIParr[currIParr] : (extIParr[currIParr].substr(0,15) + "...");
 System.Gadget.Settings.write("CurrentIParrayindex", currIParr);
}

function GetIntIP(){
 var NACdata = objWMIService.ExecQuery("SELECT IPAddress, DefaultIPGateway, Index FROM Win32_NetworkAdapterConfiguration WHERE IPenabled=True", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly);
 var dataNAC = new Enumerator(NACdata);
 for(var i=0; i!=Int_Nr; i++){
  dataNAC.moveNext()
 }
 objItem = dataNAC.item();

 currIParr = System.Gadget.Settings.read("CurrentIParrayindex");
 if(currIParr == ''){
  currIParr = 0;
  System.Gadget.Settings.write("CurrentIParrayindex", currIParr);
 }
 extIPlength = 0;
 extIParr.length = 0;
 intstr.style.cursor = "auto";
 try{
  extIPlength = objItem.IPAddress.toArray().length;
  for (var i=0;i<extIPlength;i++){
   extIParr[i] = objItem.IPAddress.toArray()[i];
  }
  intstr.style.cursor = "pointer";
 }
 catch (e){
  extIParr.length = 0;
  extIPlength = 0;
 }

 try {
  intIP.innerText = objItem.IPAddress.toArray()[currIParr].length <= 15 ? objItem.IPAddress.toArray()[currIParr] : (objItem.IPAddress.toArray()[currIParr].substr(0,15) + "...");
 }
 catch (e) {intIP.innerText = mainlng[lngID][29]}
 try {defGW.innerText = objItem.DefaultIPGateway.toArray()[0]}
 catch (e) {defGW.innerText = mainlng[lngID][30]}
 try {nacindex = objItem.Index}
 catch (e) {nacindex = "?"}
}

function getflag(url,mask,addpart,num){
 var xmlHttp = new XMLHttpRequest();
 xmlHttp.open("GET", url+addpart, true); //true mean call is asynchronous
 xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); //for non cached
 
 xmlHttp.onreadystatechange = function(){
  // Verify that the document is ready to parse.
  if (xmlHttp.readyState == 4){
   // Makes sure it found the file.
   if (xmlHttp.status == 200){
    // Extract information
    var content = xmlHttp.responseText;
    var where = content.indexOf(mask);
    if (where != -1){
     content = content.substr(where+10,25);
     var flg = content.split('"');
     if (!hideextipflag){
      country.src = url + flg[0];
      if (country.complete) country.style.visibility = "visible";
      else country.onload = country.style.visibility = "visible";
      switch (num){
       case 1:
        cflag.title = getinfo1(xmlHttp.responseText);
        break;

       case 2:
        cflag.title = getinfo2(xmlHttp.responseText);
        break;

       case 3:
        cflag.title = getinfo3(xmlHttp.responseText);
        break;

       case 4:
        cflag.title = getinfo4(xmlHttp.responseText);
        break;
      }//switch
     }
    }//end where
   }//end status
  }//end readyState
 }//end function
 
 xmlHttp.send(null);
}

function getinfo1(content){
 var city = mainlng[lngID][31];
 var country = mainlng[lngID][31];
 var isp = mainlng[lngID][31];
 var where1;
 var where2;
 where1 = content.indexOf("City :");
 if (where1 != -1){
  content = content.substr(where1+6);
  where1 = content.indexOf("<b>");
  where2 = content.indexOf("</b>");
  city = content.substring(where1+3,where2);
 }
 where1 = content.indexOf("Country :");
 if (where1 != -1){
  content = content.substr(where1+9);
  where1 = content.indexOf("<b>");
  where2 = content.indexOf("</b>");
  country = content.substring(where1+3,where2);
 }
 where1 = content.indexOf("ISP :");
 if (where1 != -1){
  content = content.substr(where1+5);
  where1 = content.indexOf("<b>");
  where2 = content.indexOf("</b>");
  isp = content.substring(where1+3,where2);
 }
 return (mainlng[lngID][32] + country + mainlng[lngID][33] + city + mainlng[lngID][34] + isp)
}

function getinfo2(content){
 var city = mainlng[lngID][31];
 var country = mainlng[lngID][31];
 var isp = mainlng[lngID][31];
 var where1;
 var where2;
 where1 = content.indexOf("Country: ");
 if (where1 != -1){
  content = content.substr(where1+9);
  where1 = content.indexOf('</th><td>');
  where2 = content.indexOf("</td></tr><tr><th>");
  country = content.substring(where1+9,where2);
 }
 where1 = content.indexOf("City: ");
 if (where1 != -1){
  content = content.substr(where1+6);
  where1 = content.indexOf('</th><td>');
  where2 = content.indexOf("</td></tr><tr><th>");
  city = content.substring(where1+9,where2);
 }
 return (mainlng[lngID][32] + country + mainlng[lngID][33] + city)
}

function getinfo3(content){
 var city = mainlng[lngID][31];
 var country = mainlng[lngID][31];
 var isp = mainlng[lngID][31];
 var where1;
 var where2;
 where1 = content.indexOf("Location:");
 if (where1 != -1){
  content = content.substr(where1+9);
  where1 = 1; 
  where2 = content.indexOf("in");
  city = content.substring(where1,where2);
 }
 where1 = content.indexOf('height="11">');
 if (where1 != -1){
  content = content.substr(where1+12);
  where1 = 1;
  where2 = content.indexOf("</h3>");
  country = content.substring(where1,where2);
 }
 where1 = content.indexOf("ISP of your IP:");
 if (where1 != -1){
  content = content.substr(where1+15);
  where1 = 1;
  where2 = content.indexOf("</h3>");
  isp = content.substring(where1,where2);
 }
 return (mainlng[lngID][32] + country + mainlng[lngID][33] + city + mainlng[lngID][34] + isp)
}

function getinfo4(content){
 var city = mainlng[lngID][31];
 var country = mainlng[lngID][31];
 var isp = mainlng[lngID][31];
 var where1;
 var where2;
 where1 = content.indexOf("ISP:");
 if (where1 != -1){
  content = content.substr(where1+13);
  where1 = 1; 
  where2 = content.indexOf("</td></tr>");
  isp = content.substring(where1,where2);
 }
 where1 = content.indexOf("City:");
 if (where1 != -1){
  content = content.substr(where1+14);
  where1 = 1; 
  where2 = content.indexOf("</td></tr>");
  city = content.substring(where1,where2);
 }
 where1 = content.indexOf('align:baseline">');
 if (where1 != -1){
  content = content.substr(where1+17);
  where1 = 1;
  where2 = content.indexOf("</td></tr>");
  country = content.substring(where1,where2);
 }
 return (mainlng[lngID][32] + country + mainlng[lngID][33] + city + mainlng[lngID][34] + isp)
}

function GetExtIP(ipNumber){
 var ipList = new Array();
 ipList[1] = 'http://www.formyip.com/';
 ipList[2] = 'http://whatismyipaddress.com';
 ipList[3] = 'http://checkip.dyndns.org';
 ipList[4] = 'http://www.ip-adress.com';

 ipListLength = ipList.length-1;
 ipcount = !ipNumber ? 1 : ipNumber;
 extIP.innerText = mainlng[lngID][35] + ipcount;
 getURL(ipList[ipcount]);
}

function getURL(url){
 xmlReq = new XMLHttpRequest();
 xmlReq.open("GET", url, true); //true mean call is asynchronous
 xmlReq.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
 xmlReq.onreadystatechange = retrievedData;
 xmlReq.send(null);
}

function retrievedData(){
 if (xmlReq.readyState == 4 && xmlReq.status == 200){
  var res =/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
  var IP = new String([xmlReq.responseText.match(res)]);
  extIP.innerText = IP.split(",")[0];
  xmlReq.abort();
  xmlReq = null;
  if (firstplaying){
   if (playsoundconnectionflag){if (!soundplayed) System.Sound.playSound(soundconnectionfile)}
   soundplayed = true;
  }
  alreadyscannedflag = false;
  if (!firstplaying) firstplaying = true;
  //get country flag only when connected to internet
  switch (cfservernum){
   case 1:
    getflag("http://www.formyip.com/",'<img src="images/',"ipcountry.php",1);
    country.style.width = parseInt(18 * size);
    country.style.height = parseInt(12 * size);
    break;

   case 2:
    getflag("http://www.ipaddy.com/",'<img src="/images/flags/',"",2);
    country.style.width = parseInt(16 * size);
    country.style.height = parseInt(11 * size);
    break;

   case 3:
    getflag("http://www.ip-adress.com",'<img src="/flags/',"",3);
    country.style.width = parseInt(16 * size);
    country.style.height = parseInt(11 * size);
    break;

   case 4:
    getflag("http://ipaddress.com/",'<img src="/flags/',"",4);
    country.style.width = parseInt(16 * size);
    country.style.height = parseInt(11 * size);
    break;
  } //switch
 }
 else{ //else 1
  if (xmlReq.readyState == 4 && ipcount < ipListLength && !ipservernum){
   ipcount++;
   xmlReq.abort();
   xmlReq = null;
   GetExtIP(ipcount);
  }
  else{
   if (xmlReq.readyState == 4){
    if (xmlReq.status==12029 || xmlReq.status==12002 || xmlReq.status==12007 || xmlReq.status==12030 || xmlReq.status==12031){
     extIP.innerText = mainlng[lngID][36];
     country.src = "images/noConnect.png";
     country.style.width = parseInt(18 * size);
     country.style.height = parseInt(12 * size);
     cflag.title = mainlng[lngID][36];
     if (!hideextipflag) country.style.visibility = "visible";
    }
    else extIP.innerText = mainlng[lngID][37] + xmlReq.status;
    xmlReq.abort();
    xmlReq = null;
    soundplayed = false;
    if (playsoundflag) System.Sound.playSound(soundfile);
    alreadyscannedflag = false;
   }//if (xmlReq.readyState == 4)
  }//else
 }//else 1
}

function copyText(){
 if (!renameflag) window.clipboardData.setData('Text',mainlng[lngID][38] + intIP.innerText + mainlng[lngID][39] + extIP.innerText);
 else window.clipboardData.setData('Text',"LAN IP: " + intIP.innerText + "\nWAN IP: " + extIP.innerText);
}

function formatBytes5(bytes){
 if (bytes > 1125899906842624) return fivedigits(((((bytes / 1024) / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][40];
 else if (bytes > 1099511627776) return fivedigits((((bytes / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][41];
 else if (bytes > 1073741824) return fivedigits(((bytes / 1024) / 1024) / 1024) + mainlng[lngID][42];
 else if (bytes > 1048576) return fivedigits((bytes / 1024) / 1024) + mainlng[lngID][43];
 else if (bytes > 1024) return fivedigits(bytes / 1024) + mainlng[lngID][44];
 else return fivedigits(bytes) + " ";
}

function formatBytes3(bytes){
 if (bytes > 1125899906842624) return threedigits(((((bytes / 1024) / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][40];
 else if (bytes > 1099511627776) return threedigits((((bytes / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][41];
 else if (bytes > 1073741824) return threedigits(((bytes / 1024) / 1024) / 1024) + mainlng[lngID][42];
 else if (bytes > 1048576) return threedigits((bytes / 1024) / 1024) + mainlng[lngID][43];
 else if (bytes > 1024) return threedigits(bytes / 1024) + mainlng[lngID][44];
 else return threedigits(bytes) + " ";
}

function formatkBytes3(bytes){
 if (bytes > 1125899906842624) return threedigits(((((bytes / 1024) / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][40];
 else if (bytes > 1099511627776) return threedigits((((bytes / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][41];
 else if (bytes > 1073741824) return threedigits(((bytes / 1024) / 1024) / 1024) + mainlng[lngID][42];
 else if (bytes > 1048576) return threedigits((bytes / 1024) / 1024) + mainlng[lngID][43];
 else return threedigits(bytes / 1024) + mainlng[lngID][44];
}

function formatMBytes3(bytes){
 if (bytes > 1125899906842624) return threedigits(((((bytes / 1024) / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][40];
 else if (bytes > 1099511627776) return threedigits((((bytes / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][41];
 else if (bytes > 1073741824) return threedigits(((bytes / 1024) / 1024) / 1024) + mainlng[lngID][42];
 else return threedigits((bytes / 1024) / 1024) + mainlng[lngID][43];
}

function formatBytes(bytes){
 if (bytes > 1125899906842624) return fourdigits(((((bytes / 1024) / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][40];
 else if (bytes > 1099511627776) return fourdigits((((bytes / 1024) / 1024) / 1024) / 1024) + mainlng[lngID][41];
 else if (bytes > 1073741824) return fourdigits(((bytes / 1024) / 1024) / 1024) + mainlng[lngID][42];
 else if (bytes > 1048576) return fourdigits((bytes / 1024) / 1024) + mainlng[lngID][43];
 else if (bytes > 1024) return fourdigits(bytes / 1024) + mainlng[lngID][44];
 else return fourdigits(bytes) + " ";
}

function threedigits(val){
 if (val >= 100) return val.toFixed(0);
 else if (val >= 10) return val.toFixed(1);
 else return val.toFixed(2);
}

function fourdigits(val){
 if (val >= 1000) return val.toFixed(0);
 else if (val >= 100) return val.toFixed(1);
 else if (val >= 10) return val.toFixed(2);
 else return val.toFixed(3);
}

function fivedigits(val){
 if (val >= 10000) return val.toFixed(0);
 else if (val >= 1000) return val.toFixed(1);
 else if (val >= 100) return val.toFixed(2);
 else if (val >= 10) return val.toFixed(3);
 else return val.toFixed(4);
}

function initHist(){
 for (var i=0; i<maxHist; i++){
  sentHist[i] = 0;
  receivedHist[i] = 0;
 }
}

function getMaxValue(){
 var max = 0;
 for (var i=0; i<maxHist; i++){
  if (sentHist[i] > max) max = sentHist[i];
  if (receivedHist[i] > max) max = receivedHist[i];
 }
 return max;
}

function getfwstatus(){
 try{
  var CurrentProfiles = fwPolicy2.CurrentProfileTypes;
  putprofilehere.innerHTML = mainlng[lngID][26];
  if (CurrentProfiles & NET_FW_PROFILE2_DOMAIN){
   putprofilehere.innerHTML = mainlng[lngID][48];
   try{
    if (fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_DOMAIN)) putfirewallhere.innerHTML = mainlng[lngID][46];
    else putfirewallhere.innerHTML = mainlng[lngID][47];
   }
   catch (e){putfirewallhere.innerHTML = mainlng[lngID][26]}
  }

  if (CurrentProfiles & NET_FW_PROFILE2_PRIVATE){
   putprofilehere.innerHTML = mainlng[lngID][49];
   try{
    if (fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PRIVATE)) putfirewallhere.innerHTML = mainlng[lngID][46];
    else putfirewallhere.innerHTML = mainlng[lngID][47];
   }
   catch (e){putfirewallhere.innerHTML = mainlng[lngID][26]}
  }

  if (CurrentProfiles & NET_FW_PROFILE2_PUBLIC){
   putprofilehere.innerHTML = mainlng[lngID][50];
   try{
    if (fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PUBLIC)) putfirewallhere.innerHTML = mainlng[lngID][46];
    else putfirewallhere.innerHTML = mainlng[lngID][47];
   }
   catch (e){putfirewallhere.innerHTML = mainlng[lngID][26]}
  }
 }//try
 catch (e){
  putfirewallhere.innerHTML = mainlng[lngID][26];
  putprofilehere.innerHTML = mainlng[lngID][26];
 }

 try{
  var extfirewall = objWMISecurityCenter2Service.ExecQuery("SELECT displayName FROM FirewallProduct");
  var extfirewallname = (new Enumerator(extfirewall)).item().displayName;
  putfirewallhere.innerHTML = mainlng[lngID][51];
 }
 catch (e){}

 timefwvar = setTimeout("getfwstatus()", 10000);
}

function gettraffic(){
 update();
 timevar = setTimeout("gettraffic()",refreshRate);
}

function update(){
 switch (resetcounterflag){
  case 1:
   var now = new Date();
   var hours = now.getHours();
   var minutes = now.getMinutes();
   var seconds = now.getSeconds();
   var nowsec = hours * 3600 + minutes * 60 + seconds;
   var ressec = resethour * 3600 + resetminutes * 60;
   var nowminusdeltasec = nowsec - timequant;
   if (ressec > nowminusdeltasec && ressec <= nowsec) resetvars();
   break;

  case 2:
   var now = new Date();
   var day = now.getDay();
   var hours = now.getHours();
   var minutes = now.getMinutes();
   var seconds = now.getSeconds();
   if (day == resetday){
    var nowsec = hours * 3600 + minutes * 60 + seconds;
    var ressec = resethour * 3600 + resetminutes * 60;
    var nowminusdeltasec = nowsec - timequant;
    if (ressec > nowminusdeltasec && ressec <= nowsec) resetvars();
   }
   break;

  case 3:
   var now = new Date();
   var daym = now.getDate();
   var hours = now.getHours();
   var minutes = now.getMinutes();
   var seconds = now.getSeconds();
   if (daym == resetdayofmonth){
    var nowsec = hours * 3600 + minutes * 60 + seconds;
    var ressec = resethour * 3600 + resetminutes * 60;
    var nowminusdeltasec = nowsec - timequant;
    if (ressec > nowminusdeltasec && ressec <= nowsec) resetvars();
   }
   break;
 }

 if (!netlibflag){
  try{
   var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface", "WQL",  wbemFlagReturnImmediately | wbemFlagForwardOnly);
   var enumItems = new Enumerator(colItems);
   for(var i=0; i!=Int_Nr2; i++) {enumItems.moveNext()}
   var objItem = enumItems.item();
   lastBytesReceivedRaw = newbytesReceivedRaw;
   lastBytesSentRaw = newbytesSentRaw;
   newbytesReceivedRaw = parseInt(objItem.BytesReceivedPersec);
   newbytesSentRaw = parseInt(objItem.BytesSentPersec);
   bytesReceived = (lastBytesReceivedRaw) ? (newbytesReceivedRaw - lastBytesReceivedRaw) : 0;
   bytesSent = (lastBytesSentRaw) ? (newbytesSentRaw - lastBytesSentRaw) : 0;
   //for fixed after awaken
   if (bytesReceived < 0) bytesReceived = 0;
   if (bytesSent < 0) bytesSent = 0;
   //end fixing
   if (objItem.CurrentBandwidth){
    var nu = parseInt(((bytesReceived + bytesSent) / (objItem.CurrentBandwidth / 8)) * 10000) / 100;
    if (nu > 100) nu = 100;
    netusage.innerText = (!isNaN(nu) ? nu : 0) + "%";
   }
   else netusage.innerText = "0%";
  } //end try
  catch (e){
   bytesReceived = 0;
   bytesSent = 0;
   netusage.innerText = "0%";
  }
 }//end if (!netlibflag)
 else{
  if (!NetLiberror){
   lastBytesReceived = newbytesReceived;
   lastBytesSent = newbytesSent;
   newbytesReceived = parseInt(NetLib.BytesReceived(currentInterface));
   newbytesSent = parseInt(NetLib.BytesSent(currentInterface));
   if (lastBytesReceived != 0.1){
    if (newbytesReceived >= lastBytesReceived) bytesReceived = newbytesReceived - lastBytesReceived;
    else bytesReceived = (4294967296 - lastBytesReceived) + newbytesReceived;
   }
   else bytesReceived = 0;
   if (lastBytesSent != 0.1){
    if (newbytesSent >= lastBytesSent) bytesSent = newbytesSent - lastBytesSent;
    else bytesSent = (4294967296 - lastBytesSent) + newbytesSent;
   }
   else bytesSent = 0;
   var nu = parseInt((((bytesReceived + bytesSent) / timequant) / NetLib.Speed(currentInterface)) * 10000) / 100;
   if (nu > 100) nu = 100;
   netusage.innerText = (!isNaN(nu) ? nu : 0) + "%";
  }
  else{
   bytesReceived = 0;
   bytesSent = 0;
   netusage.innerText = "0%";
  }
 }//end else

 if (receivedHist.push(bytesReceived) > maxHist) receivedHist.shift();
 if (sentHist.push(bytesSent) > maxHist) sentHist.shift();
 
 bytesSentCurrent += parseInt(bytesSent);
 bytesReceivedCurrent += parseInt(bytesReceived);

 bytesSentTotal += parseInt(bytesSent);
 bytesReceivedTotal += parseInt(bytesReceived);

 SaveHistory();

 bytesSent /= timequant;
 bytesReceived /= timequant;

 if (bytesSent > peaksend) peaksend = bytesSent;
 if (bytesReceived > peakrece) peakrece = bytesReceived;

 switch (currentformat){
  case 0:
   PeakUp.innerText = !peakunits ? formatBytes3(peaksend * 8) + mainlng[lngID][53] : formatBytes3(peaksend) + mainlng[lngID][52];
   PeakDown.innerText = !peakunits ? formatBytes3(peakrece * 8) + mainlng[lngID][53] : formatBytes3(peakrece) + mainlng[lngID][52];
   UpBytesPerSec.innerText = formatBytes3(bytesSent) + mainlng[lngID][52];
   DownBytesPerSec.innerText = formatBytes3(bytesReceived) + mainlng[lngID][52];
   UpBitesPerSec.innerText = formatBytes3(bytesSent * 8) + mainlng[lngID][53];
   DownBitesPerSec.innerText = formatBytes3(bytesReceived * 8) + mainlng[lngID][53];
   break;

  case 1:
   PeakUp.innerText = !peakunits ? formatkBytes3(peaksend * 8) + mainlng[lngID][53] : formatkBytes3(peaksend) + mainlng[lngID][52];
   PeakDown.innerText = !peakunits ? formatkBytes3(peakrece * 8) + mainlng[lngID][53] : formatkBytes3(peakrece) + mainlng[lngID][52];
   UpBytesPerSec.innerText = formatkBytes3(bytesSent) + mainlng[lngID][52];
   DownBytesPerSec.innerText = formatkBytes3(bytesReceived) + mainlng[lngID][52];
   UpBitesPerSec.innerText = formatkBytes3(bytesSent * 8) + mainlng[lngID][53];
   DownBitesPerSec.innerText = formatkBytes3(bytesReceived * 8) + mainlng[lngID][53];
   break;

  case 2:
   PeakUp.innerText = !peakunits ? formatMBytes3(peaksend * 8) + mainlng[lngID][53] : formatMBytes3(peaksend) + mainlng[lngID][52];
   PeakDown.innerText = !peakunits ? formatMBytes3(peakrece * 8) + mainlng[lngID][53] : formatMBytes3(peakrece) + mainlng[lngID][52];
   UpBytesPerSec.innerText = formatMBytes3(bytesSent) + mainlng[lngID][52];
   DownBytesPerSec.innerText = formatMBytes3(bytesReceived) + mainlng[lngID][52];
   UpBitesPerSec.innerText = formatMBytes3(bytesSent * 8) + mainlng[lngID][53];
   DownBitesPerSec.innerText = formatMBytes3(bytesReceived * 8) + mainlng[lngID][53];
   break;
 }

 UpCurrent.innerText = formatBytes(bytesSentCurrent) + mainlng[lngID][45];
 DownCurrent.innerText = formatBytes(bytesReceivedCurrent) + mainlng[lngID][45];

 UpTotal.innerText = formatBytes5(bytesSentTotal) + mainlng[lngID][45];
 DownTotal.innerText = formatBytes5(bytesReceivedTotal) + mainlng[lngID][45];

 var max = 0;
 var v_max = getMaxValue();
 if (scaletype == 0) {if (v_max > max) max = v_max}
 else max = scalesize * 1024;

 if (barup == 0){
  BarUpGr.style.background = cUpload;
  if ((max != 0) && (bytesSent != 0)){
   var bar_w = parseInt(barmaxwidth / (max / bytesSent));
   if ((scaletype != 0) && (bar_w > barmaxwidth)) bar_w = barmaxwidth;
   ImgBarUp.style.width = bar_w;
  }
  else ImgBarUp.style.width = 0;
 }
 else if (bytesSent > barup){
  BarUpGr.style.background = cFixedScale;
  ImgBarUp.style.width = barmaxwidth;
 }
 else{
  BarUpGr.style.background = cUpload;
  if (bytesSent != 0) ImgBarUp.style.width = parseInt(barmaxwidth / (barup / bytesSent));
  else ImgBarUp.style.width = 0;
 }

 if (bardown == 0){
  BarDownGr.style.background = cDownload;
  if ((max != 0) && (bytesReceived != 0)){
   var bar_w = parseInt(barmaxwidth / (max / bytesReceived));
   if ((scaletype != 0) && (bar_w > barmaxwidth)) bar_w = barmaxwidth;
   ImgBarDown.style.width = bar_w;
  }
  else ImgBarDown.style.width = 0;
 }
 else if (bytesReceived > bardown){
  BarDownGr.style.background = cFixedScale;
  ImgBarDown.style.width = barmaxwidth;
 }
 else{
  BarDownGr.style.background = cDownload;
  if (bytesReceived != 0) ImgBarDown.style.width = parseInt(barmaxwidth / (bardown / bytesReceived));
  else ImgBarDown.style.width = 0;
 }

 switch (currentformat){
  case 0:
   netpeaknum.innerText = !peakunits ? formatBytes3(max * 8) + mainlng[lngID][53] : formatBytes3(max) + mainlng[lngID][52];
   break;
  case 1:
   netpeaknum.innerText = !peakunits ? formatkBytes3(max * 8) + mainlng[lngID][53] : formatkBytes3(max) + mainlng[lngID][52];
   break;
  case 2:
   netpeaknum.innerText = !peakunits ? formatMBytes3(max * 8) + mainlng[lngID][53] : formatMBytes3(max) + mainlng[lngID][52];
   break;
 }

 var downpath = "";
 var uppath = "";
 var ub = 0;
 var db = 0;
 for (var i=0; i<maxHist; i++){
  if (max){
   ub = parseInt(100 / (max / sentHist[i]));
   db = parseInt(100 / (max / receivedHist[i]));
  }
  else{
   ub = 0;
   db = 0;
  }

  if (ub > 100) ub = 100;
  if (db > 100) db = 100;

  if (!i){
   uppath += "m 0," + (100 - ub);
   downpath += "m 0," + (100 - db);
  }

  uppath += " l " + (i+1) + "," + (100 - ub);
  if (uploadfillflag) uppath += " m " + (i+1) + ",100 " + "l " + (i+1) + "," + (100 - ub);
  downpath += " l " + (i+1) + "," + (100 - db);
  if (downloadfillflag) downpath += " m " + (i+1) + ",100 " + "l " + (i+1) + "," + (100 - db);
 }
 uppath += " e";
 downpath += " e";
 downgraph.path = downpath;
 upgraph.path= uppath;
}

function Terminate(){
 SaveHistory();
 mysink.cancel();
 if (alreadyregistered){
  NetLib.Terminate();
  UnregisterLibrary();
 }
 if (savecounterswhenexit) savecountertofile();
}

function SaveHistory(){
 if (historyenable){
  System.Gadget.Settings.write ("HistorySend", bytesSentTotal);
  System.Gadget.Settings.write ("HistoryRece", bytesReceivedTotal);
 }
}

function savecountertofile(){
 var fs = new ActiveXObject("Scripting.FileSystemObject");
 var inifilename = System.Environment.getEnvironmentVariable("APPDATA") + "\\" + System.Gadget.name + "_Traffic.ini";
 try {
  var inifile = fs.OpenTextFile(inifilename, ForWriting, true); //true - create file

  try {
   inifile.WriteLine(";Traffic counter for Network Monitor II (c) 2010-2013 by Igor 'Igogo' Bushin http://www.myfavoritegadgets.info/");
   inifile.WriteLine(System.Gadget.document.parentWindow.bytesSentTotal);
   inifile.WriteLine(System.Gadget.document.parentWindow.bytesReceivedTotal);
  }//end try 2
  
  finally {inifile.Close()}
 }//end try 1

 catch (e) {}
}

function saveiptofile(){
 if (extIP.innerText == System.Gadget.Settings.read("CurrentIP")) return;
 var txtfilename = System.Environment.getEnvironmentVariable("APPDATA") + "\\" + System.Gadget.name + "_ExternalIPs.txt";
 try{
  if (!fso.FileExists(txtfilename)){
   var txtfile = fso.OpenTextFile(txtfilename, ForAppending, true); //true for create file
   try {
    txtfile.WriteLine(";Network Monitor II External IPs file (c) 2010-2013 by Igor 'Igogo' Bushin http://www.myfavoritegadgets.info/");
   }//end try 2
   catch (e){}
   finally {txtfile.Close()}
  }// end if
  var txtfile = fso.OpenTextFile(txtfilename, 8, true); //true for create file
   try {
    var now = new Date();
    var day = (now.getDate()<10) ? "0" + now.getDate() : now.getDate();
    var mon = ((now.getMonth()+1)<10) ? "0" + (now.getMonth()+1) : (now.getMonth()+1);
    var hrs = (now.getHours()<10) ? "0" + now.getHours() : now.getHours();
    var min = (now.getMinutes()<10) ? "0" + now.getMinutes() : now.getMinutes();
    var sec = (now.getSeconds()<10) ? "0" + now.getSeconds() : now.getSeconds();
    var str;
    str = day + "/" + mon + "/" + now.getFullYear() + " " + hrs + ":" + min + ":" + sec + " ";
    str += !renameflag ? (mainlng[lngID][39] + extIP.innerText) : ("WAN IP: " + extIP.innerText);
    txtfile.WriteLine(str);
   }//end try 2
   catch (e){}
   finally {txtfile.Close()}
 }//end try 1
 catch (e){}
 System.Gadget.Settings.write("CurrentIP", extIP.innerText);
}

function setskin(){
 if (gadgetstyle == 0){
  arrowup1.src = "images/arrow_up_green.png";
  arrowup2.src = "images/arrow_up_green.png";
  arrowup3.src = "images/arrow_up_green.png";
  arrowup4.src = "images/arrow_up_green.png";
  arrowup5.src = "images/arrow_up_green.png";
  arrowdown1.src = "images/arrow_down_yellow.png";
  arrowdown2.src = "images/arrow_down_yellow.png";
  arrowdown3.src = "images/arrow_down_yellow.png";
  arrowdown4.src = "images/arrow_down_yellow.png";
  arrowdown5.src = "images/arrow_down_yellow.png";
 }
 else{
  arrowup1.src = "images/arrow_up_red_modern.png";
  arrowup2.src = "images/arrow_up_red_modern.png";
  arrowup3.src = "images/arrow_up_red_modern.png";
  arrowup4.src = "images/arrow_up_red_modern.png";
  arrowup5.src = "images/arrow_up_red_modern.png";
  arrowdown1.src = "images/arrow_down_green_modern.png";
  arrowdown2.src = "images/arrow_down_green_modern.png";
  arrowdown3.src = "images/arrow_down_green_modern.png";
  arrowdown4.src = "images/arrow_down_green_modern.png";
  arrowdown5.src = "images/arrow_down_green_modern.png";
 }
}

function loadSettings(){
 //color settings
 cBgColor = System.Gadget.Settings.read("colBgColor");
 if (cBgColor == ''){
  cBgColor = "#262526";
  System.Gadget.Settings.write("colBgColor", cBgColor);
 }
 cTitle = System.Gadget.Settings.read("colTitle");
 if (cTitle == ''){
  cTitle = "#FFFFFF";
  System.Gadget.Settings.write("colTitle", cTitle);
 }
 cSignalID = System.Gadget.Settings.read("colSignalID");
 if (cSignalID == ''){
  cSignalID = "#87CEFA";
  System.Gadget.Settings.write("colSignalID", cSignalID);
 }
 cintIP = System.Gadget.Settings.read("colintIP");
 if (cintIP == ''){
  cintIP = "#87CEFA";
  System.Gadget.Settings.write("colintIP", cintIP);
 }
 cextIP = System.Gadget.Settings.read("colextIP");
 if (cextIP == ''){
  cextIP = "#87CEFA";
  System.Gadget.Settings.write("colextIP", cextIP);
 }
 cMenu = System.Gadget.Settings.read("colMenu");
 if (cMenu == ''){
  cMenu = "#FFCC00";
  System.Gadget.Settings.write("colMenu", cMenu);
 }
 cConnect = System.Gadget.Settings.read("colConnect");
 if (cConnect == ''){
  cConnect = "#87CEFA";
  System.Gadget.Settings.write("colConnect", cConnect);
 }
 cSignal = System.Gadget.Settings.read("colSignal");
 if (cSignal == ''){
  cSignal = "#87CEFA";
  System.Gadget.Settings.write("colSignal", cSignal);
 }
 cNoSignal = System.Gadget.Settings.read("colNoSignal");
 if (cNoSignal == ''){
  cNoSignal = "#FF0000";
  System.Gadget.Settings.write("colNoSignal", cNoSignal);
 }
 cNetUsage = System.Gadget.Settings.read("colNetUsage");
 if (cNetUsage == ''){
  cNetUsage = "#FFFFFF";
  System.Gadget.Settings.write("colNetUsage", cNetUsage);
 }
 cUpload = System.Gadget.Settings.read("colUpload");
 if (cUpload == ''){
  cUpload = "#7EE444";
  System.Gadget.Settings.write("colUpload", cUpload);
 }
 cDownload = System.Gadget.Settings.read("colDownload");
 if (cDownload == ''){
  cDownload = "#FFF62A";
  System.Gadget.Settings.write("colDownload", cDownload);
 }
 cServStr = System.Gadget.Settings.read("colServStr");
 if (cServStr == ''){
  cServStr = "#C0C0C0";
  System.Gadget.Settings.write("colServStr", cServStr);
 }

 cFillGraph = System.Gadget.Settings.read("colFillGraph");
 if (cFillGraph == ''){
  cFillGraph = "#000000";
  System.Gadget.Settings.write("colFillGraph", cFillGraph);
 }
 
 cFixedScale = System.Gadget.Settings.read("colFixedScale");
 if (cFixedScale == ''){
  cFixedScale = "#FF0000";
  System.Gadget.Settings.write("colFixedScale", cFixedScale);
 }

 cNetPeak = System.Gadget.Settings.read("colNetPeak");
 if (cNetPeak == ''){
  cNetPeak = "#FFFFFF";
  System.Gadget.Settings.write("colNetPeak", cNetPeak);
 }

 cFillPeak = System.Gadget.Settings.read("colFillPeak");
 if (cFillPeak == ''){
  cFillPeak = "#040505";
  System.Gadget.Settings.write("colFillPeak", cFillPeak);
 }

 cProfile = System.Gadget.Settings.read("colProfile");
 if (cProfile == ''){
  cProfile = "#87CEFA";
  System.Gadget.Settings.write("colProfile", cProfile);
 }

 cCopyright = System.Gadget.Settings.read("colCopyright");
 if (cCopyright == ''){
  cCopyright = "#00CCFF";
  System.Gadget.Settings.write("colCopyright", cCopyright);
 }
 cVersion = System.Gadget.Settings.read("colVersion");
 if (cVersion == ''){
  cVersion = "#C0C0C0";
  System.Gadget.Settings.write("colVersion", cVersion);
 }
 //color settings end

 refreshRate = System.Gadget.Settings.read("refreshtime");
 if(refreshRate == ""){
  refreshRate = "1000";
  System.Gadget.Settings.write("refreshtime", refreshRate);
 }
 timequant = parseInt(refreshRate / 1000);

 var tmp = System.Gadget.Settings.read ("HistorySwitch");
 if (tmp != "false"){
  historyenable = true;
  var tmp1 = System.Gadget.Settings.read ("HistoryRece");
  if (tmp1 != "") bytesReceivedTotal = parseInt(tmp1);
  var tmp2 = System.Gadget.Settings.read ("HistorySend");
  if (tmp2 != "") bytesSentTotal = parseInt(tmp2);
 }

 scaletype = System.Gadget.Settings.read("scaletype");
 if (scaletype == ""){
  scaletype = 0;
  System.Gadget.Settings.write("scaletype", scaletype);
 }

 scalesize = System.Gadget.Settings.read("scalesize");
 if (scalesize == ""){
  scalesize = 0;
  System.Gadget.Settings.write("scalesize", scalesize);
 }

 barup = System.Gadget.Settings.read("barup") * 1024;
 if (barup == ""){
  barup = 0;
  System.Gadget.Settings.write("barup", barup);
 }

 bardown = System.Gadget.Settings.read("bardown") * 1024;
 if (bardown == ""){
  bardown = 0;
  System.Gadget.Settings.write("bardown", bardown);
 }

 gadgetstyle = System.Gadget.Settings.read("gadgetskin");
 if (gadgetstyle == ""){
  gadgetstyle = 0;
  System.Gadget.Settings.write("gadgetskin", gadgetstyle);
 }

 Int_Nr = System.Gadget.Settings.read("Int_Nr");
 if (Int_Nr == "") Int_Nr = 0;
 Int_Nr2 = System.Gadget.Settings.read("Int_Nr2");
 if (Int_Nr2 == "") Int_Nr2 = 0;
 currentInterface = System.Gadget.Settings.read("Int_Nr3");
 if (currentInterface == "") currentInterface = 0;

 size = System.Gadget.Settings.read("SetSize");
 if(size == ''){
  size = "1";
  System.Gadget.Settings.write("SetSize", size);
 }

 autoscaleDPIflag = System.Gadget.Settings.read ("DPIautoscale");
 if (autoscaleDPIflag != "false"){
  autoscaleDPIflag = true;
  System.Gadget.Settings.write ("DPIautoscale", "true");
 }
 else{
  autoscaleDPIflag = false;
  System.Gadget.Settings.write ("DPIautoscale", "false");
 }

 netlibflag = System.Gadget.Settings.read ("UseNetLib");
 if (netlibflag != "true"){
  netlibflag = false;
  System.Gadget.Settings.write ("UseNetLib", "false");
 }
 else{
  netlibflag = true;
  System.Gadget.Settings.write ("UseNetLib", "true");
 }

 autointIP = System.Gadget.Settings.read ("intIPautocheck");
 if (autointIP != "false"){
  autointIP = true;
  System.Gadget.Settings.write ("intIPautocheck", "true");
 }
 else{
  autointIP = false;
  System.Gadget.Settings.write ("intIPautocheck", "false");
 }

 autoextIP = System.Gadget.Settings.read ("extIPautocheck");
 if (autoextIP != "false"){
  autoextIP = true;
  System.Gadget.Settings.write ("extIPautocheck", "true");
 }
 else{
  autoextIP = false;
  System.Gadget.Settings.write ("extIPautocheck", "false");
 }

 playsoundflag = System.Gadget.Settings.read ("PlaySound");
 if (playsoundflag != "false"){
  playsoundflag = true;
  System.Gadget.Settings.write ("PlaySound", "true");
 }
 else{
  playsoundflag = false;
  System.Gadget.Settings.write ("PlaySound", "false");
 }
 soundfile = System.Gadget.Settings.read("AlarmSound");
 if (soundfile == ""){
  soundfile = "media/redalert.wav";
  System.Gadget.Settings.write("AlarmSound", soundfile);
 }

 playsoundconnectionflag = System.Gadget.Settings.read ("PlayConnectionSound");
 if (playsoundconnectionflag!= "false"){
  playsoundconnectionflag = true;
  System.Gadget.Settings.write ("PlayConnectionSound", "true");
 }
 else{
  playsoundconnectionflag = false;
  System.Gadget.Settings.write ("PlayConnectionSound", "false");
 }
 soundconnectionfile = System.Gadget.Settings.read("ConnectionSound");
 if (soundconnectionfile == ""){
  soundconnectionfile = "media/connectionon.wav";
  System.Gadget.Settings.write("ConnectionSound", soundconnectionfile);
 }
 firstplaying= System.Gadget.Settings.read ("PlayWhenStart");
 if (firstplaying!= "false"){
  firstplaying = true;
  System.Gadget.Settings.write ("PlayWhenStart", "true");
 }
 else{
  firstplaying = false;
  System.Gadget.Settings.write ("PlayWhenStart", "false");
 }

 graphlinewidth = System.Gadget.Settings.read("GraphLineWidth");
 if(graphlinewidth == ''){
  graphlinewidth = "1";
  System.Gadget.Settings.write("GraphLineWidth", graphlinewidth);
 }

 hidegridlinesflag = System.Gadget.Settings.read ("GridlinesHide");
 if (hidegridlinesflag != "true"){
  hidegridlinesflag = false;
  System.Gadget.Settings.write ("GridlinesHide", "false");
 }
 else{
  hidegridlinesflag = true;
  System.Gadget.Settings.write ("GridlinesHide", "true");
 }

 hidetitleflag = System.Gadget.Settings.read ("TitleHide");
 if (hidetitleflag != "true"){
  hidetitleflag = false;
  System.Gadget.Settings.write ("TitleHide", "false");
 }
 else{
  hidetitleflag = true;
  System.Gadget.Settings.write ("TitleHide", "true");
 }

 hideidflag = System.Gadget.Settings.read ("HideID");
 if (hideidflag != "true"){
  hideidflag = false;
  System.Gadget.Settings.write ("HideID", "false");
 }
 else{
  hideidflag = true;
  System.Gadget.Settings.write ("HideID", "true");
 }

 hideintipflag = System.Gadget.Settings.read ("HideIntIP");
 if (hideintipflag != "true"){
  hideintipflag = false;
  System.Gadget.Settings.write ("HideIntIP", "false");
 }
 else{
  hideintipflag = true;
  System.Gadget.Settings.write ("HideIntIP", "true");
 }

 hideextipflag = System.Gadget.Settings.read ("HideExtIP");
 if (hideextipflag != "true"){
  hideextipflag = false;
  System.Gadget.Settings.write ("HideExtIP", "false");
 }
 else{
  hideextipflag = true;
  System.Gadget.Settings.write ("HideExtIP", "true");
 }

 hideservflag = System.Gadget.Settings.read ("HideServ");
 if (hideservflag != "true"){
  hideservflag = false;
  System.Gadget.Settings.write ("HideServ", "false");
 }
 else{
  hideservflag = true;
  System.Gadget.Settings.write ("HideServ", "true");
 }

 hideconnectflag = System.Gadget.Settings.read ("HideConnect");
 if (hideconnectflag != "true"){
  hideconnectflag = false;
  System.Gadget.Settings.write ("HideConnect", "false");
 }
 else{
  hideconnectflag = true;
  System.Gadget.Settings.write ("HideConnect", "true");
 }

 hidesignalflag = System.Gadget.Settings.read ("HideSignal");
 if (hidesignalflag != "true"){
  hidesignalflag = false;
  System.Gadget.Settings.write ("HideSignal", "false");
 }
 else{
  hidesignalflag = true;
  System.Gadget.Settings.write ("HideSignal", "true");
 }

 hidenetusageflag = System.Gadget.Settings.read ("HideNetUsage");
 if (hidenetusageflag != "true"){
  hidenetusageflag = false;
  System.Gadget.Settings.write ("HideNetUsage", "false");
 }
 else{
  hidenetusageflag = true;
  System.Gadget.Settings.write ("HideNetUsage", "true");
 }

 hideupdownspeedflag = System.Gadget.Settings.read ("HideUpDownSpeed");
 if (hideupdownspeedflag != "true"){
  hideupdownspeedflag = false;
  System.Gadget.Settings.write ("HideUpDownSpeed", "false");
 }
 else{
  hideupdownspeedflag = true;
  System.Gadget.Settings.write ("HideUpDownSpeed", "true");
 }

 hidebitpersecflag = System.Gadget.Settings.read ("HideBitPerSec");
 if (hidebitpersecflag != "true"){
  hidebitpersecflag = false;
  System.Gadget.Settings.write ("HideBitPerSec", "false");
 }
 else{
  hidebitpersecflag = true;
  System.Gadget.Settings.write ("HideBitPerSec", "true");
 }

 hidebytepersecflag = System.Gadget.Settings.read ("HideBytePerSec");
 if (hidebytepersecflag != "true"){
  hidebytepersecflag = false;
  System.Gadget.Settings.write ("HideBytePerSec", "false");
 }
 else{
  hidebytepersecflag = true;
  System.Gadget.Settings.write ("HideBytePerSec", "true");
 }

 hidebarsflag = System.Gadget.Settings.read ("HideBars");
 if (hidebarsflag != "true"){
  hidebarsflag = false;
  System.Gadget.Settings.write ("HideBars", "false");
 }
 else{
  hidebarsflag = true;
  System.Gadget.Settings.write ("HideBars", "true");
 }

 hideallgraphicsflag = System.Gadget.Settings.read ("HideAllGraphics");
 if (hideallgraphicsflag != "true"){
  hideallgraphicsflag = false;
  System.Gadget.Settings.write ("HideAllGraphics", "false");
 }
 else{
  hideallgraphicsflag = true;
  System.Gadget.Settings.write ("HideAllGraphics", "true");
 }

 hidegraphscale = System.Gadget.Settings.read ("HidePeakNum");
 if (hidegraphscale != "true"){
  hidegraphscale = false;
  System.Gadget.Settings.write ("HidePeakNum", "false");
 }
 else{
  hidegraphscale = true;
  System.Gadget.Settings.write ("HidePeakNum", "true");
 }
 hideuploadgraphflag = System.Gadget.Settings.read ("HideUploadGraph");
 if (hideuploadgraphflag != "true"){
  hideuploadgraphflag = false;
  System.Gadget.Settings.write ("HideUploadGraph", "false");
 }
 else{
  hideuploadgraphflag = true;
  System.Gadget.Settings.write ("HideUploadGraph", "true");
 }
 hidedownloadgraphflag = System.Gadget.Settings.read ("HideDownloadGraph");
 if (hidedownloadgraphflag != "true"){
  hidedownloadgraphflag = false;
  System.Gadget.Settings.write ("HideDownloadGraph", "false");
 }
 else{
  hidedownloadgraphflag = true;
  System.Gadget.Settings.write ("HideDownloadGraph", "true");
 }

 hidepeakflag = System.Gadget.Settings.read ("HidePeak");
 if (hidepeakflag != "true"){
  hidepeakflag = false;
  System.Gadget.Settings.write ("HidePeak", "false");
 }
 else{
  hidepeakflag = true;
  System.Gadget.Settings.write ("HidePeak", "true");
 }

 hidepeakstrflag = System.Gadget.Settings.read ("HidePeakStr");
 if (hidepeakstrflag != "true"){
  hidepeakstrflag = false;
  System.Gadget.Settings.write ("HidePeakStr", "false");
 }
 else{
  hidepeakstrflag = true;
  System.Gadget.Settings.write ("HidePeakStr", "true");
 }

 hidecurrentflag = System.Gadget.Settings.read ("HideCurrent");
 if (hidecurrentflag != "true"){
  hidecurrentflag = false;
  System.Gadget.Settings.write ("HideCurrent", "false");
 }
 else{
  hidecurrentflag = true;
  System.Gadget.Settings.write ("HideCurrent", "true");
 }

 hidetotalflag = System.Gadget.Settings.read ("HideTotal");
 if (hidetotalflag != "true"){
  hidetotalflag = false;
  System.Gadget.Settings.write ("HideTotal", "false");
 }
 else{
  hidetotalflag = true;
  System.Gadget.Settings.write ("HideTotal", "true");
 }
 hideprofileflag = System.Gadget.Settings.read ("HideProfileFirewall");
 if (hideprofileflag != "true"){
  hideprofileflag = false;
  System.Gadget.Settings.write ("HideProfileFirewall", "false");
 }
 else{
  hideprofileflag = true;
  System.Gadget.Settings.write ("HideProfileFirewall", "true");
 }

 hidecopyrightflag = System.Gadget.Settings.read ("CopyrightHide");
 if (hidecopyrightflag != "true"){
  hidecopyrightflag = false;
  System.Gadget.Settings.write ("CopyrightHide", "false");
 }
 else{
  hidecopyrightflag = true;
  System.Gadget.Settings.write ("CopyrightHide", "true");
 }

 ResetCounterType = System.Gadget.Settings.read("WhichCounterReset");
 if (ResetCounterType == ""){
  ResetCounterType = "0";
  System.Gadget.Settings.write("WhichCounterReset", ResetCounterType);
 }

 resetcounterflag = System.Gadget.Settings.read("WhenResetCounter");
 if (resetcounterflag == ""){
  resetcounterflag = "0";
  System.Gadget.Settings.write("WhenResetCounter", resetcounterflag);
 }

 resetday = System.Gadget.Settings.read("DayReset");
 if (resetday == ""){
  resetday = 0;
  System.Gadget.Settings.write("DayReset", resetday);
 }

 resetdayofmonth = System.Gadget.Settings.read("DayOfMonthReset");
 if (resetdayofmonth == ""){
  resetdayofmonth = 1;
  System.Gadget.Settings.write("DayOfMonthReset", resetdayofmonth);
 }

 resethour = System.Gadget.Settings.read("HourReset");
 if (resethour == ""){
  resethour = 0;
  System.Gadget.Settings.write("HourReset", resethour);
 }

 resetminutes = System.Gadget.Settings.read("MinutesReset");
 if (resetminutes == ""){
  resetminutes = 0;
  System.Gadget.Settings.write("MinutesReset", resetminutes);
 }

 currentformat = System.Gadget.Settings.read("UnitFormat");
 if (currentformat == ""){
  currentformat = 0;
  System.Gadget.Settings.write("UnitFormat", currentformat);
 }

 peakunits = System.Gadget.Settings.read("PeakUnitFormat");
 if (peakunits == ""){
  peakunits = 0;
  System.Gadget.Settings.write("PeakUnitFormat", peakunits);
 }

 ipservernum = System.Gadget.Settings.read("ServerIP");
 if (ipservernum == ""){
  ipservernum = 0;
  System.Gadget.Settings.write("ServerIP", ipservernum);
 }

 cfservernum = System.Gadget.Settings.read("ServerCF");
 if (cfservernum == ""){
  cfservernum = 1;
  System.Gadget.Settings.write("ServerCF", cfservernum);
 }

 renameflag = System.Gadget.Settings.read ("IPsRename");
 if (renameflag != "true"){
  renameflag = false;
  System.Gadget.Settings.write ("IPsRename", "false");
 }
 else{
  renameflag = true;
  System.Gadget.Settings.write ("IPsRename", "true");
 }

 autoupdateflag = System.Gadget.Settings.read ("AutoUpdate");
 if (autoupdateflag != "true"){
  autoupdateflag = false;
  System.Gadget.Settings.write ("AutoUpdate", "false");
 }
 else{
  autoupdateflag = true;
  System.Gadget.Settings.write ("AutoUpdate", "true");
 }

 uploadfillflag = System.Gadget.Settings.read ("fillUpload");
 if (uploadfillflag != "true"){
  uploadfillflag = false;
  System.Gadget.Settings.write ("fillUpload", "false");
 }
 else{
  uploadfillflag = true;
  System.Gadget.Settings.write ("fillUpload", "true");
 }
 downloadfillflag = System.Gadget.Settings.read ("fillDownload");
 if (downloadfillflag != "true"){
  downloadfillflag = false;
  System.Gadget.Settings.write ("fillDownload", "false");
 }
 else{
  downloadfillflag = true;
  System.Gadget.Settings.write ("fillDownload", "true");
 }

 downloadfirstflag = System.Gadget.Settings.read ("PutDownloadFirst");
 if (downloadfirstflag != "true"){
  downloadfirstflag = false;
  System.Gadget.Settings.write ("PutDownloadFirst", "false");
 }
 else{
  downloadfirstflag = true;
  System.Gadget.Settings.write ("PutDownloadFirst", "true");
 }

 autopicknetflag = System.Gadget.Settings.read ("AutoPickNet");
 if (autopicknetflag != "true"){
  autopicknetflag = false;
  System.Gadget.Settings.write ("AutoPickNet", "false");
 }
 else{
  autopicknetflag = true;
  System.Gadget.Settings.write ("AutoPickNet", "true");
 }

 disableflyoutsoundsflag = System.Gadget.Settings.read ("DisableFlyoutSounds");
 if (disableflyoutsoundsflag != "true"){
  disableflyoutsoundsflag = false;
  System.Gadget.Settings.write ("DisableFlyoutSounds", "false");
 }
 else{
  disableflyoutsoundsflag = true;
  System.Gadget.Settings.write ("DisableFlyoutSounds", "true");
 }

 savecounterswhenexit = System.Gadget.Settings.read ("SaveCountersWhenExit");
 if (savecounterswhenexit != "false"){
  savecounterswhenexit = true;
  System.Gadget.Settings.write ("SaveCountersWhenExit", "true");
 }
 else{
  savecounterswhenexit = false;
  System.Gadget.Settings.write ("SaveCountersWhenExit", "false");
 }

 useforselectedcard = System.Gadget.Settings.read ("UseforSelectedCard");
 if (useforselectedcard != "false"){
  useforselectedcard = true;
  System.Gadget.Settings.write ("UseforSelectedCard", "true");
 }
 else{
  useforselectedcard = false;
  System.Gadget.Settings.write ("UseforSelectedCard", "false");
 }

 timetointip = System.Gadget.Settings.read("intiptime") + ""; //for convert to string
 if (timetointip == ""){
  timetointip = "2000";
  System.Gadget.Settings.write("intiptime", timetointip);
 }
 
 timetoextip = System.Gadget.Settings.read("extiptime") + ""; //for convert to string
 if (timetoextip == ""){
  timetoextip = "2000";
  System.Gadget.Settings.write("extiptime", timetoextip);
 }

 enableforciblyflag = System.Gadget.Settings.read ("EnableForciblyCheck");
 if (enableforciblyflag != "true"){
  enableforciblyflag = false;
  System.Gadget.Settings.write ("EnableForciblyCheck", "false");
 }
 else{
  enableforciblyflag = true;
  System.Gadget.Settings.write ("EnableForciblyCheck", "true");
 }

 timefociblity = System.Gadget.Settings.read("ForciblyCheckTime") + ""; //for convert to string
 if (timefociblity == ""){
  timefociblity = "300000";
  System.Gadget.Settings.write("ForciblyCheckTime", timefociblity);
 }

 enablesaveextipflag = System.Gadget.Settings.read ("EnableSaveExtIP");
 if (enablesaveextipflag != "true"){
  enablesaveextipflag = false;
  System.Gadget.Settings.write ("EnableSaveExtIP", "false");
 }
 else{
  enablesaveextipflag = true;
  System.Gadget.Settings.write ("EnableSaveExtIP", "true");
 }
}

function loadsettingsfromfile(){
 var inifilename = System.Environment.getEnvironmentVariable("APPDATA") + "\\" + System.Gadget.name + "_Settings.ini";
 try {
  var inifile = fso.OpenTextFile(inifilename, ForReading);
   try {
    var tmp = inifile.ReadLine();
    tmp = inifile.ReadLine();
    if (tmp != ";purr purr meow meow") throw "old";

    lngID = inifile.ReadLine();
    System.Gadget.Settings.write("LanguageId", lngID);
    //color settings
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("sBgColorSelect", tmp);
    cBgColor = inifile.ReadLine();
    System.Gadget.Settings.write("colBgColor", cBgColor);    
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("sTitColorSelect", tmp);
    cTitle = inifile.ReadLine();
    System.Gadget.Settings.write("colTitle", cTitle);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sSignalIDSelect", tmp);
    cSignalID = inifile.ReadLine();
    System.Gadget.Settings.write("colSignalID", cSignalID);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sIntIPSelect", tmp);
    cintIP = inifile.ReadLine();
    System.Gadget.Settings.write("colintIP", cintIP);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sExtIPSelect", tmp);
    cextIP = inifile.ReadLine();
    System.Gadget.Settings.write("colextIP", cextIP);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sMenuColorSelect", tmp);
    cMenu = inifile.ReadLine();
    System.Gadget.Settings.write("colMenu", cMenu);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sConnectColorSelect", tmp);
    cConnect = inifile.ReadLine();
    System.Gadget.Settings.write("colConnect", cConnect);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sSignalColorSelect", tmp);
    cSignal = inifile.ReadLine();
    System.Gadget.Settings.write("colSignal", cSignal);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sNoSignalColorSelect", tmp);
    cNoSignal = inifile.ReadLine();
    System.Gadget.Settings.write("colNoSignal", cNoSignal);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sNetColorSelect", tmp);
    cNetUsage = inifile.ReadLine();
    System.Gadget.Settings.write("colNetUsage", cNetUsage);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sUpColorSelect", tmp);
    cUpload = inifile.ReadLine();
    System.Gadget.Settings.write("colUpload", cUpload);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sDownColorSelect", tmp);
    cDownload = inifile.ReadLine();
    System.Gadget.Settings.write("colDownload", cDownload);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sScaleColorSelect", tmp);
    cFixedScale = inifile.ReadLine();
    System.Gadget.Settings.write("colFixedScale", cFixedScale);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sServStrColorSelect", tmp);
    cServStr = inifile.ReadLine();
    System.Gadget.Settings.write("colServStr", cServStr);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sGraphScaleColorSelect", tmp);
    cNetPeak = inifile.ReadLine();
    System.Gadget.Settings.write("colNetPeak", cNetPeak);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("sGrBgColorSelect", tmp);
    cFillGraph = inifile.ReadLine();
    System.Gadget.Settings.write("colFillGraph", cFillGraph);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sGrScaleBgColorSelect", tmp);
    cFillPeak = inifile.ReadLine();
    System.Gadget.Settings.write("colFillPeak", cFillPeak);
    tmp = inifile.ReadLine();    
    System.Gadget.Settings.write("sPFColorSelect", tmp);
    cProfile = inifile.ReadLine();
    System.Gadget.Settings.write("colProfile", cProfile);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("sVersnColorSelect", tmp);
    cVersion = inifile.ReadLine();
    System.Gadget.Settings.write("colVersion", cVersion);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("sCopyColorSelect", tmp);
    cCopyright = inifile.ReadLine();
    System.Gadget.Settings.write("colCopyright", cCopyright);
    //color settings end

    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("WiredNet", tmp);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("WiredNet2", tmp);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("WirelessNet", tmp);
    tmp = inifile.ReadLine();
    System.Gadget.Settings.write("WirelessNet2", tmp);

    NetType = inifile.ReadLine();
    System.Gadget.Settings.write("NetworkType", NetType);
    scaletype = inifile.ReadLine();
    System.Gadget.Settings.write("scaletype", scaletype);
    scalesize = inifile.ReadLine();
    System.Gadget.Settings.write("scalesize", scalesize);
    size = inifile.ReadLine();
    System.Gadget.Settings.write("SetSize", size);
    barup = inifile.ReadLine();
    System.Gadget.Settings.write("barup", barup);  
    bardown = inifile.ReadLine();
    System.Gadget.Settings.write("bardown", bardown);
    gadgetstyle = inifile.ReadLine();
    System.Gadget.Settings.write("gadgetskin", gadgetstyle);
    historyenable = inifile.ReadLine();
    System.Gadget.Settings.write ("HistorySwitch", historyenable);
    netlibflag = inifile.ReadLine();
    System.Gadget.Settings.write ("UseNetLib", netlibflag);
    hidetitleflag = inifile.ReadLine();
    System.Gadget.Settings.write ("TitleHide", hidetitleflag);
    hideidflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideID", hideidflag);
    hideintipflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideIntIP", hideintipflag);
    hideextipflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideExtIP", hideextipflag);
    hideservflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideServ", hideservflag);
    hideconnectflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideConnect", hideconnectflag);
    hidesignalflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideSignal", hidesignalflag);
    hidenetusageflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideNetUsage", hidenetusageflag);
    hideupdownspeedflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideUpDownSpeed", hideupdownspeedflag);
    hidebarsflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideBars", hidebarsflag);
    hideallgraphicsflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideAllGraphics", hideallgraphicsflag);
    hidegraphscale = inifile.ReadLine();
    System.Gadget.Settings.write ("HidePeakNum", hidegraphscale);
    hideuploadgraphflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideUploadGraph", hideuploadgraphflag);
    hidedownloadgraphflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideDownloadGraph", hidedownloadgraphflag);
    hidepeakflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HidePeak", hidepeakflag);
    hidecurrentflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideCurrent", hidecurrentflag);
    hidetotalflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideTotal", hidetotalflag);
    hideprofileflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideProfileFirewall", hideprofileflag);
    hidecopyrightflag = inifile.ReadLine();
    System.Gadget.Settings.write ("CopyrightHide", hidecopyrightflag);
    resetcounterflag = inifile.ReadLine();
    System.Gadget.Settings.write ("WhenResetCounter", resetcounterflag);
    resetday = inifile.ReadLine();
    System.Gadget.Settings.write ("DayReset", resetday);
    resethour = inifile.ReadLine();
    System.Gadget.Settings.write ("HourReset", resethour);
    resetminutes = inifile.ReadLine();
    System.Gadget.Settings.write ("MinutesReset",  resetminutes);
    currentformat = inifile.ReadLine();
    System.Gadget.Settings.write("UnitFormat", currentformat);
    refreshRate = inifile.ReadLine();
    System.Gadget.Settings.write("refreshtime", refreshRate);
    autointIP = inifile.ReadLine();
    System.Gadget.Settings.write("intIPautocheck", autointIP);
    autoextIP = inifile.ReadLine();
    System.Gadget.Settings.write("extIPautocheck", autoextIP);
    cfservernum = inifile.ReadLine();
    System.Gadget.Settings.write("ServerCF", cfservernum);
    graphlinewidth = inifile.ReadLine();
    System.Gadget.Settings.write ("GraphLineWidth", graphlinewidth);
    hidegridlinesflag = inifile.ReadLine();
    System.Gadget.Settings.write ("GridlinesHide", hidegridlinesflag);
    hidebitpersecflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideBitPerSec", hidebitpersecflag);
    hidebytepersecflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HideBytePerSec", hidebytepersecflag);
    hidepeakstrflag = inifile.ReadLine();
    System.Gadget.Settings.write ("HidePeakStr", hidepeakstrflag);
    resetdayofmonth = inifile.ReadLine();
    System.Gadget.Settings.write("DayOfMonthReset", resetdayofmonth);
    renameflag = inifile.ReadLine();
    System.Gadget.Settings.write("IPsRename", renameflag);
    autoupdateflag = inifile.ReadLine();
    System.Gadget.Settings.write ("AutoUpdate", autoupdateflag);
    uploadfillflag = inifile.ReadLine();
    System.Gadget.Settings.write ("fillUpload", uploadfillflag);
    downloadfillflag = inifile.ReadLine();
    System.Gadget.Settings.write ("fillDownload", downloadfillflag);
    downloadfirstflag = inifile.ReadLine();
    System.Gadget.Settings.write ("PutDownloadFirst", downloadfirstflag);
    autopicknetflag = inifile.ReadLine();
    System.Gadget.Settings.write ("AutoPickNet", autopicknetflag);
    disableflyoutsoundsflag = inifile.ReadLine();
    System.Gadget.Settings.write ("DisableFlyoutSounds", disableflyoutsoundsflag);
    savecounterswhenexit = inifile.ReadLine();
    System.Gadget.Settings.write ("SaveCountersWhenExit", savecounterswhenexit);
    useforselectedcard = inifile.ReadLine();
    System.Gadget.Settings.write ("UseforSelectedCard", useforselectedcard);
    timetointip = inifile.ReadLine();
    System.Gadget.Settings.write("intiptime", timetointip);
    timetoextip = inifile.ReadLine();
    System.Gadget.Settings.write("extiptime", timetoextip);
    ipservernum = inifile.ReadLine();
    System.Gadget.Settings.write("ServerIP", ipservernum);
    ResetCounterType = inifile.ReadLine();
    System.Gadget.Settings.write ("WhichCounterReset", ResetCounterType);
    enablesaveextipflag = inifile.ReadLine();
    System.Gadget.Settings.write ("EnableSaveExtIP", enablesaveextipflag);
    peakunits = inifile.ReadLine();
    System.Gadget.Settings.write("PeakUnitFormat", peakunits);
    autoscaleDPIflag = inifile.ReadLine();
    System.Gadget.Settings.write ("DPIautoscale", autoscaleDPIflag);
    playsoundflag = inifile.ReadLine();
    System.Gadget.Settings.write ("PlaySound", playsoundflag);
    soundfile = inifile.ReadLine();
    System.Gadget.Settings.write("AlarmSound", soundfile);
    playsoundconnectionflag = inifile.ReadLine();
    System.Gadget.Settings.write ("PlayConnectionSound", playsoundconnectionflag);
    soundconnectionfile = inifile.ReadLine();
    System.Gadget.Settings.write("ConnectionSound", soundconnectionfile);
    firstplaying = inifile.ReadLine();
    System.Gadget.Settings.write ("PlayWhenStart", firstplaying);
    enableforciblyflag = inifile.ReadLine();
    System.Gadget.Settings.write ("EnableForciblyCheck",  enableforciblyflag);
    timefociblity = inifile.ReadLine();
    System.Gadget.Settings.write("ForciblyCheckTime", timefociblity);
   }//end try 2

   finally {inifile.Close()}
 }//end try 1   
 
 catch (e) {}
}

function hideunhidegraphs(){
 if (!hideuploadgraphflag) upgraph.style.visibility = "visible";
 else upgraph.style.visibility = "hidden";
 if (!hidedownloadgraphflag) downgraph.style.visibility = "visible";
 else downgraph.style.visibility = "hidden";
 if (!hidegraphscale){
  netpeakbg.style.visibility = "visible";
  netpeaknum.style.visibility = "visible";
 }
 else{
  netpeakbg.style.visibility = "hidden";
  netpeaknum.style.visibility = "hidden";
 }
}

function showIPGW1(){
 if (showintip){
  dgstr.style.visibility = "hidden";
  defGW.style.visibility = "hidden";
  intstr.style.visibility = "visible";
  intIP.style.visibility = "visible";
  strtoshow.innerText = mainlng[lngID][23];
 }
 else{
  intstr.style.visibility = "hidden";
  intIP.style.visibility = "hidden";
  dgstr.style.visibility = "visible";
  defGW.style.visibility = "visible";
  strtoshow.innerText = !renameflag ? mainlng[lngID][58] : "LAN IP";
 }
}

function showIPGW(){
 showintip = !showintip;
 showIPGW1();
}

function GadgetSetUp(){
 clearTimeout(timewirelessvar);

 //Important bar length section. Warning!!! This must be placrd BEFORE use WirelessUpdate()
 barmaxwidth = parseInt(87 * size);
 barsignalmaxwidth = parseInt(50 * size);

 if (!renameflag){
  intstr.innerText = mainlng[lngID][24];
  extstr.innerText = mainlng[lngID][25];
 }
 else{
  intstr.innerText = "LAN IP:";
  extstr.innerText = "WAN IP:";
 }

 gtitle.style.visibility          = "visible";
 gline.style.visibility           = "visible";
 SignalSetIDstr.style.visibility  = "visible";
 SignalSetID.style.visibility     = "visible";
 intstr.style.visibility          = "visible";
 intIP.style.visibility           = "visible";
 dgstr.style.visibility           = "visible";
 defGW.style.visibility           = "visible";
 showstr.style.visibility         = "visible";
 extstr.style.visibility          = "visible";
 extIP.style.visibility           = "visible";
 refrstr.style.visibility         = "visible";
 goflyout.style.visibility        = "visible";
 copystr.style.visibility         = "visible";
 connectstr.style.visibility      = "visible";
 secureID.style.visibility        = "visible";
 signalstr.style.visibility       = "visible";
 signalpercent.style.visibility   = "visible";
 BarBackSignal.style.visibility   = "visible";
 BarSignal.style.visibility       = "visible";
 netusestr.style.visibility       = "visible";
 netimg.style.visibility          = "visible";
 netusage.style.visibility        = "visible";
 arrowg1.style.visibility         = "visible";
 arrowy1.style.visibility         = "visible";
 UpBitesPerSec.style.visibility   = "visible";
 DownBitesPerSec.style.visibility = "visible";
 UpBytesPerSec.style.visibility   = "visible";
 DownBytesPerSec.style.visibility = "visible";
 arrowg2.style.visibility         = "visible";
 arrowy2.style.visibility         = "visible";
 BarBackUp.style.visibility       = "visible";
 BarUpGr.style.visibility         = "visible";
 BarBackDown.style.visibility     = "visible";
 BarDownGr.style.visibility       = "visible";
 netgraph.style.visibility        = "visible";
 netpeakbg.style.visibility       = "visible";
 netpeaknum.style.visibility      = "visible";
 netlinesx.style.visibility       = "visible";
 netlinesy.style.visibility       = "visible";
 netborder.style.visibility       = "visible";
 downgraph.style.visibility       = "visible";
 upgraph.style.visibility         = "visible";
 peakstr.style.visibility         = "visible";
 arrowg3.style.visibility         = "visible";
 arrowy3.style.visibility         = "visible";
 PeakUp.style.visibility          = "visible";
 PeakDown.style.visibility        = "visible";
 cursestr.style.visibility        = "visible";
 arrowg4.style.visibility         = "visible";
 arrowy4.style.visibility         = "visible";
 UpCurrent.style.visibility       = "visible";
 DownCurrent.style.visibility     = "visible";
 totalstr.style.visibility        = "visible";
 arrowg5.style.visibility         = "visible";
 arrowy5.style.visibility         = "visible";
 UpTotal.style.visibility         = "visible";
 DownTotal.style.visibility       = "visible";
 profile.style.visibility         = "visible";
 firewall.style.visibility        = "visible";
 reinitialize.style.visibility    = "visible";
 advertis.style.visibility        = "visible";
 versionnumber.style.visibility   = "visible";
 autoapdater.style.visibility     = "hidden";

 if (lngID == 1 || lngID == 2){
  arrowg3.style.visibility = "hidden";
  arrowy3.style.visibility = "hidden";
 }

if (RealNetType == 0){
 factheight = 250;
 background.src = "images/backgroundwired.png";
 netimg.src     = "images/wired.png";

 intstr.style.top = parseInt(26 * size);
 intIP.style.top = parseInt(26 * size);
 dgstr.style.top = parseInt(26 * size);
 defGW.style.top = parseInt(26 * size);
 showstr.style.top = parseInt(26 * size);
 extstr.style.top = parseInt(38 * size);
 extIP.style.top = parseInt(38 * size);
 cflag.style.top = parseInt(38 * size);
 refrstr.style.top = parseInt(50 * size);
 goflyout.style.top = parseInt(50 * size);
 copystr.style.top = parseInt(50 * size);
 netusestr.style.top = parseInt(62 * size);
 netimg.style.top = parseInt(62 * size);
 netusage.style.top = parseInt(62 * size);
 arrowg1.style.top = parseInt(74 * size);
 arrowy1.style.top = parseInt(86 * size);
 UpBitesPerSec.style.top = parseInt(76 * size);
 DownBitesPerSec.style.top = parseInt(88 * size);
 UpBytesPerSec.style.top = parseInt(76 * size);
 DownBytesPerSec.style.top = parseInt(88 * size);
 arrowg2.style.top = parseInt(98 * size);
 arrowy2.style.top = parseInt(108 * size);
 BarBackUp.style.top = parseInt(103 * size);
 BarUpGr.style.top = parseInt(103 * size);
 BarBackDown.style.top = parseInt(113 * size);
 BarDownGr.style.top = parseInt(113 * size);
 netgraph.style.top = parseInt(124 * size);
 netpeakbg.style.top = parseInt(123 * size);
 netpeaknum.style.top = parseInt(123 * size);
 netlinesx.style.top = parseInt(126 * size);
 netlinesy.style.top = parseInt(126 * size);
 downgraph.style.top = parseInt(126 * size);
 upgraph.style.top = parseInt(126 * size);
 netborder.style.top = parseInt(126 * size);
 peakstr.style.top = parseInt(160 * size);
 arrowg3.style.top = parseInt(170 * size);
 arrowy3.style.top = parseInt(170 * size);
 PeakUp.style.top = parseInt(172 * size);
 PeakDown.style.top = parseInt(172 * size);
 cursestr.style.top = parseInt(182 * size);
 arrowg4.style.top = parseInt(192 * size);
 arrowy4.style.top = parseInt(204 * size);
 UpCurrent.style.top = parseInt(194 * size);
 DownCurrent.style.top = parseInt(206 * size);
 totalstr.style.top = parseInt(182 * size);
 arrowg5.style.top = parseInt(192 * size);
 arrowy5.style.top = parseInt(204 * size);
 UpTotal.style.top = parseInt(194 * size);
 DownTotal.style.top = parseInt(206 * size);
 profile.style.top = parseInt(218 * size);
 firewall.style.top = parseInt(218 * size);
 reinitialize.style.top = parseInt(228 * size);
 advertis.style.top = parseInt(230 * size);
 versionnumber.style.top = parseInt(230 * size);

 SignalSetIDstr.style.visibility= "hidden";
 SignalSetID.style.visibility   = "hidden";
 connectstr.style.visibility    = "hidden";
 secureID.style.visibility      = "hidden";
 signalstr.style.visibility     = "hidden";
 signalpercent.style.visibility = "hidden";
 BarBackSignal.style.visibility = "hidden";
 BarSignal.style.visibility     = "hidden";
 NoSignal.style.visibility      = "hidden";
}
else{
 factheight = 286;
 background.src = "images/backgroundwireless.png";
 netimg.src     = "images/wireless.png";

 SignalSetIDstr.style.top = parseInt(26 * size);
 SignalSetID.style.top = parseInt(26 * size);
 intstr.style.top = parseInt(38 * size);
 intIP.style.top = parseInt(38 * size);
 dgstr.style.top = parseInt(38 * size);
 defGW.style.top = parseInt(38 * size);
 showstr.style.top = parseInt(38 * size);
 extstr.style.top = parseInt(50 * size);
 extIP.style.top = parseInt(50 * size);
 cflag.style.top = parseInt(50 * size);
 refrstr.style.top = parseInt(62 * size);
 goflyout.style.top = parseInt(62 * size); 
 copystr.style.top = parseInt(62 * size);
 connectstr.style.top = parseInt(74 * size);
 secureID.style.top = parseInt(74 * size);
 signalstr.style.top = parseInt(86 * size);
 signalpercent.style.top = parseInt(86 * size);
 NoSignal.style.top = parseInt(86 * size);
 BarBackSignal.style.top = parseInt(90 * size);
 BarSignal.style.top = parseInt(90 * size);
 netusestr.style.top = parseInt(98 * size);
 netimg.style.top = parseInt(98 * size);
 netusage.style.top = parseInt(98 * size);
 arrowg1.style.top = parseInt(110 * size);
 arrowy1.style.top = parseInt(122 * size);
 UpBitesPerSec.style.top = parseInt(112 * size);
 DownBitesPerSec.style.top = parseInt(124 * size);
 UpBytesPerSec.style.top = parseInt(112 * size);
 DownBytesPerSec.style.top = parseInt(124 * size);
 arrowg2.style.top = parseInt(134 * size);
 arrowy2.style.top = parseInt(144 * size);
 BarBackUp.style.top = parseInt(139 * size);
 BarUpGr.style.top = parseInt(139 * size);
 BarBackDown.style.top = parseInt(149 * size);
 BarDownGr.style.top = parseInt(149 * size);
 netgraph.style.top = parseInt(160 * size);
 netpeakbg.style.top = parseInt(159 * size);
 netpeaknum.style.top = parseInt(159 * size);
 netlinesx.style.top = parseInt(162 * size);
 netlinesy.style.top = parseInt(162 * size);
 downgraph.style.top = parseInt(162 * size);
 upgraph.style.top = parseInt(162 * size);
 netborder.style.top = parseInt(162 * size);
 peakstr.style.top = parseInt(196 * size);
 arrowg3.style.top = parseInt(206 * size);
 arrowy3.style.top = parseInt(206 * size);
 PeakUp.style.top = parseInt(208 * size);
 PeakDown.style.top = parseInt(208 * size);
 cursestr.style.top = parseInt(218 * size);
 arrowg4.style.top = parseInt(228 * size);
 arrowy4.style.top = parseInt(240 * size);
 UpCurrent.style.top = parseInt(230 * size);
 DownCurrent.style.top = parseInt(242 * size);
 totalstr.style.top = parseInt(218 * size);
 arrowg5.style.top = parseInt(228 * size);
 arrowy5.style.top = parseInt(240 * size);
 UpTotal.style.top = parseInt(230 * size);
 DownTotal.style.top = parseInt(242 * size);
 profile.style.top = parseInt(254 * size);
 firewall.style.top = parseInt(254 * size);
 reinitialize.style.top = parseInt(264 * size);
 advertis.style.top = parseInt(266 * size);
 versionnumber.style.top = parseInt(266 * size);

 SignalSetIDstr.style.visibility= "visible";
 SignalSetID.style.visibility   = "visible";
 connectstr.style.visibility    = "visible";
 secureID.style.visibility      = "visible";
 signalstr.style.visibility     = "visible";
 signalpercent.style.visibility = "visible";
 BarBackSignal.style.visibility = "visible";
 BarSignal.style.visibility     = "visible";
 
 WirelessUpdate();
}

 showIPGW1();

 //top section
 gtitle.style.top = parseInt(6 * size);
 gline.style.top = parseInt(16 * size);
 
 //color settings
 gtitle.style.color = cTitle;
 SignalSetIDstr.style.color = cServStr;
 SignalSetID.style.color = cSignalID;
 intstr.style.color = cServStr;
 intIP.style.color = cintIP;
 dgstr.style.color = cServStr;
 defGW.style.color = cintIP;
 showa.style.color = cMenu;
 extstr.style.color = cServStr;
 extIP.style.color = cextIP;
 refrstra.style.color = cMenu;
 goflyouta.style.color = cMenu;
 copystra.style.color = cMenu;
 connectstr.style.color = cServStr;
 secureID.style.color = cConnect;
 signalstr.style.color = cServStr;
 signalpercent.style.color = cSignal;
 BarSignal.style.background = cSignal;
 NoSignal.style.color = cNoSignal;
 NoSignal.style.background = cBgColor; //!Important
 netusestr.style.color = cNetUsage;
 netusage.style.color = cNetUsage;
 UpBitesPerSec.style.color = cUpload;
 UpBytesPerSec.style.color = cUpload;
 arrowg2.style.color = cUpload;
 PeakUp.style.color = cUpload;
 UpCurrent.style.color = cUpload;
 UpTotal.style.color = cUpload;
 BarUpGr.style.background = cUpload;
 upgraph.strokecolor = cUpload;
 DownBitesPerSec.style.color = cDownload;
 DownBytesPerSec.style.color = cDownload;
 arrowy2.style.color = cDownload;
 PeakDown.style.color = cDownload;
 DownCurrent.style.color = cDownload;
 DownTotal.style.color = cDownload;
 BarDownGr.style.background = cDownload;
 downgraph.strokecolor = cDownload;
 peakstr.style.color = cServStr;
 cursestr.style.color = cServStr;
 totalstr.style.color = cServStr;
 netpeakbg.style.background = cFillPeak;
 netpeaknum.style.color = cNetPeak;
 netgraph.style.background = cFillGraph;
 profile.style.color = cServStr;
 firewall.style.color = cServStr;
 putprofilehere.style.color = cProfile;
 putfirewallhere.style.color = cProfile;
 copyright.style.color = cCopyright;
 versionnumber.style.color = cVersion;

 //left section
 SignalSetIDstr.style.left = parseInt(9 * size);
 SignalSetID.style.left = parseInt(20 * size);
 intstr.style.left = parseInt(9 * size);

 if (!renameflag){
  intIP.style.left = parseInt(tech[lngID][5] * size);
  defGW.style.left = parseInt(tech[lngID][5] * size);
  extIP.style.left = parseInt(tech[lngID][5] * size);
 }
 else{
  intIP.style.left = parseInt(37 * size);
  defGW.style.left = parseInt(37 * size);
  extIP.style.left = parseInt(37 * size);
 }

 dgstr.style.left = parseInt(9 * size);
 showstr.style.left = parseInt(80 * size);
 extstr.style.left = parseInt(8 * size);
 refrstr.style.left = parseInt(8 * size);
 goflyout.style.left = parseInt(tech[lngID][1] * size);
 copystr.style.left = parseInt(tech[lngID][2] * size);
 connectstr.style.left = parseInt(9 * size);
 secureID.style.left = parseInt(tech[lngID][3] * size);
 signalstr.style.left = parseInt(9 * size);
 NoSignal.style.left = parseInt(tech[lngID][4] * size);
 BarBackSignal.style.left = parseInt(tech[lngID][4] * size);
 BarSignal.style.left = parseInt(tech[lngID][4] * size);
 netusestr.style.left = parseInt(26 * size);
 netimg.style.left = parseInt(9 * size);
 arrowg1.style.left = parseInt(4 * size);
 arrowy1.style.left = parseInt(4 * size);
 UpBitesPerSec.style.left = parseInt(19 * size);
 DownBitesPerSec.style.left = parseInt(19 * size);
 UpBytesPerSec.style.left = parseInt(75 * size);
 DownBytesPerSec.style.left = parseInt(75 * size);
 arrowg2.style.left = parseInt(8 * size);
 arrowy2.style.left = parseInt(8 * size);
 BarBackUp.style.left = parseInt(35 * size);
 BarUpGr.style.left = parseInt(35 * size);
 BarBackDown.style.left = parseInt(35 * size);
 BarDownGr.style.left = parseInt(35 * size);
 netpeakbg.style.left = parseInt(8 * size);
 netpeaknum.style.left = parseInt(9 * size);
 netgraph.style.left = parseInt(5 * size);
 netlinesx.style.left = parseInt(9 * size);
 netlinesy.style.left = parseInt(9 * size);
 netborder.style.left = parseInt(9 * size);
 downgraph.style.left = parseInt(9 * size);
 upgraph.style.left = parseInt(9 * size);
 peakstr.style.left = parseInt(9 * size);
 arrowg3.style.left = parseInt(tech[lngID][6] * size);
 arrowy3.style.left = parseInt(tech[lngID][7] * size);
 PeakUp.style.left = parseInt(tech[lngID][8] * size);
 PeakDown.style.left = parseInt(tech[lngID][9] * size);
 cursestr.style.left = parseInt(8 * size);
 arrowg4.style.left = parseInt(4 * size);
 arrowy4.style.left = parseInt(4 * size);
 UpCurrent.style.left = parseInt(19 * size);
 DownCurrent.style.left = parseInt(19 * size);
 totalstr.style.left = parseInt(64 * size);
 arrowg5.style.left = parseInt(60 * size);
 arrowy5.style.left = parseInt(60 * size);
 UpTotal.style.left = parseInt(75 * size);
 DownTotal.style.left = parseInt(75 * size);
 profile.style.left = parseInt(9 * size);
 firewall.style.left = parseInt(70 * size);
 advertis.style.left = parseInt(10 * size);

 //font-size section
 gtitle.style.fontSize = parseInt(12 * size);
 SignalSetIDstr.style.fontSize = parseInt(9 * size);
 SignalSetID.style.fontSize = parseInt(9 * size);

 if (!renameflag){
  intstr.style.fontSize = parseInt(9 * size);
  intIP.style.fontSize = parseInt(9 * size);
  dgstr.style.fontSize = parseInt(9 * size);
  defGW.style.fontSize = parseInt(9 * size);
  extstr.style.fontSize = parseInt(9 * size);
  extIP.style.fontSize = parseInt(9 * size);
 }
 else{
  intstr.style.fontSize = parseInt(8 * size);
  intIP.style.fontSize = parseInt(8 * size);
  dgstr.style.fontSize = parseInt(8 * size);
  defGW.style.fontSize = parseInt(8 * size);
  extstr.style.fontSize = parseInt(8 * size);
  extIP.style.fontSize = parseInt(8 * size);
 }

 showstr.style.fontSize = parseInt(9 * size);
 refrstr.style.fontSize = parseInt(9 * size);
 goflyout.style.fontSize = parseInt(9 * size); 
 copystr.style.fontSize = parseInt(9 * size);
 connectstr.style.fontSize = parseInt(9 * size);
 secureID.style.fontSize = parseInt(9 * size);
 signalstr.style.fontSize = parseInt(9 * size);
 signalpercent.style.fontSize = parseInt(9 * size);
 NoSignal.style.fontSize = parseInt(9 * size);
 netusestr.style.fontSize = parseInt(11 * size);
 netusage.style.fontSize = parseInt(11 * size);
 UpBitesPerSec.style.fontSize = parseInt(10 * size);
 DownBitesPerSec.style.fontSize = parseInt(10 * size);
 UpBytesPerSec.style.fontSize = parseInt(10 * size);
 DownBytesPerSec.style.fontSize = parseInt(10 * size);
 arrowg2.style.fontSize = parseInt(9 * size);
 arrowy2.style.fontSize = parseInt(9 * size);
 netpeakbg.style.fontSize = parseInt(9 * size);
 netpeaknum.style.fontSize = parseInt(9 * size);
 peakstr.style.fontSize = parseInt(9 * size);
 PeakUp.style.fontSize = parseInt(10 * size);
 PeakDown.style.fontSize = parseInt(10 * size);
 cursestr.style.fontSize = parseInt(9 * size);
 UpCurrent.style.fontSize = parseInt(10 * size);
 DownCurrent.style.fontSize = parseInt(10 * size);
 totalstr.style.fontSize = parseInt(9 * size);
 UpTotal.style.fontSize = parseInt(10 * size);
 DownTotal.style.fontSize = parseInt(10 * size);
 profile.style.fontSize = parseInt(9 * size);
 firewall.style.fontSize = parseInt(9 * size);
 advertis.style.fontSize = parseInt(10 * size);
 versionnumber.style.fontSize = parseInt(9 * size);
 autoapdater.style.fontSize = parseInt(9 * size);

 //width section
 showstr.style.width = parseInt(42 * size);
 cflag.style.width = parseInt(122 * size);
 signalpercent.style.width = parseInt(120 * size);
 bartohide.style.width = barsignalmaxwidth;
 netusage.style.width = parseInt(120 * size);
 NoSignal.style.width = "60%"; //!Important
 BarBackUphide.style.width = barmaxwidth;
 BarBackDownhide.style.width = barmaxwidth;
 netpeakbg.style.width = parseInt(45 * size);
 netpeakbg.style.borderWidth = parseInt(1 * size);
 netgraph.style.width = parseInt(120 * size);
 netlinesx.style.width = parseInt(110 * size);
 netlinesy.style.width = parseInt(110 * size);
 downgraph.strokeweight = graphlinewidth;
 upgraph.strokeweight = graphlinewidth;
 netborder.style.width = parseInt(110 * size);
 downgraph.style.width = parseInt(110 * size);
 upgraph.style.width = parseInt(110 * size);
 reinitialize.style.width = parseInt(102 * size);
 versionnumber.style.width = parseInt(122 * size);

 //height section
 bartohide.style.height = parseInt(6 * size);
 ImgBarSignal.style.height = parseInt(6 * size);
 BarBackUphide.style.height = parseInt(6 * size);
 ImgBarUp.style.height = parseInt(6 * size);
 BarBackDownhide.style.height = parseInt(6 * size);
 ImgBarDown.style.height = parseInt(6 * size);
 netgraph.style.height = parseInt(36 * size);
 netlinesx.style.height = parseInt(30 * size);
 netlinesy.style.height = parseInt(30 * size);
 netborder.style.height = parseInt(30 * size);
 downgraph.style.height = parseInt(30 * size);
 upgraph.style.height = parseInt(30 * size);
 netpeakbg.style.height = parseInt(13 * size);

 //picture section
 netimg.style.width = parseInt(13 * size);
 netimg.style.height = parseInt(13 * size);
 refrimg.style.width = parseInt(16 * size);
 refrimg.style.height = parseInt(16 * size);
 arrowup1.style.width = parseInt(16 * size);
 arrowdown1.style.height = parseInt(16 * size);
 arrowup2.style.width = parseInt(16 * size);
 arrowdown2.style.height = parseInt(16 * size);
 arrowup3.style.width = parseInt(16 * size);
 arrowdown3.style.height = parseInt(16 * size);
 arrowup4.style.width = parseInt(16 * size);
 arrowdown4.style.height = parseInt(16 * size);
 arrowup5.style.width = parseInt(16 * size);
 arrowdown5.style.height = parseInt(16 * size);
 // IMPORTANT!!!
 switch (cfservernum){
  case 1:
   country.style.width = parseInt(18 * size);
   country.style.height = parseInt(12 * size);
   break;

  case 2:
   country.style.width = parseInt(16 * size);
   country.style.height = parseInt(11 * size);
   break;

  case 3:
   country.style.width = parseInt(16 * size);
   country.style.height = parseInt(11 * size);
   break;

  case 4:
   country.style.width = parseInt(16 * size);
   country.style.height = parseInt(11 * size);
   break;
 }

 hideunhidegraphs();
 
 var k;

 if (hidetitleflag){
  //title
  gtitle.style.visibility = "hidden";
  gline.style.visibility = "hidden";
  if (RealNetType != 0){
   k=SignalSetIDstr.style.top;
   SignalSetIDstr.style.top = parseInt(k)-parseInt(20 * size);
   k=SignalSetID.style.top;
   SignalSetID.style.top = parseInt(k)-parseInt(20 * size);
   k=connectstr.style.top;
   connectstr.style.top = parseInt(k)-parseInt(20 * size);
   k=secureID.style.top;
   secureID.style.top = parseInt(k)-parseInt(20 * size);
   k=signalstr.style.top;
   signalstr.style.top = parseInt(k)-parseInt(20 * size);
   k=signalpercent.style.top;
   signalpercent.style.top = parseInt(k)-parseInt(20 * size);
   k=NoSignal.style.top;
   NoSignal.style.top = parseInt(k)-parseInt(20 * size);
   k=BarBackSignal.style.top;
   BarBackSignal.style.top = parseInt(k)-parseInt(20 * size);
   k=BarSignal.style.top;
   BarSignal.style.top = parseInt(k)-parseInt(20 * size);
  }
  k=intstr.style.top;
  intstr.style.top = parseInt(k)-parseInt(20 * size);
  k=intIP.style.top;
  intIP.style.top = parseInt(k)-parseInt(20 * size);
  k=dgstr.style.top;
  dgstr.style.top = parseInt(k)-parseInt(20 * size);
  k=defGW.style.top;
  defGW.style.top = parseInt(k)-parseInt(20 * size);
  k=showstr.style.top;
  showstr.style.top = parseInt(k)-parseInt(20 * size);
  k=extstr.style.top;
  extstr.style.top = parseInt(k)-parseInt(20 * size);
  k=extIP.style.top;      
  extIP.style.top = parseInt(k)-parseInt(20 * size);
  k=cflag.style.top;
  cflag.style.top = parseInt(k)-parseInt(20 * size);
  k=refrstr.style.top;
  refrstr.style.top = parseInt(k)-parseInt(20 * size);
  k=goflyout.style.top;
  goflyout.style.top = parseInt(k)-parseInt(20 * size);
  k=copystr.style.top;
  copystr.style.top = parseInt(k)-parseInt(20 * size);
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(20 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(20 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(20 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(20 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(20 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(20 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(20 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(20 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(20 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(20 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(20 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(20 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(20 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(20 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(20 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(20 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(20 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(20 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(20 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(20 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(20 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(20 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(20 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(20 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(20 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(20 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(20 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(20 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(20 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(20 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(20 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(20 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(20 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(20 * size);

  factheight -= 20;
 }

 if (hideidflag && (RealNetType != 0)){
  //SSID
  SignalSetIDstr.style.visibility = "hidden";
  SignalSetID.style.visibility = "hidden";

  k=intstr.style.top;
  intstr.style.top = parseInt(k)-parseInt(12 * size);
  k=intIP.style.top;
  intIP.style.top = parseInt(k)-parseInt(12 * size);
  k=dgstr.style.top;
  dgstr.style.top = parseInt(k)-parseInt(12 * size);
  k=defGW.style.top;
  defGW.style.top = parseInt(k)-parseInt(12 * size);
  k=showstr.style.top;
  showstr.style.top = parseInt(k)-parseInt(12 * size);
  k=extstr.style.top;
  extstr.style.top = parseInt(k)-parseInt(12 * size);
  k=extIP.style.top;      
  extIP.style.top = parseInt(k)-parseInt(12 * size);
  k=cflag.style.top;
  cflag.style.top = parseInt(k)-parseInt(12 * size);
  k=refrstr.style.top;
  refrstr.style.top = parseInt(k)-parseInt(12 * size);
  k=goflyout.style.top;
  goflyout.style.top = parseInt(k)-parseInt(12 * size);
  k=copystr.style.top;
  copystr.style.top = parseInt(k)-parseInt(12 * size);
  k=connectstr.style.top;
  connectstr.style.top = parseInt(k)-parseInt(12 * size);
  k=secureID.style.top;
  secureID.style.top = parseInt(k)-parseInt(12 * size);
  k=signalstr.style.top;
  signalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=signalpercent.style.top;
  signalpercent.style.top = parseInt(k)-parseInt(12 * size);
  k=NoSignal.style.top;
  NoSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackSignal.style.top;
  BarBackSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=BarSignal.style.top;
  BarSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hideintipflag){
  //Int.IP / Def GW
  intstr.style.visibility = "hidden";
  intIP.style.visibility = "hidden";
  dgstr.style.visibility = "hidden";
  defGW.style.visibility = "hidden";
  showstr.style.visibility = "hidden";

  if (RealNetType != 0){
   k=connectstr.style.top;
   connectstr.style.top = parseInt(k)-parseInt(12 * size);
   k=secureID.style.top;
   secureID.style.top = parseInt(k)-parseInt(12 * size);
   k=signalstr.style.top;
   signalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=signalpercent.style.top;
   signalpercent.style.top = parseInt(k)-parseInt(12 * size);
   k=NoSignal.style.top;
   NoSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackSignal.style.top;
   BarBackSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarSignal.style.top;
   BarSignal.style.top = parseInt(k)-parseInt(12 * size);
  }
  k=extstr.style.top;
  extstr.style.top = parseInt(k)-parseInt(12 * size);
  k=extIP.style.top;      
  extIP.style.top = parseInt(k)-parseInt(12 * size);
  k=cflag.style.top;
  cflag.style.top = parseInt(k)-parseInt(12 * size);
  k=refrstr.style.top;
  refrstr.style.top = parseInt(k)-parseInt(12 * size);
  k=goflyout.style.top;
  goflyout.style.top = parseInt(k)-parseInt(12 * size);
  k=copystr.style.top;
  copystr.style.top = parseInt(k)-parseInt(12 * size);
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hideextipflag){
  //Ext.IP
  extstr.style.visibility = "hidden";
  extIP.style.visibility = "hidden";
  country.style.visibility = "hidden";

  if (RealNetType != 0){
   k=connectstr.style.top;
   connectstr.style.top = parseInt(k)-parseInt(12 * size);
   k=secureID.style.top;
   secureID.style.top = parseInt(k)-parseInt(12 * size);
   k=signalstr.style.top;
   signalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=signalpercent.style.top;
   signalpercent.style.top = parseInt(k)-parseInt(12 * size);
   k=NoSignal.style.top;
   NoSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackSignal.style.top;
   BarBackSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarSignal.style.top;
   BarSignal.style.top = parseInt(k)-parseInt(12 * size);
  }
  k=refrstr.style.top;
  refrstr.style.top = parseInt(k)-parseInt(12 * size);
  k=goflyout.style.top;
  goflyout.style.top = parseInt(k)-parseInt(12 * size);
  k=copystr.style.top;
  copystr.style.top = parseInt(k)-parseInt(12 * size);
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }
 else
  if (firstshowflag) country.style.visibility = "visible";
  else country.style.visibility = "hidden";

 firstshowflag = true; //important

 if (hideservflag){
  //Service strings
  refrstr.style.visibility = "hidden";
  goflyout.style.visibility = "hidden";
  copystr.style.visibility = "hidden";

  if (RealNetType != 0){
   k=connectstr.style.top;
   connectstr.style.top = parseInt(k)-parseInt(12 * size);
   k=secureID.style.top;
   secureID.style.top = parseInt(k)-parseInt(12 * size);
   k=signalstr.style.top;
   signalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=signalpercent.style.top;
   signalpercent.style.top = parseInt(k)-parseInt(12 * size);
   k=NoSignal.style.top;
   NoSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackSignal.style.top;
   BarBackSignal.style.top = parseInt(k)-parseInt(12 * size);
   k=BarSignal.style.top;
   BarSignal.style.top = parseInt(k)-parseInt(12 * size);
  }
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hideconnectflag && (RealNetType != 0)){
  //connect
  connectstr.style.visibility = "hidden";
  secureID.style.visibility = "hidden";

  k=signalstr.style.top;
  signalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=signalpercent.style.top;
  signalpercent.style.top = parseInt(k)-parseInt(12 * size);
  k=NoSignal.style.top;
  NoSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackSignal.style.top;
  BarBackSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=BarSignal.style.top;
  BarSignal.style.top = parseInt(k)-parseInt(12 * size);
  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hidesignalflag && (RealNetType != 0)){
  //signal
  signalstr.style.visibility = "hidden";
  signalpercent.style.visibility = "hidden";
  NoSignal.style.visibility = "hidden";
  BarBackSignal.style.visibility = "hidden";
  BarSignal.style.visibility = "hidden";

  k=netusestr.style.top;
  netusestr.style.top = parseInt(k)-parseInt(12 * size);
  k=netimg.style.top;
  netimg.style.top = parseInt(k)-parseInt(12 * size);
  k=netusage.style.top;
  netusage.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }
 
 if (hidenetusageflag){
  //Net Usage
  netusestr.style.visibility = "hidden";
  netimg.style.visibility = "hidden";
  netusage.style.visibility = "hidden";

  k=arrowg1.style.top;
  arrowg1.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy1.style.top;
  arrowy1.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBitesPerSec.style.top;
  UpBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBitesPerSec.style.top;
  DownBitesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=UpBytesPerSec.style.top;
  UpBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=DownBytesPerSec.style.top;
  DownBytesPerSec.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(12 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(12 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(12 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(12 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(12 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(12 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(12 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(12 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(12 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(12 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hideupdownspeedflag){
  //net speed numbers
  arrowg1.style.visibility = "hidden";
  arrowy1.style.visibility = "hidden";
  UpBitesPerSec.style.visibility = "hidden";
  DownBitesPerSec.style.visibility = "hidden";
  UpBytesPerSec.style.visibility = "hidden";
  DownBytesPerSec.style.visibility = "hidden";

  k=arrowg2.style.top;
  arrowg2.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy2.style.top;
  arrowy2.style.top = parseInt(k)-parseInt(24 * size);
  k=BarBackUp.style.top;
  BarBackUp.style.top = parseInt(k)-parseInt(24 * size);
  k=BarUpGr.style.top;
  BarUpGr.style.top = parseInt(k)-parseInt(24 * size);
  k=BarBackDown.style.top;
  BarBackDown.style.top = parseInt(k)-parseInt(24 * size);
  k=BarDownGr.style.top;
  BarDownGr.style.top = parseInt(k)-parseInt(24 * size);
  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(24 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(24 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(24 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(24 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(24 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(24 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(24 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(24 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(24 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(24 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(24 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(24 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(24 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(24 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(24 * size);

  factheight -= 24;
 }
 else
 {
  if (hidebitpersecflag){
   //bps
   UpBitesPerSec.style.visibility = "hidden";
   DownBitesPerSec.style.visibility = "hidden";

   arrowy1.style.top = arrowg1.style.top;
   arrowy1.style.left = parseInt(62 * size);
   UpBytesPerSec.style.left = UpBitesPerSec.style.left;
   DownBytesPerSec.style.top = UpBytesPerSec.style.top;
   DownBytesPerSec.style.left = parseInt(78 * size);

   k=arrowg2.style.top;
   arrowg2.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy2.style.top;
   arrowy2.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackUp.style.top;
   BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
   k=BarUpGr.style.top;
   BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackDown.style.top;
   BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
   k=BarDownGr.style.top;
   BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
   k=netgraph.style.top;
   netgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=netpeakbg.style.top;
   netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
   k=netpeaknum.style.top;
   netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
   k=netlinesx.style.top;
   netlinesx.style.top = parseInt(k)-parseInt(12 * size);
   k=netlinesy.style.top;
   netlinesy.style.top = parseInt(k)-parseInt(12 * size);
   k=downgraph.style.top;
   downgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=upgraph.style.top;
   upgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=netborder.style.top;
   netborder.style.top = parseInt(k)-parseInt(12 * size);
   k=peakstr.style.top;
   peakstr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg3.style.top;
   arrowg3.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy3.style.top;
   arrowy3.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakUp.style.top;
   PeakUp.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakDown.style.top;
   PeakDown.style.top = parseInt(k)-parseInt(12 * size);
   k=cursestr.style.top;
   cursestr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg4.style.top;
   arrowg4.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy4.style.top;
   arrowy4.style.top = parseInt(k)-parseInt(12 * size);
   k=UpCurrent.style.top;
   UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=DownCurrent.style.top;
   DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=totalstr.style.top;
   totalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg5.style.top;
   arrowg5.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy5.style.top;
   arrowy5.style.top = parseInt(k)-parseInt(12 * size);
   k=UpTotal.style.top;
   UpTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=DownTotal.style.top;
   DownTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=profile.style.top;
   profile.style.top = parseInt(k)-parseInt(12 * size);
   k=firewall.style.top;
   firewall.style.top = parseInt(k)-parseInt(12 * size);
   k=reinitialize.style.top;
   reinitialize.style.top = parseInt(k)-parseInt(12 * size);
   k=advertis.style.top;
   advertis.style.top = parseInt(k)-parseInt(12 * size);
   k=versionnumber.style.top;
   versionnumber.style.top = parseInt(k)-parseInt(12 * size);

   factheight -= 12;
  }

  if (hidebytepersecflag){
   //B/s
   UpBytesPerSec.style.visibility = "hidden";
   DownBytesPerSec.style.visibility = "hidden";

   arrowy1.style.top = arrowg1.style.top;
   arrowy1.style.left = parseInt(62 * size);
   DownBitesPerSec.style.left = parseInt(78 * size);
   DownBitesPerSec.style.top = UpBytesPerSec.style.top;

   k=arrowg2.style.top;
   arrowg2.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy2.style.top;
   arrowy2.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackUp.style.top;
   BarBackUp.style.top = parseInt(k)-parseInt(12 * size);
   k=BarUpGr.style.top;
   BarUpGr.style.top = parseInt(k)-parseInt(12 * size);
   k=BarBackDown.style.top;
   BarBackDown.style.top = parseInt(k)-parseInt(12 * size);
   k=BarDownGr.style.top;
   BarDownGr.style.top = parseInt(k)-parseInt(12 * size);
   k=netgraph.style.top;
   netgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=netpeakbg.style.top;
   netpeakbg.style.top = parseInt(k)-parseInt(12 * size);
   k=netpeaknum.style.top;
   netpeaknum.style.top = parseInt(k)-parseInt(12 * size);
   k=netlinesx.style.top;
   netlinesx.style.top = parseInt(k)-parseInt(12 * size);
   k=netlinesy.style.top;
   netlinesy.style.top = parseInt(k)-parseInt(12 * size);
   k=downgraph.style.top;
   downgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=upgraph.style.top;
   upgraph.style.top = parseInt(k)-parseInt(12 * size);
   k=netborder.style.top;
   netborder.style.top = parseInt(k)-parseInt(12 * size);
   k=peakstr.style.top;
   peakstr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg3.style.top;
   arrowg3.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy3.style.top;
   arrowy3.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakUp.style.top;
   PeakUp.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakDown.style.top;
   PeakDown.style.top = parseInt(k)-parseInt(12 * size);
   k=cursestr.style.top;
   cursestr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg4.style.top;
   arrowg4.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy4.style.top;
   arrowy4.style.top = parseInt(k)-parseInt(12 * size);
   k=UpCurrent.style.top;
   UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=DownCurrent.style.top;
   DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=totalstr.style.top;
   totalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg5.style.top;
   arrowg5.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy5.style.top;
   arrowy5.style.top = parseInt(k)-parseInt(12 * size);
   k=UpTotal.style.top;
   UpTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=DownTotal.style.top;
   DownTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=profile.style.top;
   profile.style.top = parseInt(k)-parseInt(12 * size);
   k=firewall.style.top;
   firewall.style.top = parseInt(k)-parseInt(12 * size);
   k=reinitialize.style.top;
   reinitialize.style.top = parseInt(k)-parseInt(12 * size);
   k=advertis.style.top;
   advertis.style.top = parseInt(k)-parseInt(12 * size);
   k=versionnumber.style.top;
   versionnumber.style.top = parseInt(k)-parseInt(12 * size);

   factheight -= 12;
  }
 }// else

 if (hidebarsflag){
  //bars
  arrowg2.style.visibility = "hidden";
  arrowy2.style.visibility = "hidden";
  BarBackUp.style.visibility = "hidden";
  BarUpGr.style.visibility = "hidden";
  BarBackDown.style.visibility = "hidden";
  BarDownGr.style.visibility = "hidden";

  k=netgraph.style.top;
  netgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=netpeakbg.style.top;
  netpeakbg.style.top = parseInt(k)-parseInt(24 * size);
  k=netpeaknum.style.top;
  netpeaknum.style.top = parseInt(k)-parseInt(24 * size);
  k=netlinesx.style.top;
  netlinesx.style.top = parseInt(k)-parseInt(24 * size);
  k=netlinesy.style.top;
  netlinesy.style.top = parseInt(k)-parseInt(24 * size);
  k=downgraph.style.top;
  downgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=upgraph.style.top;
  upgraph.style.top = parseInt(k)-parseInt(24 * size);
  k=netborder.style.top;
  netborder.style.top = parseInt(k)-parseInt(24 * size);
  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(24 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(24 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(24 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(24 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(24 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(24 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(24 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(24 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(24 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(24 * size);

  factheight -= 24;
 }

 if (hideallgraphicsflag){
  //all graphics
  netgraph.style.visibility = "hidden";
  netpeakbg.style.visibility = "hidden";
  netpeaknum.style.visibility = "hidden";
  netlinesx.style.visibility = "hidden";
  netlinesy.style.visibility = "hidden";
  downgraph.style.visibility = "hidden";
  upgraph.style.visibility = "hidden";
  netborder.style.visibility = "hidden";

  k=peakstr.style.top;
  peakstr.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowg3.style.top;
  arrowg3.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowy3.style.top;
  arrowy3.style.top = parseInt(k)-parseInt(36 * size);
  k=PeakUp.style.top;
  PeakUp.style.top = parseInt(k)-parseInt(36 * size);
  k=PeakDown.style.top;
  PeakDown.style.top = parseInt(k)-parseInt(36 * size);
  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(36 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(36 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(36 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(36 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(36 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(36 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(36 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(36 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(36 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(36 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(36 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(36 * size);

  factheight -= 36;
 }

 if (hidepeakflag){
  //peak
  peakstr.style.visibility = "hidden";
  arrowg3.style.visibility = "hidden";
  arrowy3.style.visibility = "hidden";
  PeakUp.style.visibility = "hidden";
  PeakDown.style.visibility = "hidden";

  k=cursestr.style.top;
  cursestr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg4.style.top;
  arrowg4.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy4.style.top;
  arrowy4.style.top = parseInt(k)-parseInt(24 * size);
  k=UpCurrent.style.top;
  UpCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=DownCurrent.style.top;
  DownCurrent.style.top = parseInt(k)-parseInt(24 * size);
  k=totalstr.style.top;
  totalstr.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowg5.style.top;
  arrowg5.style.top = parseInt(k)-parseInt(24 * size);
  k=arrowy5.style.top;
  arrowy5.style.top = parseInt(k)-parseInt(24 * size);
  k=UpTotal.style.top;
  UpTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=DownTotal.style.top;
  DownTotal.style.top = parseInt(k)-parseInt(24 * size);
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(24 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(24 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(24 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(24 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(24 * size);

  factheight -= 24;
 }
 else{
  if (hidepeakstrflag){
   //peak string
   peakstr.style.visibility = "hidden";

   k=arrowg3.style.top;
   arrowg3.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy3.style.top;
   arrowy3.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakUp.style.top;
   PeakUp.style.top = parseInt(k)-parseInt(12 * size);
   k=PeakDown.style.top;
   PeakDown.style.top = parseInt(k)-parseInt(12 * size)
   k=cursestr.style.top;
   cursestr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg4.style.top;
   arrowg4.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy4.style.top;
   arrowy4.style.top = parseInt(k)-parseInt(12 * size);
   k=UpCurrent.style.top;
   UpCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=DownCurrent.style.top;
   DownCurrent.style.top = parseInt(k)-parseInt(12 * size);
   k=totalstr.style.top;
   totalstr.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowg5.style.top;
   arrowg5.style.top = parseInt(k)-parseInt(12 * size);
   k=arrowy5.style.top;
   arrowy5.style.top = parseInt(k)-parseInt(12 * size);
   k=UpTotal.style.top;
   UpTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=DownTotal.style.top;
   DownTotal.style.top = parseInt(k)-parseInt(12 * size);
   k=profile.style.top;
   profile.style.top = parseInt(k)-parseInt(12 * size);
   k=firewall.style.top;
   firewall.style.top = parseInt(k)-parseInt(12 * size);
   k=reinitialize.style.top;
   reinitialize.style.top = parseInt(k)-parseInt(12 * size);
   k=advertis.style.top;
   advertis.style.top = parseInt(k)-parseInt(12 * size);
   k=versionnumber.style.top;
   versionnumber.style.top = parseInt(k)-parseInt(12 * size);

   factheight -= 12;
  }
 }

 if (hidecurrentflag){
  // current only
  cursestr.style.visibility = "hidden";
  arrowg4.style.visibility = "hidden";
  arrowy4.style.visibility = "hidden";
  UpCurrent.style.visibility = "hidden";
  DownCurrent.style.visibility = "hidden";

  totalstr.style.left = parseInt(8 * size);
  arrowg5.style.left = parseInt(4 * size);
  UpTotal.style.left = parseInt(19 * size);
  arrowy5.style.top = arrowg5.style.top;
  arrowy5.style.left = parseInt(64 * size);
  DownTotal.style.top = UpTotal.style.top;
  DownTotal.style.left = parseInt(79 * size);

  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hidetotalflag){
  //total only
  totalstr.style.visibility = "hidden";
  arrowg5.style.visibility = "hidden";
  arrowy5.style.visibility = "hidden";
  UpTotal.style.visibility = "hidden";
  DownTotal.style.visibility = "hidden";

  arrowy4.style.top = arrowg5.style.top;
  arrowy4.style.left = parseInt(64 * size);
  DownCurrent.style.top = UpTotal.style.top;
  DownCurrent.style.left = parseInt(79 * size);

  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hidecurrentflag && hidetotalflag){
  //both current and total
  k=profile.style.top;
  profile.style.top = parseInt(k)-parseInt(12 * size);
  k=firewall.style.top;
  firewall.style.top = parseInt(k)-parseInt(12 * size);
  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hideprofileflag){
  //profile
  profile.style.visibility = "hidden";
  firewall.style.visibility = "hidden";

  k=reinitialize.style.top;
  reinitialize.style.top = parseInt(k)-parseInt(12 * size);
  k=advertis.style.top;
  advertis.style.top = parseInt(k)-parseInt(12 * size);
  k=versionnumber.style.top;
  versionnumber.style.top = parseInt(k)-parseInt(12 * size);

  factheight -= 12;
 }

 if (hidecopyrightflag){
  //copyright
  reinitialize.style.visibility = "hidden";
  advertis.style.visibility = "hidden";
  versionnumber.style.visibility = "hidden";

  factheight -= 12;
 }

 if (hidegridlinesflag){
  netlinesx.style.visibility = "hidden";
  netlinesy.style.visibility = "hidden";
 }

 //set place for download graph
 downgraph.style.zIndex = downloadfirstflag ? 1 : 0;

 //background section
 document.body.style.height = parseInt(factheight * size);
 background.style.height = parseInt(factheight * size);
 document.body.style.width = parseInt(130 * size);
 background.style.width = parseInt(130 * size);
 mainsquare.style.top = parseInt(5 * size); 
 mainsquare.style.left = parseInt(5 * size);  
 mainsquare.style.width =  parseInt((130 - 10) * size);
 mainsquare.style.height = parseInt((factheight - 10) * size);
 mainsquare.style.background = cBgColor;
}//end function

function calccurrenttotal(){
 curenttotal.title = mainlng[lngID][54] + formatBytes5(bytesSentCurrent + bytesReceivedCurrent) + mainlng[lngID][45];
}

function calctotaltotal(){
 totaltotal.title = mainlng[lngID][55] + formatBytes5(bytesSentTotal + bytesReceivedTotal) + mainlng[lngID][45];
}

function runNetworkAndSharingCenter(){
 System.Shell.execute("control", "/name Microsoft.NetworkAndSharingCenter");
}

function showFlyout(){
 if (!System.Gadget.Flyout.show){
  System.Gadget.Flyout.show = true;
  if (!disableflyoutsoundsflag) System.Sound.playSound("media/service.wav");
 }
 else  System.Gadget.Flyout.show = false;
}

function WirelessDisconnected(){
 if (autopicknetflag) changeconnectiontype();
}

function WirelessConnected(){
 if (autopicknetflag) {if (System.Network.Wireless.signalStrength) changeconnectiontype()}
}

function changeconnectiontype(){
 RealNetType = System.Gadget.Settings.read("RealNetworkType");
 if (RealNetType == "0"){
  RealNetType = "1";
  System.Gadget.Settings.write("Int_Nr", System.Gadget.Settings.read("WirelessNet"));
  System.Gadget.Settings.write("Int_Nr2", System.Gadget.Settings.read("WirelessNet2"));
  System.Gadget.Settings.write("Int_Nr3", System.Gadget.Settings.read("WirelessNet2"));
 }
 else{
  RealNetType = "0";
  System.Gadget.Settings.write("Int_Nr", System.Gadget.Settings.read("WiredNet"));
  System.Gadget.Settings.write("Int_Nr2", System.Gadget.Settings.read("WiredNet2"));
  System.Gadget.Settings.write("Int_Nr3", System.Gadget.Settings.read("WiredNet2"));
 }
 System.Gadget.Settings.write("RealNetworkType", RealNetType);
 connectiontypechanged = true;
 settingsClose();
}