Jump to content

_IEAction click partially working


Go to solution Solved by Scriptonize,

Recommended Posts

Hi everybody,

The last week I've been trying to find out what's going wrong with my script.

I'm trying to automate the setup of an IP based phone.

The interface is web based.

I'm able to change the settings on several pages.

However, when I use the script to click the "SET" button on each page (for saving my settings), some settings are saved, and some settings are reverted to it's original state.

I've tried several methods without success.

What puzzels me is that some settings are indeed saved, so the click event (and its javascript) is triggered.

My script:

Func _ApplySettings()


    Local $hBtn
    Local $hDrpDwnBox
    Local $hInputBox
    Local $iShortDelay = 1000
    Global $bDbgMode = 1


        ;----------------------------------------------------------------------------------------------------------------------------
        ;Button: Show advanced settings
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Button: Show advanced settings" & @CR)
        $hBtn = _IEGetObjByClass($oIE,"buttonLink215")
        _IEAction($hBtn,"click")
        Sleep($iShortDelay)


        ;----------------------------------------------------------------------------------------------------------------------------
        ;Dropdown box: IP address type
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Dropdown box: IP address type" & @CR)
        $hDrpDwnBox = _IEGetObjById($oIE,"ip_address_type")
        _IEFormElementSetValue($hDrpDwnBox,1,1) ;1 = Obtained automatically
        $hDrpDwnBox.fireEvent("onchange")
        $hDrpDwnBox.fireEvent("onclick")
        Sleep($iShortDelay)


        ;----------------------------------------------------------------------------------------------------------------------------
        ;Radio button: Allow access from other networks (set this option to 'Yes')
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Radio button: Allow access from other networks" & @CR)
        $hBtn = _IEGetObjByName($oIE,"foreign_sub",0)                       ;Select second radio button (Yes Option)
        _RadioToggle($hBtn,True)
        Sleep($iShortDelay)


        ;----------------------------------------------------------------------------------------------------------------------------
        ;Radio button: HTTTP proxy: Enable proxy (set this option to 'No')
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Radio button: Enable proxy" & @CR)
        $hBtn = _IEGetObjByName($oIE,"http_proxy_enable",1)                 ;Select second radio button (No Option)
        _RadioToggle($hBtn,True)
        Sleep($iShortDelay)


        ;----------------------------------------------------------------------------------------------------------------------------
        ;Radio button: Use VLAN Tagging (set this option to 'No')
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Radio button: Use VLAN Tagging" & @CR)
        $hBtn = _IEGetObjByName($oIE,"vlan_enable",1)                       ;Select second radio button (No Option)
        _RadioToggle($hBtn,True)
        Sleep($iShortDelay)



        ;----------------------------------------------------------------------------------------------------------------------------
        ;ButtonLink100 (Set button)
        ;----------------------------------------------------------------------------------------------------------------------------
        If $bDbgMode = 1 Then ConsoleWrite("Set button click" & @CR)
        $hBtn = _IEGetObjByClass($oIE,"buttonLink100",0)
        _IEAction($hBtn,"focus")
        ;$hBtn.fireEvent("onclick")
        _IEAction($hBtn,"click")
        Sleep($iShortDelay)




EndFunc ; <== _ApplySettings()


Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)

    Local $i_found = 0
    _IEErrorNotify(True)

    If Not IsObj($o_object) Then
        If $bDbgMode > 0 Then ConsoleWrite("Invalid data type: No object type" & @CR)
        SetError($_IEStatus_InvalidDataType, 1)
        Return -1
    EndIf

    If Not __IEIsObjType($o_object, "browserdom") Then
        If $bDbgMode > 0 Then ConsoleWrite("Invalid type: No Dom object" & @CR)
        SetError($_IEStatus_InvalidObjectType, 1)
        Return -1
    EndIf

    $o_tags = _IETagNameAllGetCollection($o_object)

    For $o_tag In $o_tags

        If String($o_tag.className) = $s_Class Then

            If ($i_found = $i_index) Then
                SetError($_IEStatus_Success)
                If $bDbgMode = 1 Then ConsoleWrite("$i_found: " & $i_found & @CR)
                Return $o_tag
            Else
                $i_found += 1
            EndIf

        EndIf

    Next

    SetError($_IEStatus_NoMatch, 2)
    Return -1

EndFunc ; <== _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)



Func _RadioToggle(ByRef $o_Radio,$bSelected = True)

    If Not IsObj($o_Radio) Then
        Return SetError(1,0,0)
    EndIf

    If $bSelected Then
        If Not $o_Radio.checked Then
            $o_Radio.checked = "checked"
            $o_Radio.value = "1"
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 1
        EndIf
    Else
        If  $o_Radio.checked Then
            $o_Radio.value = "0"
            $o_Radio.checked = ""
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 0
        EndIf
    EndIf

EndFunc

And here is theĀ  HTML source:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>N300A IP</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Script-Type" content="text/javascript">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <!-- external scripts for common tasks -->
  <script language="JavaScript" type="text/javascript">
  <!--
  /* file global.js */
var labeling = 0;



if (document.images)
{
  var pic1 = new Image; 
  
  
  pic1.src = "../images/bg_button_100_pressed.gif"; 
  
  var pic2 = new Image; 
  
  
  pic2.src = "../images/bg_button_215_pressed.gif";
  
}

  /* file tools.js */
var browserDetect = navigator.userAgent.toLowerCase();
var browserDetectOS,browserDetectBrowser,browserDetectVersion,browserDetectTotal,browserDetectString;
if (checkIt('konqueror'))
{
  browserDetectBrowser = "Konqueror";
  browserDetectOS = "Linux";
}
else if (checkIt('firefox')) browserDetectBrowser = "Firefox"
else if (checkIt('safari')) browserDetectBrowser = "Safari"
else if (checkIt('omniweb')) browserDetectBrowser = "OmniWeb"
else if (checkIt('opera')) browserDetectBrowser = "Opera"
else if (checkIt('webtv')) browserDetectBrowser = "WebTV";
else if (checkIt('icab')) browserDetectBrowser = "iCab"
else if (checkIt('msie')) browserDetectBrowser = "Internet Explorer"
else if (!checkIt('compatible'))
{
  browserDetectBrowser = "Netscape Navigator"
  browserDetectVersion = browserDetect.charAt(8);
}
else browserDetectBrowser = "An unknown browser";
if (!browserDetectVersion) browserDetectVersion = browserDetect.charAt(broswerPlace + browserDetectString.length);
if (!browserDetectOS)
{
  if (checkIt('linux')) browserDetectOS = "Linux";
  else if (checkIt('x11')) browserDetectOS = "Unix";
  else if (checkIt('mac')) browserDetectOS = "Mac"
  else if (checkIt('win')) browserDetectOS = "Windows"
  else browserDetectOS = "an unknown operating system";
}

function checkIt(string)
{
  broswerPlace = browserDetect.indexOf(string) + 1;
  browserDetectString = string;
  return broswerPlace;
}

function instr(haystack, needle)
{
  if (haystack.lastIndexOf(needle) == -1) {
    return false;
  }
  return true;
}

function getKey(eventObj)
{
  if (!eventObj) var eventObj = window.event;
  return document.all?eventObj.keyCode:eventObj.which;
}

function getUTF8Bytes(unicode)
{
  if (unicode < 0x00000080)
  {
    return 1;
  }
  else if (unicode < 0x00000800)
  {
    return 2;
  }
  else if (unicode < 0x00010000)
  {
    return 3;
  }
  return 4;
}

function countUTF8Bytes(unicode)
{
  utf8bytescount = 0;
  for (i = 0; i < unicode.length; i++)
  {
    utf8bytescount += getUTF8Bytes(unicode.charCodeAt(i));
  }
  return utf8bytescount;
}

function checkUTF8Bytes(formfield, eventObj, maxlen)
{
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  if ((keyCode == 0) || (keyCode == 8)) return true;
  return ((countUTF8Bytes(formfield.value + String.fromCharCode(getKey(eventObj))) - countUTF8Bytes(getSelected(formfield))) <= maxlen);
}

function getG0G1Bytes(unicode)
{
  // check for euro sign
  if (unicode == 0x20AC)
  {
    return 3;
  }
  return 1;
}

function countG0G1Bytes(unicode)
{
  g0g1bytescount = 0;
  for (i = 0; i < unicode.length; i++)
  {
    g0g1bytescount += getG0G1Bytes(unicode.charCodeAt(i));
  }
  return g0g1bytescount;
}

function checkG0G1Bytes(formfield, eventObj, maxlen)
{
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  if ((keyCode == 0) || (keyCode == 8)) return true;
  return ((countG0G1Bytes(formfield.value + String.fromCharCode(getKey(eventObj))) - countG0G1Bytes(getSelected(formfield))) <= maxlen);
}

