﻿
/*Hide and Show Address Control depends on the same address option*/
function AddressControlShow(clientID,bShow)
{   
    //for postal
    var div1 = document.getElementById(clientID + "_div1");
    //for the rest
    var div2 = document.getElementById(clientID + "_div2");
    if (div1 && div2)
    {
        div2.style.display = div1.style.display = bShow ? "block":"none";
    }
}


/*validate chk box for checkbox control*/
function ValidateCheckBoxControl(val, args)
{
        args.IsValid = document.getElementById(val.id.replace("_cusVal","_chk")).checked;
}


/*Show and Hide Control*/
function ShowHideControl(control,isShow)
{
    if (control)
    {
        if (isShow)
        {
            control.style.display = "block";
        }
        else
        {
            control.style.display = "none";
        }
    }
}
/*Show and Hide Container*/
function ShowHideContainer(containerID,showControlID,hideControlID,isShow)
{
    var container = document.getElementById(containerID);
    var showControl = document.getElementById(showControlID);
    var hideContol = document.getElementById(hideControlID);
    
    ShowHideControl(container,isShow);
    ShowHideControl(showControl,!isShow);
    ShowHideControl(hideContol,isShow);
    
}

/*check the checkbox*/
function CheckCheckBox(controlID,isCheck)
{
    var control = document.getElementById(controlID);
    if (control)
    {
        control.checked = isCheck;
    }
}

/*Click button*/
function clickButton(e, buttonid)
{ 
              var evt = e ? e : window.event;
              var bt = document.getElementById(buttonid);
              if (bt)
              { 
                  if (evt.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
             } 
}

//Go To Login PAGE
function GoToLoginPage()
{                
    window.location = "/Login/?ReturnUrl=" + window.location.toString().replace(/;/, "@");
}

//Go To Login PAGE
function GoToLogoutPage()
{                
    window.location = "/Logout/?ReturnUrl=" + window.location.toString().replace(/;/, "@");
}

      
/*Clear Inner Text*/
function ClearInnerHTML(ctlID)
{
    var ctl = document.getElementById(ctlID);
    if (ctl)
    {
        ctl.innerHTML = "";
    }
}
