// JScript File

function OnLoad()
{
    if(document.getElementById("radio-IPAddress").checked==true)
    {
        IPcheck();
    }
    else if(document.getElementById("radio-HostName").checked)
    {
        HostNamecheck();
    }
    else if(document.getElementById("radio-MAC").checked)
    {
        MACcheck();
    }
}


function IPcheck()
{
    document.getElementById("textbox-IPAddress").disabled = false;
    document.getElementById("textbox-HostName").disabled = true;
    document.getElementById("textbox-MAC").disabled = true;

    document.getElementById("textbox-IPAddress").style.background = 'WHITE';
    document.getElementById("textbox-HostName").style.background = 'LIGHTGREY';
    document.getElementById("textbox-MAC").style.background = 'LIGHTGREY';

    if(document.getElementById("textbox-HostName").value == "" ||
       document.getElementById("textbox-MAC").value == "")
    {
        document.getElementById("textbox-HostName").value = "";
        document.getElementById("textbox-MAC").value = "";
    }
    if(document.getElementById("textbox-IPAddress").value=="")
        document.getElementById("ButtonNext").disabled="disabled";

    document.getElementById("textbox-IPAddress").focus();
}

function HostNamecheck()
{
    document.getElementById("textbox-IPAddress").disabled = true;
    document.getElementById("textbox-HostName").disabled = false;
    document.getElementById("textbox-MAC").disabled = true;

    document.getElementById("textbox-IPAddress").style.background = 'LIGHTGREY';
    document.getElementById("textbox-HostName").style.background = 'WHITE';
    document.getElementById("textbox-MAC").style.background = 'LIGHTGREY';

    if(document.getElementById("textbox-IPAddress").value == "" ||
       document.getElementById("textbox-MAC").value == "")
    {
        document.getElementById("textbox-IPAddress").value = "";
        document.getElementById("textbox-MAC").value = "";
    }
    if(document.getElementById("textbox-HostName").value=="")
        document.getElementById("ButtonNext").disabled="disabled";

    document.getElementById("textbox-HostName").focus();
}

function MACcheck()
{
    document.getElementById("textbox-IPAddress").disabled = true;
    document.getElementById("textbox-HostName").disabled = true;
    document.getElementById("textbox-MAC").disabled = false;

    document.getElementById("textbox-IPAddress").style.background = 'LIGHTGREY';
    document.getElementById("textbox-HostName").style.background = 'LIGHTGREY';
    document.getElementById("textbox-MAC").style.background = 'WHITE';

    if(document.getElementById("textbox-IPAddress").value == "" || 
       document.getElementById("textbox-HostName").value == "")
    {
        document.getElementById("textbox-IPAddress").value = "";
        document.getElementById("textbox-HostName").value = "";
    }
    if(document.getElementById("textbox-MAC").value=="")
        document.getElementById("ButtonNext").disabled="disabled";

    document.getElementById("textbox-MAC").focus();
}

function NextButtonState()
{
        if((document.getElementById("textbox-IPAddress").value == "")&&
        (document.getElementById("textbox-HostName").value == "")&&
        (document.getElementById("textbox-MAC").value == ""))
        {
            document.getElementById("ButtonNext").disabled="disabled";
        }
        else
        {
            document.getElementById("ButtonNext").disabled="";
        }
}

//Defect fix for LSG00219790
function whichButton(event)
{
     if((event.srcElement.id != "ButtonBack") &&
        (event.srcElement.id != "ButtonCancel") &&
        (event.srcElement.id != "Link-NetworkDiscovery") &&
        (event.srcElement.id != "Link-HelpIP"))
     {
       if(event.keyCode==13 &&( (document.getElementById("textbox-IPAddress").value != "")||
        (document.getElementById("textbox-HostName").value != "")||
        (document.getElementById("textbox-MAC").value != "")))
       {
        document.getElementById("ButtonNext").focus();
        return true;
        }
     }

   // To enable click for the network discovery link
   if(event.srcElement.id == "Link-NetworkDiscovery" && event.keyCode == 13)
   {
           document.getElementById("Link-NetworkDiscovery").click();
           return false;
   }
}