function isValidG0G1Char(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = getEventCharacter(eventObj);
  unicode = keyChar.charCodeAt(0);
  // Allow only numbers, *, #, R, r, P, p, tab, backspace and enter
  if (
       ("\b\r".indexOf(keyChar) != -1)
       ||
       ((unicode >= 0x20) && (unicode <= 0xFF))
       ||
       (unicode == 0x20AC)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function getSelected()
{
  var sel = "";
  var formfield = null;
  
  if (arguments.length > 1)
  {
    return "";
  }

  if (arguments.length == 1)
  {
    formfield = arguments[0];
  }
  
  if (window.getSelection)
  {
    sel = window.getSelection();
  } else if (document.getSelection)
    {
      sel = document.getSelection();
    } else if (document.selection)
      {
        sel = document.selection.createRange().text;
      }

  if ((sel == "") && (formfield))
  {
    if (formfield.selectionStart != formfield.selectionEnd)
    {
      sel = formfield.value.substring(formfield.selectionStart, formfield.selectionEnd);
    }
  }
        
  return sel;
}

function getEventCharacter(e)
{
  var code;
  if (!e) var e = window.event;
  if (e.keyCode) code = e.keyCode;
  else if (e.which) code = e.which;
  return String.fromCharCode(code);
}

function checkForPaste(e)
{
  if (!e) var e = window.event;
  if (
       (e.ctrlKey)
       &&
       (
         (getEventCharacter(e) == "x")
         ||
         (getEventCharacter(e) == "c")
         ||
         (getEventCharacter(e) == "v")
       )
     )
  {
    return true;
  }
  return false;
}

function isNumber(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  // Allow only numbers, backspace, tab and enter
  if ((keyCode >= "0".charCodeAt(0) && keyCode <= "9".charCodeAt(0)) ||
      (keyCode == 8) ||
      (keyCode == 9) ||
      (keyCode == 0))
  {
    return true;
  }
  return false;
}


function checkNumber(txt)
{
  txt = txt.replace(/\D/g, "");
  return txt;
}

function isNegNumber(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  // Allow only numbers, backspace, tab and enter AND '-'
  if ((keyCode >= "0".charCodeAt(0) && keyCode <= "9".charCodeAt(0)) ||
      (keyCode == "-".charCodeAt(0)) ||
      (keyCode == 8) ||
      (keyCode == 9) ||
      (keyCode == 0))
  {
    return true;
  }
  return false;
}

function checkNegNumber(txt)
{
  var negative;
  
  if (txt.charAt(0) == "-")
  {
    negative = true;
  }
  
  txt = checkNumber(txt);
  
  if (negative)
  {
    txt = "-" + txt;
  }
  
  return txt;
}

//LwP, Check for digits only, limit to specific number of such
function isValidPin(formfield, eventObj, maxlen) {
  if (checkForPaste(eventObj))
  {
    return true;
  };
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  // Allow only numbers, backspace, tab and enter
  if (keyCode >= "0".charCodeAt(0) && keyCode <= "9".charCodeAt(0))      
  {
    if(formfield.value.length<maxlen){
      return true;
    };
  };
  if( (keyCode == 8) ||
      (keyCode == 9) ||
      (keyCode == 0)
    )
  {
    if(formfield.value.length<=maxlen){
      return true;
    };
  }
  return false;
};

function isValidDomainChar(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = String.fromCharCode(keyCode);
  // Allow only numbers, chars, -, ., tab and enter
  if (
       ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.\b\r".indexOf(keyChar) != -1)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function isValidSipDomainChar(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = String.fromCharCode(keyCode);
  // Allow only numbers, chars, -, ., tab and enter
  if (
       ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.\b\r".indexOf(keyChar) != -1)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function isValidNetworkNameChar(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = String.fromCharCode(keyCode);
  // Allow only numbers, chars, -, tab and enter
  if (
       ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-\b\r".indexOf(keyChar) != -1)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function isValidDomainCharWithColon(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = String.fromCharCode(keyCode);
  // Allow only numbers, chars, -, ., tab and enter
  //LwP, also check for Colon ( : )
  if (
       ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:-.\b\r".indexOf(keyChar) != -1)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function checkValidDomainChar(txt)
{
  txt = txt.replace(/[^0-9a-zA-Z-.]/g, "");
  return txt;
}

function checkValidSipDomainChar(txt)
{
  txt = txt.replace(/[^0-9a-zA-Z-._]/g, "");
  return txt;
}

function isValidTeleNoChar(eventObj) {
  if (checkForPaste(eventObj))
  {
    return true;
  }
  if (!eventObj) var eventObj = window.event;
  keyCode = getKey(eventObj);
  keyChar = getEventCharacter(eventObj);
  // Allow only numbers, *, #, R, P, tab, backspace and enter
  if (
       ("0123456789*#RP\b\r".indexOf(keyChar) != -1)
       ||
       (keyCode == 0)
     )
  {
    return true;
  }
  return false;
}

function checkValidTeleNoChar(txt)
{
  txt = txt.replace(/[^0-9*#RPrp]/g, "");
  return txt;
}

function intToBin(iInt)
{
  var sBin = "";
  var i = 0;
  
  for (i = 0; i < 8; i++)
  {
    if ((iInt % 2) == 1)
    {
      sBin = "1" + sBin;
    }
    else
    {
      sBin = "0" + sBin;
    }
    iInt = iInt >> 1;
  }
  
  return sBin;
}

function isValidSubnetmask(oSub1, oSub2, oSub3, oSub4)
{
  var sSub;

  if (
       !isIntInRange(oSub1, 128, 255) ||
       !isIntInRange(oSub2, 0, 255) ||
       !isIntInRange(oSub3, 0, 255) ||
       !isIntInRange(oSub4, 0, 254)
     )
  {
    return false;
  }

  sSub = intToBin(parseInt(oSub1.value, 10));
  sSub += intToBin(parseInt(oSub2.value, 10));
  sSub += intToBin(parseInt(oSub3.value, 10));
  sSub += intToBin(parseInt(oSub4.value, 10));

  if (sSub.indexOf("0") < sSub.lastIndexOf("1"))
  {
    return false;
  }
    
  return true;
}

function isValidIP(oIP1, oIP2, oIP3, oIP4, oSub1, oSub2, oSub3, oSub4)
{
  if (
       isIntInRange(oIP1, 127, 127) ||
       !isIntInRange(oIP1, 1, 223) ||
       !isIntInRange(oIP2, 0, 255) ||
       !isIntInRange(oIP3, 0, 255) ||
       !isIntInRange(oIP4, 0, 255)
     )
  {
    return false;
  }
  
  if (!oSub1)
  {
    return true;
  }
  
  var iIP1_1 = parseInt(oIP1.value, 10);
  var iIP1_2 = parseInt(oIP2.value, 10);
  var iIP1_3 = parseInt(oIP3.value, 10);
  var iIP1_4 = parseInt(oIP4.value, 10);
  var iSub1 = parseInt(oSub1.value, 10);
  var iSub2 = parseInt(oSub2.value, 10);
  var iSub3 = parseInt(oSub3.value, 10);
  var iSub4 = parseInt(oSub4.value, 10);
  var iSub = (iSub1 << 24) + (iSub2 << 16) + (iSub3 << 8) + iSub4;
  var iIP1 = (iIP1_1 << 24) + (iIP1_2 << 16) + (iIP1_3 << 8) + iIP1_4;

  iSub = ~iSub;
  if (((iIP1 & iSub) == iSub) || ((iIP1 & iSub) == 0))
  {
    // all host bits are 1 or 0 -> illegal (broadcast // net)
    return false;
  }
  
  return true;
}

function isInSameSubnet(oIP1_1, oIP1_2, oIP1_3, oIP1_4, oIP2_1, oIP2_2, oIP2_3, oIP2_4, oSub1, oSub2, oSub3, oSub4)
{
  var iIP1_1 = parseInt(oIP1_1.value, 10);
  var iIP1_2 = parseInt(oIP1_2.value, 10);
  var iIP1_3 = parseInt(oIP1_3.value, 10);
  var iIP1_4 = parseInt(oIP1_4.value, 10);
  var iIP2_1 = parseInt(oIP2_1.value, 10);
  var iIP2_2 = parseInt(oIP2_2.value, 10);
  var iIP2_3 = parseInt(oIP2_3.value, 10);
  var iIP2_4 = parseInt(oIP2_4.value, 10);
  var iSub1 = parseInt(oSub1.value, 10);
  var iSub2 = parseInt(oSub2.value, 10);
  var iSub3 = parseInt(oSub3.value, 10);
  var iSub4 = parseInt(oSub4.value, 10);

  var iIP1 = (iIP1_1 << 24) + (iIP1_2 << 16) + (iIP1_3 << 8) + iIP1_4;
  var iIP2 = (iIP2_1 << 24) + (iIP2_2 << 16) + (iIP2_3 << 8) + iIP2_4;
  var iSub = (iSub1 << 24) + (iSub2 << 16) + (iSub3 << 8) + iSub4;

  if ((iIP1 & iSub) != (iIP2 & iSub))
  {
    return false;
  }
  
  return true;
}

function isGatewaySameAsDevice(oIP1_1, oIP1_2, oIP1_3, oIP1_4, oIP2_1, oIP2_2, oIP2_3, oIP2_4)
{
  if ((parseInt(oIP1_1.value, 10) == parseInt(oIP2_1.value, 10)) &&
      (parseInt(oIP1_2.value, 10) == parseInt(oIP2_2.value, 10)) &&
      (parseInt(oIP1_3.value, 10) == parseInt(oIP2_3.value, 10)) &&
      (parseInt(oIP1_4.value, 10) == parseInt(oIP2_4.value, 10)))
  {
    return false;
  }
  
  return true;
}

function GetVoIPLineStatus(line) {
  //
  // Disabled
  if (line[3]-0 == 0) 
  {
    return "Disabled";
  }
  //
  //not disabled
  //Runlevel states disabled!
  if(line[4]>=10)
  {
    switch(line[4]){
      case 90: 
      case 60:
      case 50:
        return "Registered";
        break;
      case 40:
      case 30:  
        return "Registration failed";
        break;
      case 20:
      case 15:
      case 10:
      default: 
        return "Registration failed";
        break;
    }
  };
    //in case we are asked about other type of status (like in Saturn)
  switch (line[4])
  {
    case 1:
    case 3: //left for future use
      return 'Registration failed'; // running, aka. Registration Failed
      break;
    case 2:
      return 'Registered'; // registered
      break;
    //case 3:
      //return 'Server not accessible'; // failed, actually this means it's working
    //break;
    default:
      return 'Disabled'; // disabled
      break;
  }
}

function isInt(oInt)
{
  var sInt = oInt.value;

  return !isNaN(sInt) && (sInt != "");
}


function isIntInRange(oInt, iMin, iMax)
{
  var iInt = parseInt(oInt.value, 10);

  if (!isInt(oInt))
  {
    return false;
  }
    
  if ((iInt < iMin) ||
      (iInt > iMax))
  {
    return false;
  }
  
  return true;
}

function bBitSet(byteval, bitno)
{
  return ((byteval & Math.pow(2, bitno)) != 0);
}

function iSetBit(byteval, bitno)
{
  return (byteval | Math.pow(2, bitno));
}

function create_tag()
{
  var e_name = "";
  var elem;
  
  if (arguments.length < 1)
  {
    return null;
  }
  
  if (arguments.length > 1)
  {
    for (var i = 1; i < arguments.length; i++)
    {
      var attributes = new Array();
      attributes[0] = arguments[i].substring(0, arguments[i].indexOf("|"));
      attributes[1] = arguments[i].substring(arguments[i].indexOf("|") + 1);
      if (attributes[0] == "name")
      {
        e_name = attributes[1];
      }
    }
  }
  
  if (e_name != "")
  {
    elem = createElementWithName(arguments[0], e_name);
  }
  else
  {
    elem = document.createElement(arguments[0]);
  }
  
  if (arguments.length > 1)
  {
    for (var i = 1; i < arguments.length; i++)
    {
      var attributes = new Array();
      attributes[0] = arguments[i].substring(0, arguments[i].indexOf("|"));
      attributes[1] = arguments[i].substring(arguments[i].indexOf("|") + 1);
      var subattributes = attributes[0].split(".");
      var is_bool_attribute = new RegExp("#" + subattributes[0] + "#");

      var bool_attributes = "#defaultChecked#defaultSelected#selected#multiple#disabled#";
      
      switch (subattributes.length)
      {
        case 1:
          if (is_bool_attribute.test(bool_attributes))
          {
            if ((attributes[1] == "true") || (attributes[1] == "1") || (attributes[1] == "disabled") || (attributes[1] == "selected") )
            {
              elem[subattributes[0]] = true;
            }
            else
            {
              elem[subattributes[0]] = false;
            }
          }
          else
          {
            elem[subattributes[0]] = attributes[1];
          }
        break;
        case 2:
          elem[subattributes[0]][subattributes[1]] = attributes[1];
        break;
        default:
          ;
      }
    }
  }
  
  return elem;
}

function create_tr()
{
  var tr;
  var td;

  if (arguments.length < 2)
  {
    return null;
  }

  tr = create_tag("tr");


  td = create_tag("td", "className|label");


  if ((arguments.length >= 3) && (arguments[2]))
  {
    var h2 = create_tag("h2", "className|first");
    h2.appendChild(document.createTextNode(arguments[0]));
    td.appendChild(h2);
  }
  else
  {
    td.appendChild(document.createTextNode(arguments[0]));
  }

  tr.appendChild(td);
  
  if ((arguments.length >= 4) && (arguments[3]))
  {


    td = create_tag("td", "className|rightSide");

  }
  else
  {


    td = create_tag("td");

  }

  td.appendChild(arguments[1]);

  tr.appendChild(td);
  
  return tr;
}

function create_trfix()
{
// fixes the width of the first column
  var tr = create_tag("tr");
  var td;
  var w = 360;
  var c = 1;
  
  if (arguments.length > 0)
  {
    w = arguments[0];
  }
  
  if (arguments.length > 1)
  {
    c = arguments[1];
  }

  td = create_tag("td", "style.padding|0");
  td.appendChild(create_tag("img", "src|images/spacer.gif", "alt|", "width|200", "height|1", "border|0"));
  tr.appendChild(td);
  td = create_tag("td", "style.padding|0", "colSpan|" + c);
  td.appendChild(create_tag("img", "src|images/spacer.gif", "alt|", "width|" + w, "height|1", "border|0"));
  tr.appendChild(td);
  
  return tr;
}

function create_button_table(t_save, t_cancel)
{
  var tab, bod, tab2, bod2, tr, tr2, td, td2, a, img;
  
  tab = create_tag("table", "border|0", "cellSpacing|0", "style.width|100%");
  bod = create_tag("tbody");
  tr = create_tag("tr");
  td = create_tag("td");
  td.appendChild(document.createTextNode("\u00a0")); 
  tr.appendChild(td);
  td = create_tag("td", "className|separatorButton");
  tab2 = create_tag("table", "border|0", "cellSpacing|0");
  bod2 = create_tag("tbody");
  tr2 = create_tag("tr");
  td2 = create_tag("td");
  a = create_tag("a", "href|#", "className|buttonLink100");
  a.appendChild(document.createTextNode(t_save)); 
  a.onclick = function (e) {javascript:submit_gigaset_form(); return false;};
  td2.appendChild(a);
  tr2.appendChild(td2);
  td2 = create_tag("td");
  a = create_tag("a", "href|#", "className|buttonLink100");
  a.appendChild(document.createTextNode(t_cancel)); 
  a.onclick = function (e) {javascript:cancel_gigaset_form(); return false;};
  td2.appendChild(a);
  tr2.appendChild(td2);
  bod2.appendChild(tr2);
  tab2.appendChild(bod2);
  td.appendChild(tab2);
  tr.appendChild(td);
  bod.appendChild(tr);
  bod.appendChild(create_trfix());
  tab.appendChild(bod);
  
  return tab;
}



function printNode(node)
{
  var output = "";
  
  return _printNode(node, output);
}

function createElementWithName(){}
(
  function()
  {
    try
    {
      var el=document.createElement( '<div name="foo">' );
      if (
           ('DIV'!=el.tagName)
           ||
           ('foo'!=el.name)
         )
      {
         throw 'create element error';
      }
      createElementWithName =
        function(tag, name)
          {
            return document.createElement('<'+tag+' name="'+name+'"></'+tag+'>');
          }
    }
    catch(e)
    {
      createElementWithName =
        function(tag, name)
        {
          var el = document.createElement(tag);
          el.name = name;
          return el;
        }
    }
  }
)();

function _printNode(node, output)
{
  var i;
  var o = output;
  
  if (node)
  {
    if (node.nodeType != 1)
    {
      o += node.data;
    }
    else
    {
      o += "<";
      o += node.nodeName;
      if (node.attributes)
      {
        for (i = 0; i < node.attributes.length; i++)
        {
          if (i == 0)
          {
            o += " ";
          }
          o += node.attributes[i].nodeName;
          o += '="';
          o += node.attributes[i].nodeValue;
          o += '"';
          if (i != (node.attributes.length - 1))
          {
            o += " ";
          }
        }
      }
      o += ">";
      if (node.childNodes)
      {
        for (i = 0; i < node.childNodes.length; i++)
        {
          o = _printNode(node.childNodes[i], o);
        }
      }
      o += "</" + node.nodeName + ">";
    }
    
    return o;
  }
}

function open_external_link(id, url) {
  var tmp_popup_url = url;
  var tmp_popup_identifier = id;
  var tmp_popup_width = screen.availWidth;
  var tmp_popup_height = screen.availHeight;
  var tmp_popup_x = 0;
  var tmp_popup_y = 0;
  new_window = window.open(tmp_popup_url, tmp_popup_identifier, "location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,width="+tmp_popup_width+",height="+tmp_popup_height+",left="+tmp_popup_x+",top="+tmp_popup_y+"");
  new_window.focus();
}

function isLatinChar(chr)
{
  if(((chr >= 65) && (chr <= 90)) || ((chr >= 97) && (chr <= 122))) return true;
  else return false;
}

function isArabicChar(chr)
{
  if((chr >= 1536) && (chr <= 1791)) return true;
  else return false;
}

function isSpace(chr)
{
  if(chr == 32) return true;
  else return false;
}

function isSentenceMarker(chr)
{
  if((chr == 46) || (chr == 63) || (chr == 33) || (chr == 40) || (chr == 41)) return true;
  else return false;
}

function isRightBracket(chr)
{
  if(chr == 41) return true;
  else return false;
}

function isLeftBracket(chr)
{
  if(chr == 40) return true;
  else return false;
}

function switch_order(msg)
{
  var strTmp = "";
  var strRes = "";
  var chrI;
  var isWordArabic = false;
  var addSpace = false;
  var addPoint = false;
  for(var i=0; i<msg.length; i++)
  {
    chrI = msg.charCodeAt(i);
    if(isArabicChar(chrI)) 
    {
      if(isWordArabic == true)
      {
        if(addSpace)
        {
          strTmp += " ";
          addSpace = false;
        }
        strTmp += msg.charAt(i);
      }
      else
      {
        if(addSpace)
        {
          strTmp = " " + strTmp;
          addSpace = false;
        }
        strRes = strTmp + strRes;
        strTmp = msg.charAt(i);
      }
      isWordArabic = true;
    }
    else
    {
      if(isSpace(chrI))
      {
        addSpace = true;
      }
      else
      {
        if((isLatinChar(chrI)) && (isWordArabic == true))
        {
          if(addSpace)
          {
            strTmp = " " + strTmp;
            addSpace = false;
          }
          strRes = strTmp + strRes;
          strTmp = msg.charAt(i);
          isWordArabic = false;
        }
        else
        {
          if(addSpace)
          {
            strTmp += " ";
            addSpace = false;
          }
          if((i == (msg.length - 1)) && (isSentenceMarker(chrI)))
          {
            if(isRightBracket(chrI))
            {
              strTmp = '(' + strTmp;
            }
            else
            {
              if(isLeftBracket(chrI))
              {
                strTmp = ')' + strTmp;
              }
              else
              {
                strTmp = msg.charAt(i) + strTmp;
              }
            }
          }
          else
          {
            if(msg.charAt(i) == '\n')
            {
              addSpace = true;
            }
            else
            {
              strTmp += msg.charAt(i);
            }
          }
        }
      }
    }
  }
  if(addSpace)
  {
    strTmp += " ";
    addSpace = false;
  }
  strRes = strTmp + strRes + " ";
  
  return strRes;
}

function alert_msg(msg)
{

  alert(msg);
}

function confirm_msg(msg)
{

  return confirm(msg);
}

function decode_utf8( txt )
{
  var ret;

  try
  {
    ret = decodeURIComponent( escape( txt ) );
  }
  catch(err)
  {
    //for added safety
    try
    {
      ret = unescape( escape( txt ) );
    }
    catch(err2)
    {
      ret = txt;
    }
  }
  return ret;
}


function fixLongTextsForTagWithClass(tagName, elemClass)
{
  // only firefox doesn't support text-overflow:ellipsis so this is solution
  if (browserDetectBrowser == "Firefox")
  {
    var classes;
    var elemArray = document.getElementsByTagName(tagName);

    for (var i = 0; i < elemArray.length; i++)
    {
      classes = elemArray[i].className.split(" ");
      
      for (var j = 0; j < classes.length; j++)
      {
        if (classes[j] == elemClass)
        {
          addOverflowEllipsis(elemArray[i]);
          break;
        }
      }
    }
  }
}

function addOverflowEllipsis(elem)
{
  // only firefox doesn't support text-overflow:ellipsis so this is solution
  if (browserDetectBrowser == "Firefox")
  {
    
    var elemWidth = elem.clientWidth;
    var elemText;



    while (elemWidth < elem.scrollWidth)
    {      
      elemText = elem.innerHTML;
      elem.innerHTML = elemText.substr(0, elemText.length - 2) + "&hellip;";
    }
  }
}




// returns the version of Internet Explorer or a -1 indicating the use of another browser
function getInternetExplorerVersion()
{
  var retVal = -1;
  if (navigator.appName == "Microsoft Internet Explorer")
  {
    var userAgent = navigator.userAgent;
    var regularExp = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (regularExp.exec(userAgent) != null)
    {
      retVal = parseFloat(RegExp.$1);
    }
  }
  return retVal;
}

// if dropdown's width is less than max width of its options
// then in IE8 options are cut
function fixDropDownForIE8()
{
  var IEversion = getInternetExplorerVersion();
  if (IEversion == 8.0)
  {
    var selects = document.getElementsByTagName("select");
    for (var i = 0; i < selects.length; i++)
    {
      if (
           (selects[i].clientWidth < selects[i].scrollWidth)
           &&
           (!selects[i].attributes.size)
         )
      {
        var f_onchange = selects[i].onchange;
        var defaultWidth = selects[i].style.width;
        selects[i].onblur = function()
                            {
                              this.style.width = defaultWidth;
                              this.parentNode.style.width = defaultWidth;
                            };
        selects[i].onmousedown = function()
                                 {
                                   this.style.width = "auto";
                                   this.parentNode.style.width = this.style.width;
                                 };
        selects[i].onchange = function()
                              {
                                if (typeof(f_onchange) == typeof(Function))
                                {
                                  f_onchange();
                                }
                                this.style.width = defaultWidth;
                                this.parentNode.style.width = defaultWidth;
                              };
      }
    }
  }
}


// in some cases strings in UTF-8 are cut in the middle of UTF-8 2-bytes char
// which is cause that question marks are shown instead of real chars
function correctTooLongUtf8String()
{
  var editfields = document.getElementsByTagName("input");
  for (var i = 0; i < editfields.length; i++)
  {
    if ((editfields[i].type == "text") && (typeof editfields[i].maxLength != "undefined"))
    {
      while (countUTF8Bytes(editfields[i].value) > editfields[i].maxLength)
      {
        // remove last char
        editfields[i].value = editfields[i].value.substring(0, editfields[i].value.length - 1);
      }
    }
  }
}

function checkIfValidKeyToCallBrowse(event)
{
  var allowedKeyCodes = new Array("13", "32"); // enter, spacebar
  var receivedKeyCode = event.keyCode;
  for(var i=0; i<allowedKeyCodes.length; i++)
  {
    if(allowedKeyCodes[i] == receivedKeyCode)
    {

      return true;
    }
  }
  return false;
}

function clickBrowse(inputFileId)
{
  document.getElementById(inputFileId).click();
}

function handleKeyPressBrowseButton(inputFileId, event)
{
  if(!checkIfValidKeyToCallBrowse(event))
  {
    return false;
  }
  clickBrowse(inputFileId);
}

function checkIfValidKeyToCallNext(event)
{
  var allowedKeyCodes = new Array("13"); // enter
  var receivedKeyCode = event.keyCode;
  for(var i=0; i<allowedKeyCodes.length; i++)
  {
    if(allowedKeyCodes[i] == receivedKeyCode)
    {
      return true;
    }
  }
  return false;
}
  /* file navtools.js */
var mainTitle="";
var pageTitle="";
var mainTitleSeparator="|";
var navLastID1=0;
var navLastID2=0;
var navLastID3=0;
var navLastID4=0;
var navLastID5=0;
var navVisibleCount1=0;
var navVisibleCount2=0;
var navVisibleCount3=0;
var navVisibleCount4=0;
var navVisibleCount5=0;
var currentURL=document.location.href;
var currNav=new Array();

function doLogout()
{
  if(typeof(help_window)!='undefined')help_window.close();
  top.location.href='logout.stm';
}
function checkMenuLevels(L1, L2, L3, L4, L5)
{
  if ((arguments.length>0) && (typeof(nav[L1])=='undefined'))
  {
    alert_msg('Menu L1 is missing');
  }
  if ((arguments.length>1) &&(typeof(nav[L1][L2])=='undefined'))
  {
    alert_msg('Menu L2 is missing');
  }
  if ((arguments.length>2) &&(typeof(nav[L1][L2][L3])=='undefined'))
  {
    alert_msg('Menu L3 is missing');
  }
  if ((arguments.length>3) &&(typeof(nav[L1][L2][L3][L4])=='undefined'))
  {
    alert_msg('Menu L4 is missing');
  }
  if ((arguments.length>4) &&(typeof(nav[L1][L2][L3][L4][L5])=='undefined'))
  {
    alert_msg('Menu L5 is missing');
  }
}

function addNavigationItem(navLevel,navLink,navCaption,navVisible)
{
  switch (navLevel)
  {
    case 1:
      navID1=navLastID1+1;
      nav[navID1]=new Array();
      nav[navID1]['link']=navLink;
      nav[navID1]['caption']=navCaption;
      nav[navID1]['visible']=navVisible;
      if(navVisible==1)navVisibleCount1++;
      nav['visible_count']=navVisibleCount1;
      nav['count']=navID1;
      navLastID1=navID1;
      navLastID2=0;
      navLastID3=0;
      navLastID4=0;
      navLastID5=0;
      navVisibleCount2=0;
      navVisibleCount3=0;
      navVisibleCount4=0;
      navVisibleCount5=0;
      break;

    case 2:
      navID1=navLastID1;
      navID2=navLastID2+1;
        checkMenuLevels(navID1);
      nav[navID1][navID2]=new Array();
      nav[navID1][navID2]['link']=navLink;
      nav[navID1][navID2]['caption']=navCaption;
      nav[navID1][navID2]['visible']=navVisible;
      if(navVisible==1)navVisibleCount2++;
      nav[navID1]['visible_count']=navVisibleCount2;
      nav[navID1]['count']=navID2;
      navLastID1=navID1;
      navLastID2=navID2;
      navLastID3=0;
      navLastID4=0;
      navLastID5=0;
      navVisibleCount3=0;
      navVisibleCount4=0;
      navVisibleCount5=0;
      break;

    case 3:
      navID1=navLastID1;
      navID2=navLastID2;
      navID3=navLastID3+1;
        checkMenuLevels(navID1, navID2);
      nav[navID1][navID2][navID3]=new Array();
      nav[navID1][navID2][navID3]['link']=navLink;
      nav[navID1][navID2][navID3]['caption']=navCaption;
      nav[navID1][navID2][navID3]['visible']=navVisible;
      if(navVisible==1)navVisibleCount3++;
      nav[navID1][navID2]['visible_count']=navVisibleCount3;
      nav[navID1][navID2]['count']=navID3;
      navLastID1=navID1;
      navLastID2=navID2;
      navLastID3=navID3;
      navLastID4=0;
      navLastID5=0;
      navVisibleCount4=0;
      navVisibleCount5=0;
      break;

    case 4:
      navID1=navLastID1;
      navID2=navLastID2;
      navID3=navLastID3;
      navID4=navLastID4+1;
        checkMenuLevels(navID1, navID2, navID3);
      nav[navID1][navID2][navID3][navID4]=new Array();
      nav[navID1][navID2][navID3][navID4]['link']=navLink;
      nav[navID1][navID2][navID3][navID4]['caption']=navCaption;
      nav[navID1][navID2][navID3][navID4]['visible']=navVisible;
      if(navVisible==1)navVisibleCount4++;
      nav[navID1][navID2][navID3]['visible_count']=navVisibleCount4;
      nav[navID1][navID2][navID3]['count']=navID4;
      navLastID1=navID1;
      navLastID2=navID2;
      navLastID3=navID3;
      navLastID4=navID4;
      navLastID5=0;
      navVisibleCount5=0;
      break;

    case 5:
      navID1=navLastID1;
      navID2=navLastID2;
      navID3=navLastID3;
      navID4=navLastID4;
      navID5=navLastID5+1;
        checkMenuLevels(navID1, navID2, navID3, navID4);
      nav[navID1][navID2][navID3][navID4][navID5]=new Array();
      nav[navID1][navID2][navID3][navID4][navID5]['link']=navLink;
      nav[navID1][navID2][navID3][navID4][navID5]['caption']=navCaption;
      nav[navID1][navID2][navID3][navID4][navID5]['visible']=navVisible;
      if(navVisible==1)navVisibleCount5++;
      nav[navID1][navID2][navID3][navID4]['visible_count']=navVisibleCount5;
      nav[navID1][navID2][navID3][navID4]['count']=navID5;
      navLastID1=navID1;
      navLastID2=navID2;
      navLastID3=navID3;
      navLastID4=navID4;
      navLastID5=navID5;
      break;
  } 
}


function getCurrentNavigationID2(navBranch,level)
{
  if(typeof(navBranch)!='undefined')
  {
    for(currNav[level]=1;currNav[level]<=navBranch['count'];currNav[level]++)
    {
      if(typeof(navBranch[currNav[level]]['count'])!='undefined')
      {
        if(getCurrentNavigationID2(navBranch[currNav[level]],level+1))
        {
          return true;
        }
      }
      if(instr(currentURL,navBranch[currNav[level]]['link']))
      {
        return true;
      }
    }
  }
  currNav[level]=0;
  return false;
}

function getPageTitle(nav,level)
{
  if(typeof(currNav[level])!='undefined')
  {
    if(currNav[level]!=0)
    {
      pageTitle=nav[currNav[level]]['caption'];
      getPageTitle(nav[currNav[level]],level+1);
    }
  }
}

function getCurrentNavigationID(newMainTitle)
{
  mainTitle=newMainTitle;
  pageTitle='Configuration';
  getCurrentNavigationID2(nav,1);
  getPageTitle(nav,1);
  return;
}

function writeNavigation()
{
  if(typeof(currNav[1])!='undefined')
  {
    if((currNav[1]>0)&&(nav[currNav[1]]['visible']==1))
    {
      navigationTabs='<table border="0" cellspacing="0" cellpadding="0">';navigationTabs+='<tr>';for(var i=1;i<=nav['count'];i++){if(nav[i]['visible']==1){navigationTabs+='<td style="padding:0;"><a'+((i==currNav[1])?' class="active'+(i-1)+'"':'')+' href="'+nav[i]['link']+'">'+nav[i]['caption']+'<\/a><\/td>';}}navigationTabs+='<\/tr>';navigationTabs+='<\/table>';document.write(navigationTabs);
    }
  }
}

function writeNavigationA(navBranch,level)
{
  if(typeof(navBranch)=='undefined') return;
  for(var navNodeNo=1;navNodeNo<=navBranch['count'];navNodeNo++)
  {
    document.write(level+":"+navBranch[navNodeNo]['caption']+"|"+navBranch[navNodeNo]['visible']+"<br>");writeNavigationA(navBranch[navNodeNo],level+1);
  }
}

function writeSubNavigation2(navBranch,level)
{
  var subsel;
  if(typeof(navBranch)!='undefined')
  {
    if((navBranch['count']>0)&&(navBranch['visible_count']>0))
    {
      document.write('<ul>');if(typeof(currNav[level+1])!='undefined'){subsel=currNav[level+1];}else{subsel=0;}nextsubsel=0;if(typeof(currNav[level+2])!='undefined'){if(typeof(navBranch[currNav[level+1]][currNav[level+2]])!='undefined'){if(navBranch[currNav[level+1]][currNav[level+2]]['visible']==1){nextsubsel=currNav[level+2];}}}for(var navNodeNo=1;navNodeNo<=navBranch['count'];navNodeNo++){document.write('<li>');if(navBranch[navNodeNo]['visible']==1){document.write('<div'+(((subsel==navNodeNo)&&(nextsubsel==0))?' class="activeSub" style="width: '+(220-level*12)+'px;"':'')+'>');document.write('<div><a href="'+navBranch[navNodeNo]['link']+'">'+navBranch[navNodeNo]['caption']+'<\/a><\/div><\/div>');}if(subsel==navNodeNo){writeSubNavigation2(navBranch[navNodeNo],level+1);}document.write('<\/li>');}document.write('<\/ul>');
    }
  }
}

function writeSubNavigation()
{
  writeSubNavigation2(nav[currNav[1]],1);document.title=pageTitle+' '+mainTitleSeparator+' '+mainTitle;
}
  /* file navnodes.js */
nav = new Array();


/*************
    Merkur
*************/

/* Begining of the PSTN-VoIP Variant */

  addNavigationItem (1, 'nowhere.xxx', '', 0);
  addNavigationItem (2, 'login.html', 'Login', 1);
  addNavigationItem (1, 'security_advice.html', 'Security Advice', 0);
  addNavigationItem (1, 'home.html', 'Home', 1);

  // Settings
  addNavigationItem (1, 'settings_lan.html', 'Settings', 1);
    

    // Network
    addNavigationItem (2, 'settings_lan.html', 'Network', 1);
      //
      // IP Configuration
      addNavigationItem (3, 'settings_lan.html', 'IP Configuration', 1);
      //

      //Security
      addNavigationItem (3, 'settings_telephony_security.html', 'Security', 1);



    //
    // Telephony
    addNavigationItem (2, 'settings_telephony_voip_multi.html', 'Telephony', 1);
      //
      // Connections 
      
      addNavigationItem (3, 'settings_telephony_voip_multi.html', 'Connections', 1);
      addNavigationItem (4, 'settings_telephony_voip.html', 'Connections', 0);
      addNavigationItem (4, 'settings_telephony_pstn.html', 'Connections', 0);
      addNavigationItem (4, 'settings_telephony_shc.html', 'Connections', 0);
      
      //
      //Audio
      addNavigationItem (3, 'settings_telephony_audio.html', 'Audio', 1);
      //
      // Number Assignment
      addNavigationItem (3, 'settings_telephony_assignment.html', 'Number Assignment', 1);
      //

      //Call Divert
      
      addNavigationItem (3, 'settings_telephony_callforwarding.html', 'Call Divert', 1);
      
      //
      // Dialling Plans
      addNavigationItem (3, 'settings_telephony_dialplan.html', 'Dialling Plans', 1);
      //
      // Network Mailboxes
      addNavigationItem (3, 'settings_telephony_network_mailboxes.html', 'Network Mailboxes', 1);
      //
      //Advanced VoIP-Settings
      addNavigationItem (3, 'settings_telephony_advanced.html', 'Advanced VoIP settings', 1);


    //
    // Messaging
    
    addNavigationItem (2, 'settings_messaging_email.html', 'Messaging', 1)
    

    

      //
      // E-mail
      
      addNavigationItem (3, 'settings_messaging_email.html', 'eMail', 1)
      addNavigationItem (4, 'settings_messaging_email_editor.html', 'eMail', 0);
      
      //
      // MWI Light
      addNavigationItem (3, 'settings_mwi_light.html', 'MWI Light', 1)
      
    
    // Info Services
    addNavigationItem (2, 'settings_infoservice.html', 'Info Services', 1);
    

    //
    // Directories
    addNavigationItem (2, 'settings_services_online_directory.html', 'Directories', 1);
      //
      // Online Directory
      addNavigationItem (3, 'settings_services_online_directory.html', 'Online Directory', 1);

      //Additional Provider
      addNavigationItem (4, 'settings_online_directory_additional_provider.html', 'Online Directory', 0);
      //

      // "Directory Transfer"
      addNavigationItem (3, 'settings_phonebook_transfer.html', 'Directory Transfer', 1);


    // Management
    addNavigationItem (2, 'settings_management_date_n_time.html', 'Management', 1);
      //
      // Date & Time
      addNavigationItem (3, 'settings_management_date_n_time.html', 'Date & Time', 1);
      //
      // Local Settings
      addNavigationItem (3, 'settings_management_local_settings.html', 'Local Settings ', 1);
      //
      // Miscellaneous
      addNavigationItem (3, 'settings_management_miscellaneous.html', 'Miscellaneous', 1);
      //
      // Reboot & Reset
      addNavigationItem (3, 'settings_management_reboot_and_reset.html', 'Reboot & Reset ', 1);
      //
      // Save & Restore
      addNavigationItem (3, 'settings_management_save_and_restore.html', 'Save & Restore', 1);
      //
      // Firmware Update
      addNavigationItem (3, 'settings_management_firmware_update.html', 'Firmware Update', 1);


    // Status
    addNavigationItem (1, 'status_device.html', 'Status', 1);
      //
      // Status
      addNavigationItem (2, 'status_device.html', 'Status', 1);
      //
      // Device
      addNavigationItem (3, 'status_device.html', 'Device', 1);
      //
      // (Status) Connections
      addNavigationItem (3, 'status_connections.html', 'Connections', 1);

  //
  getCurrentNavigationID('N300A IP');

/* End of PSTN-VoIP Variant */


///////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////


/********************
    End of Merkur
********************/



  /* file help.js */
function open_gigaset_help_window() {
  var tmp_popup_identifier = 'gigaset_help';
  var tmp_popup_width = 500;
  var tmp_popup_height = 300;
  
  if(window.innerWidth)
  {
    //FF
    var tmp_popup_x = (window.screenX + window.outerWidth - tmp_popup_width - 20); 
  }
  else
  {
    //Everything else 
    var tmp_popup_x = (screen.width - tmp_popup_width - 50); 
  }
  
  if (window.screenY)
  {
    //FF, Safari, Opera
    if(window.innerHeight)
    {
      //FF
      var tmp_popup_y = window.screenY + window.outerHeight - window.innerHeight - 20 ; 
    }
    else
    {
      //Safari, Opera
      var tmp_popup_y = window.screenY + 150; 
    }
  }
  else
  {
    //IE, Chrome
    var tmp_popup_y = window.screenTop +50; 
  };
  var help_window = window.open("help.html", tmp_popup_identifier, "dependent=yes,directory=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width="+tmp_popup_width+",height="+tmp_popup_height+",left="+tmp_popup_x+",top="+tmp_popup_y+"");
  help_window.focus();
}

  /* file blocks.js */
function writeBlockStaticAreaTop()
{      
  var argv = writeBlockStaticAreaTop.arguments;
  var argc = writeBlockStaticAreaTop.arguments.length;
  var withTabs = (argc > 0) ? argv[0] : true;
  var withLogout = (argc > 1) ? argv[1] : true;

  //  +++++++++++++++++++++++++  
  //  BEGINN STATIC AREA TOP  
  
  //  Gigaset logo & product name  
  document.write('<div id="Gigalogo"><table border="0" cellspacing="0" cellpadding="0" width=100% ><tr>');
  switch (labeling)
  {
    case 1:
      document.write('<td id="logotd" width="1"><img src="images/dip-phone-450.gif" alt="product" border="0" ><\/td>');
      break;
    case 2:
      document.write('<td id="logotd" width="1"><img src="images/tesco.gif" alt="TESCO" border="0" ><\/td>');
      document.write('<td id="productnametxt" style="padding-bottom: 8px;">N300A IP<\/td>');
      break;
    case 3:
      document.write('<td id="logotd" width="1"><img id="bannername" src="images/t-home-banner.gif" alt="T-HOME" border="0" ><\/td>');
      break;
    case 4:
      document.write('<td id="logotd" width="1"><img src="images/stc.gif" alt="Saudi Telecom" border="0"><\/td>');


      document.write('<td id="productnametxt" >N300A IP<\/td>');

      break;
    case 5:
      document.write('<td id="logotd" width="1"><img id="bannername" src="flexible_provider_logo.gif" alt="provider_logo" border="0" ><\/td>');
      document.write('<td id="productnametxt" style="vertical-align:middle;" align="left">N300A IP<\/td>');
      break;
    case 6:
      document.write('<td id="logotd" width="1"><img src="vox/images/supafone.gif" alt="Supafone" border="0" align=left><\/td>');
      break;
    case 7:
      document.write('<td id="logotd" width="1"><img src="images/gigaset_p.jpg" alt="Gigaset" border="0" align=left><\/td>');
      document.write('<td id="productnametxt" align="left" >N300A IP<\/td>');
      break;
    default:
      document.write('<td id="logotd" width="1"><img src="images/gigaset.png" alt="Gigaset" border="0" align=left><\/td>');


      document.write('<td id="productnametxt" align="left" >N300A IP<\/td>');

  }
// ESz right up corner - SIEMENS logo  
  switch (labeling)
  {
    case 1:
      document.write('<td id="logotdup" style="vertical-align:middle;" align=right><img src="images/targa.gif" alt="Targa" border="0" ><\/td>');
      break;
    case 3:
      break;
    case 4:
      break;
    case 7:
      break;
    default:
      //document.write('<td id="logotdup" style="vertical-align:middle;" align=right><img src="images/siemens.gif" alt="Siemens" height="15" border="0" ><\/td>');
      break;
  }


  document.write('<\/tr><\/table><\/div>');

  //navigationtab
  if (withTabs)
  {
  document.write('<div id="div_tabs">');
  writeNavigation();    
    if (labeling == 3)
    {
      document.write('<div id="sinus_produkt_name"><img src="images/produktname.gif" alt="Product" border="0" ><\/div>');
    }
  document.write('<\/div>');
  }
  
  //  logout  
  document.write('<div id="div_home_logout">');  
  if (withLogout)
  {
    document.write('<a id="logouttoptext" href="logout.html" title="End the configuration session">Log Off<\/a>');
  }
  else
  {
    document.write('&nbsp;');
  }
  document.write('<\/div>');
  
  //  top area of grey  


  document.write('<div id="greyTop"><img src="images/spacer.gif" alt="" width="1" height="5" border="0" ><\/div>');

  
  //   middle area of grey  
  document.write('<div id="greyMiddle">');

  //  END STATIC AREA TOP  
  //  +++++++++++++++++++++++++  
}

function writeBlockSubmenu()
{
  //  the menue on the left side  
  document.write('<div id="div_menue">');
  writeSubNavigation();
  document.write('<\/div>');
  //  END of menue  
}

function writeBlockHelp()
{
  var argv = writeBlockHelp.arguments;
  var argc = writeBlockHelp.arguments.length;
  var writehelp = (argc > 0) ? argv[0] : true;

  document.write('<div id="div_help">');
  if (writehelp && 1)
  {
    switch (labeling)
    {
      case 7:
        document.write('<a href=" " onclick="javascript:open_gigaset_help_window(); return false;" title=""><img src="images/help_p.gif" alt="" width="20" height="30" border="0" ><\/a>');
        break;

      default:
        document.write('<a href=" " onclick="javascript:open_gigaset_help_window(); return false;" title=""><img src="images/help.gif" alt="" width="20" height="30" border="0" ><\/a>');
        break;
    }
  }
  else
  {
    document.write('&nbsp;');
  }
  document.write('<\/div>');
}

function writeBlockStaticAreaBottom()
{
  //  +++++++++++++++++++++++++  
  //  BEGINN STATIC AREA BOTTOM  

  document.write('<\/div>');
  //   END middle area of grey  
    
  //  bottom area of grey  
  document.write('<div id="greyBottom"><img src="images/spacer.gif" alt="" width="1" height="7" border="0" ><\/div>');

  switch (labeling)
    {
        case 6:
        document.write('<div id="Siemenslogo" style="padding-right: 30px;"><img src="vox/images/vox.gif" alt="vox" border="0" ><\/div>');
        break;
    default:
      ;
    }
    
  //  END STATIC AREA BOTTOM  
  //  +++++++++++++++++++++++++  
}


function writeBlockStaticAreaBottomLicense()
{
  //  +++++++++++++++++++++++++  
  //  BEGINN STATIC AREA BOTTOM LICENSE  
    
  //  license text  
  switch (labeling)
  {
    case 7:
      document.write('<div style="vertical-align: top; text-align: left;font-size: 12px;">&copy; Gigaset Communications GmbH 2012. All rights reserved.<\/div>');
      break;
    case 1:
    case 3:
    case 4:
    default:
      document.write('<div style="vertical-align: top; text-align: left;font-size: 12px;" id="bottomcopytext" >GIGASET. INSPIRING CONVERSATION<br />&copy; Gigaset Communications GmbH 2012. All rights reserved.<\/div>');
      break;
  }

  //  END STATIC AREA BOTTOM LICENSE  
  //  +++++++++++++++++++++++++  
}
 
  var ip_address_type_old;
var ip_address_1_old;
var ip_address_2_old;
var ip_address_3_old;
var ip_address_4_old;
var subnet_mask_1_old;
var subnet_mask_2_old;
var subnet_mask_3_old;
var subnet_mask_4_old;
var gateway_1_old;
var gateway_2_old;
var gateway_3_old;
var gateway_4_old;
var dns_1_1_old;
var dns_1_2_old;
var dns_1_3_old;
var dns_1_4_old;
var dns_2_1_old;
var dns_2_2_old;
var dns_2_3_old;
var dns_2_4_old;
var proxy_enabled = 1;
var proxy_port_saved = 5560;

  var network_name_old;


  var vlan_identifier_old;
  var vlan_priority_old;
  var vlan_enabled_old;


function set_visibility()
{
  enable_proxy_port(proxy_enabled);
}

function repaint_gigaset_form()
{
  var row_display=((browserDetectBrowser=='Internet Explorer')?'block':'table-row');
  current_ip_address_type=document.gigaset.ip_address_type.value;
  

  
  document.getElementById('ip_text').style.color=((current_ip_address_type=='0')?'#555':'#999');

  //document.getElementById('ip_address_1').value=((current_ip_address_type=='0')?"192":"192");
  //document.getElementById('ip_address_2').value=((current_ip_address_type=='0')?"168":"168");
  //document.getElementById('ip_address_3').value=((current_ip_address_type=='0')?"040":"040");
  //document.getElementById('ip_address_4').value=((current_ip_address_type=='0')?"034":"034");


  document.getElementById('ip_address_1').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('ip_address_2').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('ip_address_3').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('ip_address_4').style.color=((current_ip_address_type=='0')?"#000":"#606060");

  document.getElementById('ip_address_1').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('ip_address_2').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('ip_address_3').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('ip_address_4').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");

  document.getElementById('ip_address_1').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('ip_address_2').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('ip_address_3').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('ip_address_4').readOnly=((current_ip_address_type=='0')?false:true);



  document.getElementById('subnet_mask_text').style.color=((current_ip_address_type=='0')?'#555':'#999');

  //document.getElementById('subnet_mask_1').value=((current_ip_address_type=='0')?"255":"255");
  //document.getElementById('subnet_mask_2').value=((current_ip_address_type=='0')?"255":"255");
  //document.getElementById('subnet_mask_3').value=((current_ip_address_type=='0')?"255":"255");
  //document.getElementById('subnet_mask_4').value=((current_ip_address_type=='0')?"000":"000");


  document.getElementById('subnet_mask_1').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('subnet_mask_2').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('subnet_mask_3').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('subnet_mask_4').style.color=((current_ip_address_type=='0')?"#000":"#606060");

  document.getElementById('subnet_mask_1').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('subnet_mask_2').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('subnet_mask_3').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('subnet_mask_4').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");

  document.getElementById('subnet_mask_1').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('subnet_mask_2').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('subnet_mask_3').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('subnet_mask_4').readOnly=((current_ip_address_type=='0')?false:true);



  document.getElementById('default_gateway_text').style.color=((current_ip_address_type=='0')?'#555':'#999');

  //document.getElementById('default_gateway_1').value=((current_ip_address_type=='0')?"192":"");
  //document.getElementById('default_gateway_2').value=((current_ip_address_type=='0')?"168":"");
  //document.getElementById('default_gateway_3').value=((current_ip_address_type=='0')?"040":"");
  //document.getElementById('default_gateway_4').value=((current_ip_address_type=='0')?"001":"");


  document.getElementById('default_gateway_1').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('default_gateway_2').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('default_gateway_3').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('default_gateway_4').style.color=((current_ip_address_type=='0')?"#000":"#606060");

  document.getElementById('default_gateway_1').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('default_gateway_2').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('default_gateway_3').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('default_gateway_4').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");

  document.getElementById('default_gateway_1').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('default_gateway_2').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('default_gateway_3').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('default_gateway_4').readOnly=((current_ip_address_type=='0')?false:true);



  document.getElementById('preferred_dns_server_text').style.color=((current_ip_address_type=='0')?'#555':'#999');

  //document.getElementById('preferred_dns_server_1').value=((current_ip_address_type=='0')?"010":"");
  //document.getElementById('preferred_dns_server_2').value=((current_ip_address_type=='0')?"001":"");
  //document.getElementById('preferred_dns_server_3').value=((current_ip_address_type=='0')?"107":"");
  //document.getElementById('preferred_dns_server_4').value=((current_ip_address_type=='0')?"051":"");


  document.getElementById('preferred_dns_server_1').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('preferred_dns_server_2').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('preferred_dns_server_3').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('preferred_dns_server_4').style.color=((current_ip_address_type=='0')?"#000":"#606060");

  document.getElementById('preferred_dns_server_1').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('preferred_dns_server_2').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('preferred_dns_server_3').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('preferred_dns_server_4').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");

  document.getElementById('preferred_dns_server_1').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('preferred_dns_server_2').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('preferred_dns_server_3').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('preferred_dns_server_4').readOnly=((current_ip_address_type=='0')?false:true);

  

  document.getElementById('alternate_dns_server_text').style.color=((current_ip_address_type=='0')?'#555':'#999');

  //document.getElementById('alternate_dns_server_1').value=((current_ip_address_type=='0')?"010":"");
  //document.getElementById('alternate_dns_server_2').value=((current_ip_address_type=='0')?"001":"");
  //document.getElementById('alternate_dns_server_3').value=((current_ip_address_type=='0')?"107":"");
  //document.getElementById('alternate_dns_server_4').value=((current_ip_address_type=='0')?"052":"");  


  document.getElementById('alternate_dns_server_1').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('alternate_dns_server_2').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('alternate_dns_server_3').style.color=((current_ip_address_type=='0')?"#000":"#606060");
  document.getElementById('alternate_dns_server_4').style.color=((current_ip_address_type=='0')?"#000":"#606060");

  document.getElementById('alternate_dns_server_1').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('alternate_dns_server_2').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('alternate_dns_server_3').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");
  document.getElementById('alternate_dns_server_4').style.backgroundColor = ((current_ip_address_type=='0')?"#FFF":"#DDDDDD");

  document.getElementById('alternate_dns_server_1').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('alternate_dns_server_2').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('alternate_dns_server_3').readOnly=((current_ip_address_type=='0')?false:true);
  document.getElementById('alternate_dns_server_4').readOnly=((current_ip_address_type=='0')?false:true);
}

function store_old_values()
{
  ip_address_type_old=document.gigaset.ip_address_type.value;
  ip_address_1_old=document.getElementById('ip_address_1').value;
  ip_address_2_old=document.getElementById('ip_address_2').value;
  ip_address_3_old=document.getElementById('ip_address_3').value;
  ip_address_4_old=document.getElementById('ip_address_4').value;
  subnet_mask_1_old=document.getElementById('subnet_mask_1').value;
  subnet_mask_2_old=document.getElementById('subnet_mask_2').value;
  subnet_mask_3_old=document.getElementById('subnet_mask_3').value;
  subnet_mask_4_old=document.getElementById('subnet_mask_4').value;
  gateway_1_old=document.getElementById('default_gateway_1').value;
  gateway_2_old=document.getElementById('default_gateway_2').value;
  gateway_3_old=document.getElementById('default_gateway_3').value;
  gateway_4_old=document.getElementById('default_gateway_4').value;
  dns_1_1_old=document.getElementById('preferred_dns_server_1').value;
  dns_1_2_old=document.getElementById('preferred_dns_server_2').value;
  dns_1_3_old=document.getElementById('preferred_dns_server_3').value;
  dns_1_4_old=document.getElementById('preferred_dns_server_4').value;
  dns_2_1_old=document.getElementById('alternate_dns_server_1').value;
  dns_2_2_old=document.getElementById('alternate_dns_server_2').value;
  dns_2_3_old=document.getElementById('alternate_dns_server_3').value;
  dns_2_4_old=document.getElementById('alternate_dns_server_4').value;

  network_name_old=document.getElementById('network_name').value;


  vlan_identifier_old=document.getElementById('vlan_identifier').value;
  vlan_priority_old=document.getElementById('vlan_priority').value;
  vlan_enabled_old=document.getElementById('vlan_enable').checked;

}

function validate_gigaset_form()
{
  if(document.getElementById('http_proxy_port').readOnly == false)
  {
    if (!isIntInRange(document.getElementById('http_proxy_port'), 1, 55000)) 
    {

      showAdvanced();

      alert_msg('Invalid Port! (Value Range: 1-55000)');
      document.gigaset.http_proxy_port.select();
      document.gigaset.http_proxy_port.focus();
      return false;
    }
  }
  if(document.gigaset.ip_address_type.value==0)
  {
    if(!isValidIP(document.getElementById('ip_address_1'),document.getElementById('ip_address_2'),document.getElementById('ip_address_3'),document.getElementById('ip_address_4'),document.getElementById('subnet_mask_1'),document.getElementById('subnet_mask_2'),document.getElementById('subnet_mask_3'),document.getElementById('subnet_mask_4')))
    { 
      alert_msg("You did not enter a valid IP address.");
      document.gigaset.ip_address_1.select();
      document.gigaset.ip_address_1.focus();
      return false;
    }
    if(!isValidSubnetmask(document.getElementById('subnet_mask_1'),document.getElementById('subnet_mask_2'),document.getElementById('subnet_mask_3'),document.getElementById('subnet_mask_4')))
    {
      alert_msg("The specified subnet mask is not valid.");
      document.gigaset.subnet_mask_1.select();
      document.gigaset.subnet_mask_1.focus();
      return false;
    }
    if((document.gigaset.default_gateway_1.value!='')||(document.gigaset.default_gateway_2.value!='')||(document.gigaset.default_gateway_3.value!='')||(document.gigaset.default_gateway_4.value!=''))
    {
      if(!isValidIP(document.getElementById('default_gateway_1'),document.getElementById('default_gateway_2'),document.getElementById('default_gateway_3'),document.getElementById('default_gateway_4'),document.getElementById('subnet_mask_1'),document.getElementById('subnet_mask_2'),document.getElementById('subnet_mask_3'),document.getElementById('subnet_mask_4')))
      {
        alert_msg("You did not enter a valid IP address.");
        document.gigaset.default_gateway_1.select();
        document.gigaset.default_gateway_1.focus();
        return false;
      }
      if(!isInSameSubnet(document.getElementById('ip_address_1'),document.getElementById('ip_address_2'),document.getElementById('ip_address_3'),document.getElementById('ip_address_4'),document.getElementById('default_gateway_1'),document.getElementById('default_gateway_2'),document.getElementById('default_gateway_3'),document.getElementById('default_gateway_4'),document.getElementById('subnet_mask_1'),document.getElementById('subnet_mask_2'),document.getElementById('subnet_mask_3'),document.getElementById('subnet_mask_4')))
      {
        alert_msg("The specified IP address for the default gateway does not lie within the IP address range of your device specified by the subnet mask.");
        document.gigaset.default_gateway_1.select();
        document.gigaset.default_gateway_1.focus();
        return false;
      }
      if(!isGatewaySameAsDevice(document.getElementById('ip_address_1'),document.getElementById('ip_address_2'),document.getElementById('ip_address_3'),document.getElementById('ip_address_4'),document.getElementById('default_gateway_1'),document.getElementById('default_gateway_2'),document.getElementById('default_gateway_3'),document.getElementById('default_gateway_4')))
      {
        alert_msg("Invalid IP Address: The specified IP address for the default gateway is the same as  your device. ");
        document.gigaset.default_gateway_1.select();
        document.gigaset.default_gateway_1.focus();
        return false;
      }
    }
    if((document.gigaset.preferred_dns_server_1.value!='')||(document.gigaset.preferred_dns_server_2.value!='')||(document.gigaset.preferred_dns_server_3.value!='')||(document.gigaset.preferred_dns_server_4.value!=''))
    {
      if(!isValidIP(document.getElementById('preferred_dns_server_1'),document.getElementById('preferred_dns_server_2'),document.getElementById('preferred_dns_server_3'),document.getElementById('preferred_dns_server_4')))
      {
        alert_msg("You did not enter a valid IP address.");
        document.gigaset.preferred_dns_server_1.select();
        document.gigaset.preferred_dns_server_1.focus();
        return false;
      }
    }
    if((document.gigaset.alternate_dns_server_1.value!='')||(document.gigaset.alternate_dns_server_2.value!='')||(document.gigaset.alternate_dns_server_3.value!='')||(document.gigaset.alternate_dns_server_4.value!=''))
    {
      if(!isValidIP(document.getElementById('alternate_dns_server_1'),document.getElementById('alternate_dns_server_2'),document.getElementById('alternate_dns_server_3'),document.getElementById('alternate_dns_server_4')))
      {
        alert_msg("You did not enter a valid IP address.");
        document.gigaset.alternate_dns_server_1.select();
        document.gigaset.alternate_dns_server_1.focus();
        return false;
      }
    }
  }


  //VLAN Tagging, from Rel8 
  if ((document.getElementById('vlan_identifier').readOnly==true) && (document.getElementById('vlan_identifier').value != vlan_identifier_old)) 
  { 
    document.getElementById('vlan_identifier').value=vlan_identifier_old;
  }
  else
  {
    if (!isIntInRange(document.getElementById('vlan_identifier'), 0, 4094)) 
    {

      showAdvanced();

      alert_msg("Invalid VLAN Identifier! (Value Range: 0 - 4094) ");
      document.getElementById('vlan_identifier').select();
      document.getElementById('vlan_identifier').focus();
      return false;
    }
  };

  if ((document.getElementById('vlan_priority').readOnly==true) && (document.getElementById('vlan_priority').value != vlan_priority_old)) 
  { 
     document.getElementById('vlan_priority').value=vlan_priority_old;
  }
  else
  {
    if (!isIntInRange(document.getElementById('vlan_priority'), 0, 7)) 
    {

      showAdvanced();

      alert_msg("Invalid VLAN priority! (Value Range: 0 - 7)");
      document.getElementById('vlan_priority').select();
      document.getElementById('vlan_priority').focus();
      return false;
    }
  };

  if
  (
    document.getElementById('network_name').value.charAt(0)=="-" ||
    document.getElementById('network_name').value.charAt(document.getElementById('network_name').value.length-1)=="-"
  )
  {

      showAdvanced();

      alert_msg("The device name must start and end with a letter or a digit.");
      document.getElementById('network_name').select();
      document.getElementById('network_name').focus();
      return false;
  }



  if(
      (ip_address_type_old!=document.gigaset.ip_address_type.value)||
      (
        (document.gigaset.ip_address_type.value==0)&&
        (
          (ip_address_1_old!=document.getElementById('ip_address_1').value)||
          (ip_address_2_old!=document.getElementById('ip_address_2').value)||
          (ip_address_3_old!=document.getElementById('ip_address_3').value)||
          (ip_address_4_old!=document.getElementById('ip_address_4').value)||
          (subnet_mask_1_old!=document.getElementById('subnet_mask_1').value)||
          (subnet_mask_2_old!=document.getElementById('subnet_mask_2').value)||
          (subnet_mask_3_old!=document.getElementById('subnet_mask_3').value)||
          (subnet_mask_4_old!=document.getElementById('subnet_mask_4').value)||
          (gateway_1_old!=document.getElementById('default_gateway_1').value)||
          (gateway_2_old!=document.getElementById('default_gateway_2').value)||
          (gateway_3_old!=document.getElementById('default_gateway_3').value)||
          (gateway_4_old!=document.getElementById('default_gateway_4').value)||
          (dns_1_1_old!=document.getElementById('preferred_dns_server_1').value)||
          (dns_1_2_old!=document.getElementById('preferred_dns_server_2').value)||
          (dns_1_3_old!=document.getElementById('preferred_dns_server_3').value)||
          (dns_1_4_old!=document.getElementById('preferred_dns_server_4').value)||
          (dns_2_1_old!=document.getElementById('alternate_dns_server_1').value)||
          (dns_2_2_old!=document.getElementById('alternate_dns_server_2').value)||
          (dns_2_3_old!=document.getElementById('alternate_dns_server_3').value)||
          (dns_2_4_old!=document.getElementById('alternate_dns_server_4').value)
        )
      )

      ||
      (network_name_old!=document.getElementById('network_name').value)

    )
  {
    alert_msg("Due to the parameter changes the device will be disconnected and this interface terminated. The device will then shut down and restart. To start the interface again, enter the new IP address in your web browser (an automatically assigned address can be found in the handset settings).");
  }


  else if
  (
    (vlan_identifier_old!=document.getElementById('vlan_identifier').value)||
    (vlan_priority_old!=document.getElementById('vlan_priority').value)||
    (vlan_enabled_old!=document.getElementById('vlan_enable').checked)
  )
  {
    alert_msg("Due to the parameter changes the device will be disconnected and this interface terminated. The device will then shut down and restart. To start the interface again, enter the new IP address in your web browser (can be found in the handset settings).");
  }

  correctTooLongUtf8String();
  return true;
}

function enable_proxy_port(state)
{
  if(state == 0)
  {
    document.getElementById('http_proxy_port').readOnly = true;

    document.getElementById('http_proxy_port').style.color = '#606060';
    document.getElementById('http_proxy_port').value = proxy_port_saved;
   

    document.getElementById('http_proxy_port').style.backgroundColor = '#DDDDDD';
  
  }
  else
  {
    document.getElementById('http_proxy_port').readOnly = false;
 

    document.getElementById('http_proxy_port').style.color = '#000000'; 
    document.getElementById('http_proxy_port').style.backgroundColor = '#FFFFFF';
  
  }
}


function enable_vlan_tagging(state)
{
 if(state == 0)
  {
    document.getElementById('vlan_identifier').readOnly = true;
    document.getElementById('vlan_priority').readOnly = true;

    document.getElementById('vlan_identifier').style.color = '#606060';
    document.getElementById('vlan_priority').style.color = '#606060';
 

  document.getElementById('vlan_identifier').style.backgroundColor = '#DDDDDD';
  document.getElementById('vlan_priority').style.backgroundColor = '#DDDDDD';
  
  }
  else
  {
    document.getElementById('vlan_identifier').readOnly = false;
    document.getElementById('vlan_priority').readOnly = false;

 

    document.getElementById('vlan_identifier').style.color = '#000000';
    document.getElementById('vlan_priority').style.color = '#000000';

    document.getElementById('vlan_identifier').style.backgroundColor = '#FFFFFF';
    document.getElementById('vlan_priority').style.backgroundColor = '#FFFFFF';
 
  }
};



function showAdvanced()
{
  document.getElementById("advbuttonshow").style.display = 'none';
  document.getElementById("advbuttonhide").style.display = 'block';
  document.getElementById("advanced").style.display = 'block';
}

function hideAdvanced()
{
  document.getElementById("advbuttonshow").style.display = 'block';
  document.getElementById("advbuttonhide").style.display = 'none';
  document.getElementById("advanced").style.display = 'none';
}


  //-->
  </script>
  <!-- additional scripts for special tasks -->
  <script language="JavaScript" type="text/javascript">
  <!--
    setTimeout('document.location.href="/logout.html";',600000);

    // IP address type - '0': static / '1': obtained automatically
    var current_ip_address_type = 1

    var clicked = false;

    function focus_gigaset_form() 
    {
      repaint_gigaset_form();
      set_visibility();

      if (current_ip_address_type == 0)
      {
        document.gigaset.ip_address_1.focus();
      }
      
      enable_vlan_tagging(0);

      store_old_values();
    }

    function submit_gigaset_form() {
      if( clicked == false)
      {
        clicked = true;
        if (!validate_gigaset_form())
        {
          clicked = false;
          return false;
        }
        document.getElementById('ip_address_1').disabled=false;
        document.getElementById('ip_address_2').disabled=false;
        document.getElementById('ip_address_3').disabled=false;
        document.getElementById('ip_address_4').disabled=false;
        document.getElementById('subnet_mask_1').disabled=false;
        document.getElementById('subnet_mask_2').disabled=false;
        document.getElementById('subnet_mask_3').disabled=false;
        document.getElementById('subnet_mask_4').disabled=false;
        document.getElementById('default_gateway_1').disabled=false;
        document.getElementById('default_gateway_2').disabled=false;
        document.getElementById('default_gateway_3').disabled=false;
        document.getElementById('default_gateway_4').disabled=false;
        document.getElementById('preferred_dns_server_1').disabled=false;
        document.getElementById('preferred_dns_server_2').disabled=false;
        document.getElementById('preferred_dns_server_3').disabled=false;
        document.getElementById('preferred_dns_server_4').disabled=false;
        document.getElementById('alternate_dns_server_1').disabled=false;
        document.getElementById('alternate_dns_server_2').disabled=false;
        document.getElementById('alternate_dns_server_3').disabled=false;
        document.getElementById('alternate_dns_server_4').disabled=false;
        clicked = false;
        document.gigaset.submit();
      }
    }

    function cancel_gigaset_form() {
      document.location.href=document.location.href;
    }
  //-->
  </script>

  <!-- external stylesheet for common elements -->

  
  <link rel="stylesheet" type="text/css" media="screen" href="styles/main.css">
  <link rel="stylesheet" type="text/css" media="screen" href="styles/siemens.css">

  <link rel="shortcut icon" href="/images/favicon.ico">
</head>
<body onLoad="focus_gigaset_form(); fixDropDownForIE8();">

  <!--  CONTAINER -->
  <div id="container">
  
    <script language="JavaScript" type="text/javascript">
      writeBlockStaticAreaTop();
      writeBlockSubmenu();
    </script>

      <!-- content -->
      <div id="content">
      <div id="minheight340"></div>
      <form name="gigaset" action="" method="post">
        <div class="contentColumn">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
            <tr>
              <td class="label"><h2 class="first">Address Assignment</h2></td>
              <td>&nbsp;</td>
            </tr>
            <tr id="tr_ip_address_type">
              <td class="label"  >IP address type:</td>
              <td class="rightSide">
                <select  name="ip_address_type" id="ip_address_type" onchange="javascript:repaint_gigaset_form();">
                <option value='0' selected="selected">Static</option><option value='1' selected="selected">Obtained automatically</option>
                </select>
              </td>
            </tr>
            <tr id="tr_ip_address">
              <td class="label" id="ip_text" >IP Address:</td>
              <td class="rightSide">
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="192" name="ip_address_1" id="ip_address_1" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="168" name="ip_address_2" id="ip_address_2" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="040" name="ip_address_3" id="ip_address_3" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="034" name="ip_address_4" id="ip_address_4" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
              </td>
            </tr>
            <tr id="tr_subnet_mask">
              <td class="label" id="subnet_mask_text">Subnet mask:</td>
              <td class="rightSide">
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="255" name="subnet_mask_1" id="subnet_mask_1" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="255" name="subnet_mask_2" id="subnet_mask_2" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="255" name="subnet_mask_3" id="subnet_mask_3" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="000" name="subnet_mask_4" id="subnet_mask_4" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
              </td>
            </tr>
            <tr id="tr_default_gateway">
              <td class="label" id="default_gateway_text">Default Gateway:</td>
              <td class="rightSide">
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="192" name="default_gateway_1" id="default_gateway_1" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="168" name="default_gateway_2" id="default_gateway_2" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="040" name="default_gateway_3" id="default_gateway_3" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="001" name="default_gateway_4" id="default_gateway_4" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
              </td>
            </tr>
            <tr id="tr_preferred_dns_server">
              <td class="label" id="preferred_dns_server_text" >Preferred DNS server:</td>
              <td class="rightSide">
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="010" name="preferred_dns_server_1" id="preferred_dns_server_1" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="001" name="preferred_dns_server_2" id="preferred_dns_server_2" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="107" name="preferred_dns_server_3" id="preferred_dns_server_3" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="051" name="preferred_dns_server_4" id="preferred_dns_server_4" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
              </td>
            </tr>
            <tr id="tr_alternate_dns_server">
              <td class="label" id="alternate_dns_server_text"  >Alternate DNS server:</td>
              <td class="rightSide">
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="010" name="alternate_dns_server_1" id="alternate_dns_server_1" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="001" name="alternate_dns_server_2" id="alternate_dns_server_2" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="107" name="alternate_dns_server_3" id="alternate_dns_server_3" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
                .
                <input  type="text" maxlength="3" size="3" class="textfield edit_32" value="052" name="alternate_dns_server_4" id="alternate_dns_server_4" onkeypress="return isNumber(event);" style="width:32px; text-align:center" >
              </td>
            </tr>
            <tr>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
            </tr>
          </table>

            <div id="advbuttonshow" style="display:block;">
              <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
                <tr>
                  <td>&nbsp;</td>
                  <td style="padding-left:1em;"><a href="#" onclick="javascript:showAdvanced(); return false;" class="buttonLink215">Show Advanced Settings</a></td>
                </tr>
                <!-- fixes the width of the first column -->
                <tr>
                  <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
                  <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
                </tr>
              </table>
            </div>
            <div id="advbuttonhide" style="display:none;">
              <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
                <tr>
                  <td>&nbsp;</td>
                  <td style="padding-left:1em;"><a href="#" onclick="javascript:hideAdvanced(); return false;" class="buttonLink215">Hide Advanced Settings</a></td>
                </tr>
                <!-- fixes the width of the first column -->
                <tr>
                  <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
                  <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
                </tr>
              </table>
            </div>
            <div id="advanced" style="display:none;">

            <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
              <tr>
                <td class="label"><h2 class="first">Remote Management</h2></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td class="label">Allow access from other networks:</td>
                <td class="rightSide"  >
                  <input  type="radio" name="foreign_sub" value="1" class="radioButton" checked="checked" >Yes
                  &nbsp;&nbsp;&nbsp;<input  type="radio" name="foreign_sub" value="0" class="radioButton" >No
                </td>
              </tr>
              <tr>
                <td class="label">&nbsp;</td>
                <td class="rightSide"  >
                  Activating this parameter increases the risk of unauthorised access to your device settings.
                </td>
              </tr>


              <!-- Device Name ad Network -->
              <tr>
                <td class="label">Device Name in the Network:</td>
                <td class="rightSide"><input  type="text" maxlength="20" size="16" class="textfield edit_250" value="N300A-IP" name="network_name" id="network_name" onkeypress="return isValidNetworkNameChar(event);" ></td>
              </tr>
              <!-- Device Name ad Network -->


              <!-- HTTP-PROXY -->
              <tr>
                <td class="label"><h2 class="first">HTTP proxy</h2></td>
                <td>&nbsp;</td>
              </tr>
               <tr>
                <td class="label">Enable proxy:</td>
                <td class="rightSide"  >
                  <input  type="radio" name="http_proxy_enable" value="1" class="radioButton" onclick="javascript:enable_proxy_port(1)" checked="checked" >Yes
                  &nbsp;&nbsp;&nbsp;<input  type="radio" name="http_proxy_enable" value="0" class="radioButton" onclick="javascript:enable_proxy_port(0)" >No
                </td>
              </tr>
              <tr>
                <td class="label">Proxy server address:</td>
          <td class="rightSide">
            <div class="edit_250">
              <input  type="text" maxlength="75" size="16" class="textfield edit_250" value="" name="http_proxy_url" id="http_proxy_url" onkeypress="return checkUTF8Bytes(this, event, 74);" >
            </div>
          </td>
              </tr>
              <tr>
                <td class="label">Proxy server port:</td>
                <td class="rightSide"><input  type="text" maxlength="5" size="5" class="textfield edit_68" value="5560" name="http_proxy_port" id="http_proxy_port" onkeypress="return isNumber(event);" style="width:68px; text-align:center" ></td>
              </tr>
              <!-- HTTP-PROXY -->

              <!-- VLAN tagging, ESz -->
              <tr>
                <td class="label"><h2 class="first">VLAN Tagging</h2></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td class="label">&nbsp;</td>
                <td class="rightSide"  >
                  You should receive the tagging values of a virtual LAN from your provider. Wrong settings will require hardware reset.
                </td>
              </tr>
               <tr>
                <td class="label">Use VLAN Tagging:</td>
                <td class="rightSide"  >
                  <input  type="radio" name="vlan_enable" id="vlan_enable" value="1" class="radioButton" onclick="return enable_vlan_tagging(1)"  >Yes
                  &nbsp;&nbsp;&nbsp;<input  type="radio" name="vlan_enable" value="0" class="radioButton" onclick="return enable_vlan_tagging(0)" checked="checked"  >No
                </td>
              </tr>
              <tr>
                <td class="label">VLAN Identifier:</td>
                <td class="rightSide"><input  type="text" maxlength="5" size="5" class="textfield edit_68" value="0" name="vlan_identifier" id="vlan_identifier" onkeypress="return isNumber(event);" style="width:68px; text-align:center" ></td>
              </tr>
              <tr>
                <td class="label">VLAN Priority:</td>
                <td class="rightSide"><input  type="text" maxlength="5" size="5" class="textfield edit_68" value="0" name="vlan_priority" id="vlan_priority" onkeypress="return isNumber(event);" style="width:68px; text-align:center" ></td>
              </tr>
              <!-- VLAN tagging, ESz -->

            <tr>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
            </tr>
          </table>
          </div>

        </div>

          
        <div id="bottombuttons">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
            <!-- buttons -->
            <tr>
              <td>&nbsp;</td>
              <td class="separatorButton">
                <table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><a href="javascript:void(0);" onclick="javascript:submit_gigaset_form(); return false;" class="buttonLink100">Set</a></td>
                    <td><a href="javascript:void(0);" onclick="javascript:cancel_gigaset_form(); return false;" class="buttonLink100">Cancel</a></td>
                  </tr>
                </table>
              </td>
            </tr>
            <!-- fixes the width of the first column -->
            <tr>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
              <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
            </tr>
          </table>
        </div>
      </form>
      <div id="endminheight"></div>
      </div>
      <!-- END of content -->

    <script language="JavaScript" type="text/javascript">
      writeBlockHelp();
      writeBlockStaticAreaBottom();
    </script>

  </div>
  <!-- END CONTAINER -->
  
</body>
</html>

The settings which are saved are:

  • Address assignment (Dropdown box)

  • Remote Management (Radio button)


The settings that arent saved/getting reverted are:

  • Http proxy (Radio button)

  • Use VLAN tagging (Radio button)


Ā 

(The device name setting keeps Ć­t default value, however I've tried to change and save that setting and it works).

Ā 

I'm using IE11 (11.0.9600.17501)

The update version number of IE is: 11.0.15

For AutoItScript, I'm using 3.3.12.0

My OS is Windows 7 Enterprise (V6.1.7601 Service pack 1) 64 bits.

Ā 

Can someone help me and tell me what I'm doing wrong?

Thanks in advance.

Ā 

Scriptonize

Ā 

post-6609-0-80774900-1422275678_thumb.pn

Edited by Scriptonize

If you learn from It, it's not a mistake

Link to comment
Share on other sites

I believe the issue isn't with the _IEAction on the Set button.

$hBtn = _IEGetObjByName($oIE,"vlan_enable",1)

This will actually select the 2nd item named "vlan_enable", because the index is zero based. So this would actually be selecting the No option instead of the Yes option.

Ā 

Hi Danp2,

That's exactly what it should do (set the radio button to "no").Ā  :shhh:

If you learn from It, it's not a mistake

Link to comment
Share on other sites

  • Moderators

Nice radio toggle function, looks like a checkbox one I just did for someone lol...

Anyway, instead of _IEAction + Set, try calling the javascript function directly with eval or execScript (don't know when Microsoft is removing execScript though).

javascript func: submit_gigaset_form()

BTW, I'm not sure what you thought that html would render in a browser, but very little shows up, had to dig through the html manually and 2700 lines is kind of ridiculous.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Nice radio toggle function, looks like a checkbox one I just did for someone lol...

Anyway, instead of _IEAction + Set, try calling the javascript function directly with eval or execScript (don't know when Microsoft is removing execScript though).

javascript func: submit_gigaset_form()

BTW, I'm not sure what you thought that html would render in a browser, but very little shows up, had to dig through the html manually and 2700 lines is kind of ridiculous.

Ā 

Hi SmOke_N

That radio toggle function is a translation of your chck box function (don't worry, I will mention you in the final script).

As for calling the javascript function submit_gigaset_form() directly: I've tried that without success.

I Apolagize for the huge HTML source code, but that's what I get when looking at the source of the rendered page.

If you learn from It, it's not a mistake

Link to comment
Share on other sites

  • Moderators

I need no mention, thanks though. Ā I had to stare at it for a second or two is all :) .

It's amazingly difficult without having 2 things you possess. Ā IE11 and an actual working page :( .

Can you tell me what happened when you did something like:

$oIE.document.parentWindow.Eval("submit_gigaset_form()")

or

$oIE.document.parentWindow.execScript("submit_gigaset_form()")

?

Edit:

I'll put up the new version of my library later today, it may help with using internal clicking or mouseclick method.

Edit2:

Your radio selection doesn't look correct at all.

Remember, these are states you are setting, passing strings is not the state you're looking for.

Also, I doubt the radio needs to have the value set, after onchange/onclick the value should be set internally.

Func _RadioToggle(ByRef $o_Radio,$bSelected = True)

    If Not IsObj($o_Radio) Then
        Return SetError(1,0,0)
    EndIf

    If $bSelected Then
        If Not $o_Radio.checked Then
            $o_Radio.checked = True
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 1
        EndIf
    Else
        If  $o_Radio.checked Then
            $o_Radio.checked = False
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 0
        EndIf
    EndIf

EndFunc

I left the returns in case you're using them for something.

Edit3:

New version of my library:Ā 

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Solution

I need no mention, thanks though. Ā I had to stare at it for a second or two is all :) .

It's amazingly difficult without having 2 things you possess. Ā IE11 and an actual working page :( .

Can you tell me what happened when you did something like:

$oIE.document.parentWindow.Eval("submit_gigaset_form()")

or

$oIE.document.parentWindow.execScript("submit_gigaset_form()")

?

Edit:

I'll put up the new version of my library later today, it may help with using internal clicking or mouseclick method.

Edit2:

Your radio selection doesn't look correct at all.

Remember, these are states you are setting, passing strings is not the state you're looking for.

Also, I doubt the radio needs to have the value set, after onchange/onclick the value should be set internally.

Func _RadioToggle(ByRef $o_Radio,$bSelected = True)

    If Not IsObj($o_Radio) Then
        Return SetError(1,0,0)
    EndIf

    If $bSelected Then
        If Not $o_Radio.checked Then
            $o_Radio.checked = True
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 1
        EndIf
    Else
        If  $o_Radio.checked Then
            $o_Radio.checked = False
            $o_Radio.fireEvent("onchange")
            $o_Radio.fireEvent("onclick")
            Return 0
        EndIf
    EndIf

EndFunc

I left the returns in case you're using them for something.

Edit3:

New version of my library:Ā 

Ā 

Many thanks SmOke_N,

You have put into the right direction.

That function was part of the problem.

A simple _IEAction("click") is more then enough for using a radio button, so I've removed the _RadioToggle Function

Now it's all working. :thumbsup:

If you learn from It, it's not a mistake

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...