﻿// JScript File
/*
* ---------------------------------------
* VersionNo     : $Revision: 3 $
* Last User     : $Author: Sandeep.modi $
* DateTime      : $Date: 9/11/06 6:00p $
* ----------------------------------------
* Created by    : Sandeep Modi   Date Created  : 06/17/2006 12:46:47
*/

function submitOnce(obj, vg) {
    Page_ClientValidate(vg);
    if (Page_IsValid) {
        var result = WebForm_GetElementPosition(obj);
        var s = document.getElementById("onSavedisplay");
        s.style.left = result.x + "px";
        s.style.top = result.y + "px";

        s.className = "show_overlay";
        obj.className = "hiddenSaveoverlay";

        //   window.setTimeout("disableButton('" + obj.id + "')", 0);
    }
}

function searchOnce(obj) {
    var result = WebForm_GetElementPosition(obj);
    var s = document.getElementById("onSavedisplay");
    s.style.left = result.x + "px";
    s.style.top = result.y + "px";
    s.className = "show_overlay";
    obj.className = "hiddenSaveoverlay";

}
function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }

    return true;
}

function isNumberDecimalKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode == 46) {
        return true;
    }
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}
function disableButton(buttonID) {
    document.getElementById(buttonID).disabled = true;
}



function Open_Lkp_Window(varUrl) {
    //opens the lookup window

    window.open(varUrl, 'LkpWindow',
            'toolbar=no, height=300, width=765, resizable=yes, status=no, titlebar=no, menubar=no, scrollbars=no, directories=no');

    return false;
}

function Code2beRemovedForOpenWindowAdmin(varUrl) {
    window.open(varUrl, 'LkpWindowA',
            'toolbar=no, width=700, height=400, resizable=yes, status=no, scrollbars=no, titlebar=no, menubar=no, directories=no');
    return false;
}

function Close_Lkp_Window() {
    //closes the lookup Window
    window.close();
}


//function to open the lookup window with width and height specified
function Open_Window_WH(varUrl, varWidth, varHeight) {

    var myWindow = window.open(varUrl, 'LkpWindow',
            'toolbar=no, width=' + varWidth + ',  height=' + varHeight + ', resizable=yes, status=no, scrollbars=no, titlebar=no, menubar=no, directories=no');

    myWindow.resizeTo(varWidth, varHeight);

    return false;
}

function AutoSelectLookupValue() {
    var LkpRadio = document.forms[0].Lkp_HTML_Radio;
    LkpRadio.checked = true;
    Check_Send_FKvalues();

}
function ResizeLkpWindow() {
    self.resizeTo(850, 400);


}
/*********************************************************************/


// This is a method to move items from one (ListBox i.e Select) to other.
function moveOptions(theSelFrom, theSelTo) {

    var selLength = theSelFrom.length;
    var selectedText = new Array();
    var selectedValues = new Array();
    var selectedCount = 0;

    var i;

    // Find the selected Options in reverse order
    // and delete them from the 'from' Select.
    for (i = selLength - 1; i >= 0; i--) {
        if (theSelFrom.options[i].selected) {
            selectedText[selectedCount] = theSelFrom.options[i].text;
            selectedValues[selectedCount] = theSelFrom.options[i].value;
            deleteOption(theSelFrom, i);
            selectedCount++;
        }
    }

    // Add the selected text/values in reverse order.
    // This will add the Options to the 'to' Select
    // in the same order as they were in the 'from' Select.
    for (i = selectedCount - 1; i >= 0; i--) {
        addOption(theSelTo, selectedText[i], selectedValues[i]);
    }
    return false;
}

//pass listbox, text , value
function addOption(theSel, theText, theValue) {
    var newOpt = new Option(theText, theValue);

    var selLength = theSel.length;

    theSel.options[selLength] = newOpt;

}


function deleteOption(theSel, theIndex) {
    var selLength = theSel.length;
    if (selLength > 0) {
        theSel.options[theIndex] = null;
    }
}

