﻿ var previousRow;
        
function ChangeRowColor(row)
{
    //If last clicked row and the current clicked row are same
    if(row !=null)
    {
        if (previousRow == row)
            return;//do nothing
        //If there is row clicked earlier
        else if (previousRow != null)
            //change the color of the previous row back to white
            document.getElementById(previousRow).style.backgroundColor = "#ffffff";
        
        //change the color of the current row to light yellow

        //document.getElementById(row).style.backgroundColor = "#ffffda";      
         document.getElementById(row).style.backgroundColor = "#e3f87b";               
        //assign the current row id to the previous row id 
        //for next row to be clicked
        previousRow = row;
    }
}
function fixform() 
{
    if (opener.document.getElementById("aspnetForm").target != "_blank")
        return; opener.document.getElementById("aspnetForm").target = "";
    opener.document.getElementById("aspnetForm").action = opener.location.href;
}

function hideMenu() {
    document.getElementById('divReports').style.display = 'none';

}

        function ValidateSearch(source, arguments) {

            arguments.IsValid = false;

            var e1 = document.getElementById("ctl00_BodyContent_txtBusinessName");
            var e2 = document.getElementById("ctl00_BodyContent_txtBusinessType");
            var Value1 = e1.value;
            var Value2 = e2.value;

            if (Value1 != '' || Value2 != '') {
                arguments.IsValid = true;
            }

        }
        function ValidateBusinessNameSearchLength(source, arguments) {
            var e1 = document.getElementById("ctl00_BodyContent_txtBusinessName");
            var Value1 = e1.value;
            if (Value1 != '') {
                if (Value1.length <= 1) {
                    arguments.IsValid = false;
                }
                else {
                    arguments.IsValid = true;
                }
            }
            else {
                arguments.IsValid = true;
            }
        }
        function ValidateBusinessTypeSearchLength(source, arguments) {
            var e1 = document.getElementById("ctl00_BodyContent_txtBusinessType");
            var Value1 = e1.value;
            if (Value1 != '') {
                if (Value1.length <= 1) {
                    arguments.IsValid = false;
                }
                else {
                    arguments.IsValid = true;
                }
            }
            else {
                arguments.IsValid = true;
            }
        }
        var count = 0;
        var removed = 0;
        function SplitbyHyphn() {
            //alert('fgdfg');
            count = count + 1;
            if (count == 1) {
                //alert(count);
                var txtbizval = document.getElementById("ctl00_BodyContent_txtBusinessName").value;
                var lastindex = txtbizval.lastIndexOf('-');
                if (lastindex != -1) {
                    //alert('fgfg');
                    //alert(txtbizval.substring(0,lastindex));
                    //var valforsplit=txtbizval.split("-");
                    valaforsplit = txtbizval.substring(0, lastindex);
                    document.getElementById("ctl00_BodyContent_txtBusinessName").value = valaforsplit;
                    document.getElementById("ctl00_BodyContent_txtBusinessType").focus();

                }
                count = 0;

            }
        }
