﻿// JScript File

        function detectJavaScript()
        {
            if( document.all )
                document.all["JSEnabled"].value = "True";
            else if( document.getElementById )
                document.getElementById("JSEnabled").value = "True";
        }
        function onLoad()
        {
            detectJavaScript();
        }

        function clearTextBox(x)
        {
            if( x.value == "please specify..." )
                x.value="";
        }
        function validatePolicyCheck(source, args)
        {
            var var1 = document.all ? document.all["checkAgreePolicy"] : document.getElementById("checkAgreePolicy");
            args.IsValid = var1.checked;
        }
        function validateNewHall(source, args)
        {
            var varName = document.all ? document.all["txtNewHallName"] : document.getElementById("txtNewHallName");     
            var varAddress1 = document.all ? document.all["txtNewHallAddress1"] : document.getElementById("txtNewHallAddress1");     
            var varCity = document.all ? document.all["txtNewHallCity"] : document.getElementById("txtNewHallCity");     
            var varPostcode = document.all ? document.all["txtNewHallPostcode"] : document.getElementById("txtNewHallPostcode");     
            args.IsValid = (varName.value != "") && (varAddress1.value != "") && (varCity.value != "") && (varPostcode.value != "");
        }
        function validateAddress(source, args)
        {
            var varAddress1 = document.all ? document.all["txtDemogAddress1"] : document.getElementById("txtDemogAddress1");     
            var varCity = document.all ? document.all["txtDemogAddressCity"] : document.getElementById("txtDemogAddressCity");     
            var varPostcode = document.all ? document.all["txtDemogAddressPostcodeReturned"] : document.getElementById("txtDemogAddressPostcodeReturned");     
            args.IsValid = (varAddress1.value != "") && (varCity.value != "") && (varPostcode.value != "");
        }
        function OpenHelp(URL,name,w,h)
        {
            config = "menubar=no,scrollbars=yes,status=no,toolbar=no,directories=no, width=" + w +", height=" + h + ", resizable=yes"
            window.open(URL, name, config)
        }
        function selectRadio(rbtn)
        {
            document.getElementById(rbtn).checked=true;
        }

        function highlightControl(ctrl)
        {
            ctrl.style.backgroundColor = '#F0E68C';
        }
        function unhighlightControl(ctrl)
        {
            ctrl.style.backgroundColor = '';
        }
        
        function highlightIfChecked(chkbx, lbl)
        {
            if( document.getElementById(chkbx).checked )
                document.getElementById(lbl).style.backgroundColor = '#F0E68C';
            else
                document.getElementById(lbl).style.backgroundColor = '';            
        }
        
        function highlightRadioCellInGrid(tblId)
        {
            allInputs = document.getElementById(tblId).getElementsByTagName('INPUT');
            // loop through all child inputs
             for (i=0;i<allInputs.length;i++)
             {
              nownode=allInputs[i];
              // if the node is an element and an IMG set the variable and exit the loop
              if(nownode.type=='radio')
              {
                if(nownode.checked)
                {
                    highlightControl(nownode.parentNode);
                }
                else
                {
                    unhighlightControl(nownode.parentNode);
                }
              }
             }            
        }