// move to focus to next element.
function doNext(el) {

    var f = el.form;
    var els = f.elements;
    var x, nextEl;
    for (var i = 0, len = els.length; i < len; i++) {
        x = els[i];
        if (el == x && (nextEl = els[i + 1])) {
            if (nextEl.focus) nextEl.focus();
        }
    }
}

//This Function trims String i.e remove starting and ending blank spaces
function trimString(str) {
    str = this != window ? this : str;
    return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function chkNumericForTask(strForTest, lblText) {
    // only allow 0-9 be entered, plus any values passed
    // (can be in any order, and don't have to be comma, period, or hyphen)
    // if all numbers allow commas, periods, hyphens or whatever,
    // just hard code it here and take out the passed parameters

    var strStartEndPoint = ""; //variable to store collection of Starting and Ending Point
    var strDuration = ""; //variable to store collection of Duration

    var strErrorCollection = ""; //variable to store Error Collection
    var checkOK = "0123456789,.-"; //variable having all the correct value
    var arrControlId = new Array(); //Array to hold all the controls id
    arrControlId = strForTest.split('µ'); //split the received string and get all id's into an array
    var arrTaskCode = new Array(arrControlId.length - 1); //Array to Store Task Code

    for (p = 0, t = 0; p <= arrControlId.length - 1; p++)//Loop to check each Control of Array
    {
        if (arrControlId[p] != "") {
            var strClientId = arrControlId[p]; //Store Client Id into a string
            var arrSplitId = strClientId.split('_'); //Split Client Id to get Control Name
            var strFieldName = arrSplitId[arrSplitId.length - 1].substring(3); //Fetch Field Name

            var allValid = true; //Boolean variable to set true or false by checking all the condition
            var allNum = ""; //Variable to check all the numeric value or not
            var strTxtValue = ""; //Variable to hold the current Control's value

            //if field name is TaskCode,then strore it into an array and 
            //in other cases store it into a local variable strTxtValue

            if (strFieldName == "TaskCode") {
                if (arrSplitId[arrSplitId.length - 1].substring(0, 3) == "lbl") {
                    //get the label value into array
                    arrTaskCode[t] = document.getElementById(strClientId).innerText;
                }
                else {
                    //get the text value into array
                    arrTaskCode[t] = document.getElementById(strClientId).value;
                }
                t++;
            }
            else {
                strTxtValue = document.getElementById(strClientId).value;
            } //End Of if(strFieldName == "TaskCode")

            //loop to check the current value character by character
            var CheckInteger = true;
            for (i = 0; i < strTxtValue.length; i++) {
                //get current index character for string
                ch = strTxtValue.charAt(i);
                //Check this character to all the valid character,ig got invalid then break and go to next step
                for (j = 0; j < checkOK.length; j++)
                    if (ch == checkOK.charAt(j))
                    break;
                //if counter equals to chackOK ,then break                            
                if (j == checkOK.length) {
                    allValid = false;
                    break;
                }
                //Check for .
                if (ch == ".") {
                    CheckInteger = false;
                    break;
                }
                //Check for ,
                if (ch != ",")
                    allNum += ch;


            } //End Of for (i = 0;  i < strTxtValue.length;  i++)

            //Check for valid value,if dont have valid value,set the errorMessage and go to next step.
            if (!allValid) {
                if (strErrorCollection == "") {
                    strErrorCollection = arrTaskCode[t - 1] + " : Please enter only numeric values " + " in \"" + strFieldName + "\"";
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + arrTaskCode[t - 1] + " : Please enter only numeric values " + "\" in \"" + strFieldName + "\"";
                }
            } //End of if (!allValid)

            if (!CheckInteger) {
                if (strErrorCollection == "") {
                    strErrorCollection = arrTaskCode[t - 1] + " : Please enter only Integer values " + " in \"" + strFieldName + "\"";
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + arrTaskCode[t - 1] + " : Please enter only Integer values " + "\" in \"" + strFieldName + "\"";
                }
            }

            //If FieldName is StartingPoint or EndingPoint,then store it into strStartEndPoint string
            //If FieldName is StartingPoint or EndingPoint,then store it into strStartEndPoint string         
            if (strFieldName == "StartingPoint") {
                if (strStartEndPoint == "") {
                    strStartEndPoint = strTxtValue;
                }
                else {
                    strStartEndPoint = strStartEndPoint + "," + strTxtValue;
                }
            }
            else if (strFieldName == "EndingPoint") {
                strStartEndPoint = strStartEndPoint + "," + strTxtValue
            } //End of if(strFieldName == "StartingPoint")
            else if (strFieldName == "Duration") {
                if (strDuration == "") {
                    if (strTxtValue == "") {
                        strDuration = ",";
                    }
                    else {
                        strDuration = strTxtValue;
                    }
                }
                else {
                    if (strDuration == ",") {
                        strDuration = strDuration + strTxtValue;
                    }
                    else {
                        strDuration = strDuration + "," + strTxtValue;
                    }
                }
            }
        } //End of if(arrControlId[p] != "" )
    } //End of for(p=0,t=0;p<=arrControlId.length-1 ;p++)

    if (strDuration != '') {
        arrDuration = strDuration.split(',');
        var lenOfArrDuration = arrDuration.length;
        for (valCntr = 0, taskCntr = 0; valCntr < lenOfArrDuration; valCntr++, taskCntr++) {
            if (arrDuration[valCntr] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Duration ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }
        }
    }
    else {
        strErrorCollection = arrTaskCode[0] + " : Please Enter the Duration ";
        document.getElementById(lblText).innerText = strErrorCollection;
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "showDiv";
        return false;
    }

    //Check for ErrorCoolection,if exist the return from here only        
    if (strErrorCollection != '') {
        document.getElementById(lblText).innerText = strErrorCollection; //set the label value
        currentElem = document.getElementById('divNumericError'); //find div.
        currentElem.className = "showDiv"; //visibility true
        return (false);
    }

    //if Error not found yet,then go to next step to check on StartPoint and EndPoint
    if (strStartEndPoint != '') {
        //Split String and get and array,which contain StartPoint at even index and EndPoint and Odd index
        arrStartEndPoint = strStartEndPoint.split(',');
        //get the length of an array
        var lenOfArr = arrStartEndPoint.length;
        //Run a loop on Start Point Only which is available on even index only
        //Take another parameter to set taskCode value
        for (valCntr = 0, taskCntr = 0; valCntr < lenOfArr; valCntr = valCntr + 2, taskCntr++) {
            //get the typecast for numeric value to perform numeric task
            var x = Number(arrStartEndPoint[valCntr]);
            var y = Number(arrStartEndPoint[valCntr + 1]);
            var z = Number(arrStartEndPoint[valCntr + 2]);
            if (arrStartEndPoint[valCntr] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Starting Point ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

            if (arrStartEndPoint[valCntr] < 1) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Starting Point Greater than Zero ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;

            }

            if (arrStartEndPoint[valCntr + 1] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Ending Point ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

            if (arrStartEndPoint[valCntr + 1] < 1) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Ending Point Greater than Zero ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }




            //check for StartPoint and EndPoint for same record
            if (valCntr < lenOfArr - 1 && x > y) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Starting Point should less than Ending Point";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

            //check for StartPoint and StartPoint for simetanously record
            if (valCntr < lenOfArr - 2 && x > z) {
                strErrorCollection = arrTaskCode[taskCntr + 1] + " : Starting Point should be in increasing mode";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }
        } //End Of for
    } //End of if(strStartEndPoint != '')


    //if reach here,means no error found and do the next operation
    if (strErrorCollection == '') {
        document.getElementById(lblText).innerText = '';
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "hideDiv";
        return (true);
    } //End of if(strErrorCollection == '')

}
//End of FUNCTION chkNumericForTask(strForTest,lblText)




function chkNumericForEditTask(strForTest, lblText) {
    // only allow 0-9 be entered, plus any values passed
    // (can be in any order, and don't have to be comma, period, or hyphen)
    // if all numbers allow commas, periods, hyphens or whatever,
    // just hard code it here and take out the passed parameters

    var strStartEndPoint = ""; //variable to store collection of Starting and Ending Point
    var strDuration = ""; //variable to store collection of Duration

    var strErrorCollection = ""; //variable to store Error Collection
    var checkOK = "0123456789,.-"; //variable having all the correct value
    var arrControlId = new Array(); //Array to hold all the controls id
    arrControlId = strForTest.split('µ'); //split the received string and get all id's into an array
    var arrTaskCode = new Array(arrControlId.length - 1); //Array to Store Task Code

    for (p = 0, t = 0; p <= arrControlId.length - 1; p++)//Loop to check each Control of Array
    {
        if (arrControlId[p] != "") {
            var strClientId = arrControlId[p]; //Store Client Id into a string
            var arrSplitId = strClientId.split('_'); //Split Client Id to get Control Name
            var strFieldName = arrSplitId[arrSplitId.length - 1].substring(3); //Fetch Field Name

            var allValid = true; //Boolean variable to set true or false by checking all the condition
            var allNum = ""; //Variable to check all the numeric value or not
            var strTxtValue = ""; //Variable to hold the current Control's value

            //if field name is TaskCode,then strore it into an array and 
            //in other cases store it into a local variable strTxtValue

            if (strFieldName == "TaskCode") {
                if (arrSplitId[arrSplitId.length - 1].substring(0, 3) == "lbl") {
                    //get the label value into array
                    arrTaskCode[t] = document.getElementById(strClientId).innerText;
                }
                else {
                    //get the text value into array
                    arrTaskCode[t] = document.getElementById(strClientId).value;
                }
                t++;
            }
            else {
                strTxtValue = document.getElementById(strClientId).value;
            } //End Of if(strFieldName == "TaskCode")

            //loop to check the current value character by character
            var CheckInteger = true;
            for (i = 0; i < strTxtValue.length; i++) {
                //get current index character for string
                ch = strTxtValue.charAt(i);
                //Check this character to all the valid character,ig got invalid then break and go to next step
                for (j = 0; j < checkOK.length; j++)
                    if (ch == checkOK.charAt(j))
                    break;
                //if counter equals to chackOK ,then break                            
                if (j == checkOK.length) {
                    allValid = false;
                    break;
                }
                //Check for .
                if (ch == ".") {
                    CheckInteger = false;
                    break;
                }
                //Check for ,
                if (ch != ",")
                    allNum += ch;
            } //End Of for (i = 0;  i < strTxtValue.length;  i++)

            //Check for valid value,if dont have valid value,set the errorMessage and go to next step.
            if (!allValid) {
                if (strErrorCollection == "") {
                    strErrorCollection = arrTaskCode[t - 1] + " : Please enter only numeric values " + " in \"" + strFieldName + "\"";
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + arrTaskCode[t - 1] + " : Please enter only numeric values " + "\" in \"" + strFieldName + "\"";
                }
            } //End of if (!allValid)
            if (!CheckInteger) {
                if (strErrorCollection == "") {
                    strErrorCollection = arrTaskCode[t - 1] + " : Please enter only Integer values " + " in \"" + strFieldName + "\"";
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + arrTaskCode[t - 1] + " : Please enter only Integer values " + "\" in \"" + strFieldName + "\"";
                }
            }

            //If FieldName is StartingPoint or EndingPoint,then store it into strStartEndPoint string
            //If FieldName is StartingPoint or EndingPoint,then store it into strStartEndPoint string         
            if (strFieldName == "StartingPoint") {
                if (strStartEndPoint == "") {
                    strStartEndPoint = strTxtValue;
                }
                else {
                    strStartEndPoint = strStartEndPoint + "," + strTxtValue;
                }
            }
            else if (strFieldName == "EndingPoint") {
                strStartEndPoint = strStartEndPoint + "," + strTxtValue
            } //End of if(strFieldName == "StartingPoint")
            else if (strFieldName == "Duration") {
                if (strDuration == "") {
                    if (strTxtValue == "") {
                        strDuration = ",";
                    }
                    else {
                        strDuration = strTxtValue;
                    }
                }
                else {
                    if (strDuration == ",") {
                        strDuration = strDuration + strTxtValue;
                    }
                    else {
                        strDuration = strDuration + "," + strTxtValue;
                    }
                }
            }
        } //End of if(arrControlId[p] != "" )
    } //End of for(p=0,t=0;p<=arrControlId.length-1 ;p++)

    if (strDuration != '') {
        arrDuration = strDuration.split(',');
        var lenOfArrDuration = arrDuration.length;
        for (valCntr = 0, taskCntr = 0; valCntr < lenOfArrDuration; valCntr++, taskCntr++) {
            if (arrDuration[valCntr] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Duration ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }
        }
    }
    else {
        strErrorCollection = arrTaskCode[0] + " : Please Enter the Duration ";
        document.getElementById(lblText).innerText = strErrorCollection;
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "showDiv";
        return false;
    }

    //Check for ErrorCoolection,if exist the return from here only        
    if (strErrorCollection != '') {
        document.getElementById(lblText).innerText = strErrorCollection; //set the label value
        currentElem = document.getElementById('divNumericError'); //find div.
        currentElem.className = "showDiv"; //visibility true
        return (false);
    }

    //if Error not found yet,then go to next step to check on StartPoint and EndPoint
    if (strStartEndPoint != '') {
        //Split String and get and array,which contain StartPoint at even index and EndPoint and Odd index
        arrStartEndPoint = strStartEndPoint.split(',');
        //get the length of an array
        var lenOfArr = arrStartEndPoint.length;
        //Run a loop on Start Point Only which is available on even index only
        //Take another parameter to set taskCode value
        for (valCntr = 0, taskCntr = 0; valCntr < lenOfArr; valCntr = valCntr + 2, taskCntr++) {
            //get the typecast for numeric value to perform numeric task
            var x = Number(arrStartEndPoint[valCntr]);
            var y = Number(arrStartEndPoint[valCntr + 1]);
            var z = Number(arrStartEndPoint[valCntr + 2]);
            if (arrStartEndPoint[valCntr] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Starting Point ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

            if (arrStartEndPoint[valCntr] < 1) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Starting Point Greater than Zero ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;

            }

            if (arrStartEndPoint[valCntr + 1] == "") {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Ending Point ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

            if (arrStartEndPoint[valCntr + 1] < 1) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Please Enter the Ending Point Greater than Zero ";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }




            //check for StartPoint and EndPoint for same record
            if (valCntr < lenOfArr - 1 && x > y) {
                strErrorCollection = arrTaskCode[taskCntr] + " : Starting Point should less than Ending Point";
                document.getElementById(lblText).innerText = strErrorCollection;
                currentElem = document.getElementById('divNumericError');
                currentElem.className = "showDiv";
                return false;
            }

        } //End Of for
    } //End of if(strStartEndPoint != '')


    //if reach here,means no error found and do the next operation
    if (strErrorCollection == '') {
        document.getElementById(lblText).innerText = '';
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "hideDiv";
        return (true);
    } //End of if(strErrorCollection == '')

}
//End of FUNCTION chkNumericForTask(strForTest,lblText)





























//Function to check for numeric data only   
function chkNumeric(strForTest, lblText) {
    // only allow 0-9 be entered, plus any values passed
    // (can be in any order, and don't have to be comma, period, or hyphen)
    // if all numbers allow commas, periods, hyphens or whatever,
    // just hard code it here and take out the passed parameters

    var strErrorCollection = ""; //variable to store Error Collection
    var checkOK = "0123456789,.-"; //variable having all the correct value
    var arrControlId = new Array(); //Array to hold all the controls id
    arrControlId = strForTest.split('µ'); //split the received string and get all id's into an array

    for (p = 0, t = 0; p <= arrControlId.length - 1; p++)//Loop to check each Control of Array
    {
        if (arrControlId[p] != "") {
            var strClientId = arrControlId[p]; //Store Client Id into a string
            var arrSplitId = strClientId.split('_'); //Split Client Id to get Control Name
            var strFieldName = arrSplitId[arrSplitId.length - 1].substring(3); //Fetch Field Name

            var allValid = true; //Boolean variable to set true or false by checking all the condition
            var allNum = ""; //Variable to check all the numeric value or not
            var strTxtValue = ""; //Variable to hold the current Control's value

            strTxtValue = document.getElementById(strClientId).value;

            //loop to check the current value character by character
            for (i = 0; i < strTxtValue.length; i++) {
                //get current index character for string
                ch = strTxtValue.charAt(i);
                //Check this character to all the valid character,ig got invalid then break and go to next step
                for (j = 0; j < checkOK.length; j++)
                    if (ch == checkOK.charAt(j))
                    break;
                //if counter equals to chackOK ,then break                            
                if (j == checkOK.length) {
                    allValid = false;
                    break;
                }
                //Check for ,
                if (ch != ",")
                    allNum += ch;
            }

            //Check for valid value,if dont have valid value,set the errorMessage and go to next step.
            if (!allValid) {
                if (strErrorCollection == "") {
                    strErrorCollection = " Please enter only numeric values in " + strFieldName;
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + " : Please enter only numeric values in " + strFieldName;
                }
            }
        } //End of if(arrControlId[p] != "" )
    } //End of for(p=0,t=0;p<=arrControlId.length-1 ;p++)

    //Check for ErrorCoolection,if exist the return from here only        
    if (strErrorCollection != '') {
        document.getElementById(lblText).innerText = strErrorCollection; //set the label value
        currentElem = document.getElementById('divNumericError'); //find div.
        currentElem.className = "showDiv"; //visibility true
        return (false);
    }
    //if reach here,means no error found and do the next operation
    if (strErrorCollection == '') {
        document.getElementById(lblText).innerText = '';
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "hideDiv";
        return (true);
    }
}

function chkForBlank(strForTest, lblText) {
    var strErrorCollection = ""; //variable to store Error Collection
    var arrControlId = new Array(); //Array to hold all the controls id
    arrControlId = strForTest.split('µ'); //split the received string and get all id's into an array

    for (p = 0, t = 0; p <= arrControlId.length - 1; p++)//Loop to check each Control of Array
    {
        if (arrControlId[p] != "") {
            var strClientId = arrControlId[p]; //Store Client Id into a string
            var arrSplitId = strClientId.split('_'); //Split Client Id to get Control Name
            var strFieldName = arrSplitId[arrSplitId.length - 1].substring(3); //Fetch Field Name

            var allValid = true; //Boolean variable to set true or false by checking all the condition
            var strTxtValue = ""; //Variable to hold the current Control's value

            strTxtValue = document.getElementById(strClientId).value;

            if (strTxtValue == "") {
                if (strErrorCollection == "") {
                    strErrorCollection = " Please Enter any value in " + strFieldName;
                }
                else {
                    strErrorCollection = strErrorCollection + "\n" + " Please Enter any value in " + strFieldName;
                }
            }

        } //End of if(arrControlId[p] != "" )

    } //End of for(p=0,t=0;p<=arrControlId.length-1 ;p++)

    //Check for ErrorCoolection,if exist the return from here only        
    if (strErrorCollection != '') {
        document.getElementById(lblText).innerText = strErrorCollection; //set the label value
        currentElem = document.getElementById('divNumericError'); //find div.
        currentElem.className = "showDiv"; //visibility true
        return (false);
    }
    //if reach here,means no error found and do the next operation
    if (strErrorCollection == '') {
        document.getElementById(lblText).innerText = '';
        currentElem = document.getElementById('divNumericError');
        currentElem.className = "hideDiv";
        return Page_ClientValidate(); //This function is already declared by ASP.NET and calls here.
    }

} //End of Function
