﻿function fncInputDateOnly() {

    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }

    if (!(iKeyCode == 45 || iKeyCode == 47 || iKeyCode == 48 || iKeyCode == 49 || iKeyCode == 50 || iKeyCode == 51 || iKeyCode == 52 || iKeyCode == 53 || iKeyCode == 54 || iKeyCode == 55 || iKeyCode == 56 || iKeyCode == 57)) {
        event.returnValue = false;
    }
}
function hasUpperCaseCharacter(password) {
    return password.match("[A-Z]") != null;
}

function hasLowerCaseCharacter(password) {
    return password.match("[a-z]") != null;
}

function hasNumericCharacter(password) {
    return password.match("[0-9]") != null;
}

function hasSpecialCharacter(password) {
    return password.match("[!@#$%^&*()><~?;:'\"()/,]") != null;
}

function checkPassword(varFieldName) {
    ////alert ("Check Password: " + varFieldName);
    var password = document.getElementById(varFieldName).value;
    if (document.getElementById(varFieldName).readOnly == false) {

        if (password.length > 0) {
            var valid = password.length >= 8 && hasUpperCaseCharacter(password) && hasLowerCaseCharacter(password) && hasNumericCharacter(password) && hasSpecialCharacter(password);
            ////alert(valid);
            ////alert(password.length >= 8 + ' ' + hasUpperCaseCharacter(password) + ' ' + hasLowerCaseCharacter(password) + ' ' + hasNumericCharacter(password) + ' ' + hasSpecialCharacter(password));
            if (!valid) {
                alert("Yezzle: Password must be at least 8 characters and must contain an upper case character, a lower case character and a numeric character, Password also must not be one of your last Five password.");
                document.getElementById(varFieldName).focus();
                document.getElementById(varFieldName).select();
            }
        }

        return valid;
    }
}

function fncInputNumericValuesWithOneDecimalOnly(varFieldName) {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    if (!(iKeyCode == 46 || iKeyCode == 48 || iKeyCode == 49 || iKeyCode == 50 || iKeyCode == 51 || iKeyCode == 52 || iKeyCode == 53 || iKeyCode == 54 || iKeyCode == 55 || iKeyCode == 56 || iKeyCode == 57)) {
        event.returnValue = false;
    }
    else {
        if (iKeyCode == 46) {
            if (document.getElementById(varFieldName).value.indexOf(".") >= 0)
                event.returnValue = false;
        }
    }
}
function fncInputNumericValuesWithTwoDecimalOnly(varFieldName, precision) {
    //alert(document.getElementById(varFieldName).value.length);
    //alert(document.getElementById(varFieldName).maxLength);
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    if (!(iKeyCode == 46 || iKeyCode == 48 || iKeyCode == 49 || iKeyCode == 50 || iKeyCode == 51 || iKeyCode == 52 || iKeyCode == 53 || iKeyCode == 54 || iKeyCode == 55 || iKeyCode == 56 || iKeyCode == 57)) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    else {
        if (iKeyCode == 46) {
            if (document.getElementById(varFieldName).value.indexOf(".") >= 0) {
                event.returnValue = false;
                event.cancelBubble = true;
                return false;
            }
        }
    }

    if (document.getElementById(varFieldName).value > 100) {                
        return false;
    }
    var decimalIndex = document.getElementById(varFieldName).value.indexOf(".");
    if (decimalIndex >= 0) {
        if ((document.getElementById(varFieldName).value.length - decimalIndex) > parseInt(precision)) {            
            return false;
        }
    }
}


function fncInputDecimalOnly9(varFieldName, precision)
 {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    
    if (!(iKeyCode == 46 || iKeyCode == 48 || iKeyCode == 49 || event.keyCode == 50 || iKeyCode == 51 || iKeyCode == 52 || iKeyCode == 53 || iKeyCode == 54 || iKeyCode == 55 || iKeyCode == 56 || iKeyCode == 57)) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    else {
        if (document.getElementById(varFieldName).value.length < 6) {
            if (document.getElementById(varFieldName).value.search(".") != -1)
            { }
        }
        else if (document.getElementById(varFieldName).value.length > 6) {
            if (document.getElementById(varFieldName).value.indexOf(".") > 0 && document.getElementById(varFieldName).value.indexOf(".") < 7)
            { }
            else if (document.getElementById(varFieldName).value.search(".") == 0) {
                if (iKeyCode != 46 && document.getElementById(varFieldName).value.length == 7) {
                    event.returnValue = false;
                    event.cancelBubble = true;
                    return false;
                }
                else
                    event.returnValue = true;
            }
        }
        if (iKeyCode == 46) {
            if (document.getElementById(varFieldName).value.indexOf(".") >= 0) {
                event.returnValue = false;
                event.cancelBubble = true;
                return false;
            }
        }
    }
    var decimalIndex = document.getElementById(varFieldName).value.indexOf(".");
    if (decimalIndex >= 0) {
        if ((document.getElementById(varFieldName).value.length - decimalIndex) > parseInt(precision)) {
            event.returnValue = false;
            event.cancelBubble = true;
            return false;
        }
    }
}


function fncInputDecimalOnly3(varFieldName,scale) 
{
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) 
    {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else 
    {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }

    //if ((iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57)))
    if (!(iKeyCode == 46 || iKeyCode == 48 || iKeyCode == 49 || iKeyCode == 50 || iKeyCode == 51 || iKeyCode == 52 || iKeyCode == 53 || iKeyCode == 54 || iKeyCode == 55 || iKeyCode == 56 || iKeyCode == 57)) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    else {
        // 12345
        if (document.getElementById(varFieldName).value.length < 3) 
        {
            if (document.getElementById(varFieldName).value.search(".") != -1)
            { }
        }
        else if (document.getElementById(varFieldName).value.length > 3) 
        {
            //123456
            if (document.getElementById(varFieldName).value.indexOf(".") > 0 && document.getElementById(varFieldName).value.indexOf(".") < 4) 
            { 
            // 123456.
            }
            else if (document.getElementById(varFieldName).value.search(".") == 0) 
            {
                if (iKeyCode != 46 && document.getElementById(varFieldName).value.length == 4) 
                {
                    event.returnValue = false;
                    event.cancelBubble = true;
                    return false;
                }
                else
                    event.returnValue = true;
            }
        }
        if (iKeyCode == 46) 
        {
            if (document.getElementById(varFieldName).value.indexOf(".") >= 0) 
            {
                event.returnValue = false;
                event.cancelBubble = true;
                return false;
            }
        }


    }
    var decimalIndex = document.getElementById(varFieldName).value.indexOf(".");
    if (decimalIndex >= 0) {
        if ((document.getElementById(varFieldName).value.length - decimalIndex) > parseInt(3)) {
            event.returnValue = false;
            event.cancelBubble = true;
            return false;
        }
    }
//        var decimalIndex = document.getElementById(varFieldName).value.indexOf(".");
//        //alert(document.getElementById(varFieldName).value);
//        //alert(document.getElementById(varFieldName).value.length);
//        //alert(decimalIndex);
//        if (decimalIndex >= 0) {
//            //alert(document.getElementById(varFieldName).value.length - decimalIndex);
//            //alert(precision);
//            if ((document.getElementById(varFieldName).value.length - decimalIndex) > parseInt(3)) {
//                event.returnValue = false;
//                event.cancelBubble = true;
//                return false;
//            }
//        }
//        else {
//            //alert('no decimal index');
//            if (document.getElementById(varFieldName).value.length > parseInt(3)) {
//                event.returnValue = false;
//                event.cancelBubble = true;
//                return false;
//            }
//            return true;
//        }
}



/*
Author:P V Patel
Date:Jan 30 2007
Description: A sample numeric box using javascript.
This text box can be used explictly to accept Amount Values.
*/
var theform;
var isIE;
var isNS;

/*
Function to detect the Browser type.
*/
function detectBrowser() {
    if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
        theform = document.forms["Form1"];
    else
        theform = document.Form1;

    //browser detection
    var strUserAgent = navigator.userAgent.toLowerCase();
    isIE = strUserAgent.indexOf("msie") > -1;
    isNS = strUserAgent.indexOf("netscape") > -1;

}

/*
This function will fire when the control leaves the Text Box.
The function is responsible for formating the numbers to amount type.
*/
function FormatAmtControl(ctl) {
    var vMask;
    var vDecimalAfterPeriod;
    var ctlVal;
    var iPeriodPos;
    var sTemp;
    var iMaxLen
    var ctlVal;
    var tempVal;
    ctlVal = ctl.value;
    vDecimalAfterPeriod = 2
    iMaxLen = ctl.maxLength;

    if (isNaN(ctlVal)) {
        // clear the control as this is not a num
        ctl.value = ""
    }
    else {
        ctlVal = ctl.value;
        iPeriodPos = ctlVal.indexOf(".");
        if (iPeriodPos < 0) {
            if (ctl.value.length > (iMaxLen - 3)) {
                sTemp = ctl.value
                tempVal = sTemp.substr(0, (iMaxLen - 3)) + ".00";
            }
            else
                tempVal = ctlVal + ".00"
        }
        else {
            if ((ctlVal.length - iPeriodPos - 1) == 1)
                tempVal = ctlVal + "0"
            if ((ctlVal.length - iPeriodPos - 1) == 0)
                tempVal = ctlVal + "00"
            if ((ctlVal.length - iPeriodPos - 1) == 2)
                tempVal = ctlVal;
            if ((ctlVal.length - iPeriodPos - 1) > 2) {
                tempVal = ctlVal.substring(0, iPeriodPos + 3);
            }
        }
        ctl.value = tempVal;
    }
}

/*
This function is responsible for filtering the keys pressed and the maintain the amount format of the 
value in the Text box
*/
function HandleAmountFiltering(ctl) {
    //alert(document.selection.createRange().text);
    if (document.selection.createRange().text != "")
        ctl.value = "";
    var iKeyCode, objInput;
    var iMaxLen
    var reValidChars = /[0-9.]/;
    var strKey;
    var sValue;
    var event = window.event || arguments.callee.caller.arguments[0];
    iMaxLen = ctl.maxLength;
    sValue = ctl.value;
    detectBrowser();

    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
    }
    strKey = String.fromCharCode(iKeyCode);
    if (reValidChars.test(strKey)) {
        if (iKeyCode == 46) {
            if (objInput.value.indexOf('.') != -1)
                if (isIE)
                event.keyCode = 0;
            else {
                if (event.which != 0 && event.which != 8)
                    return false;
            }
        }
        else {
            if (objInput.value.indexOf('.') == -1) {
                if (objInput.value.length >= (iMaxLen - 3)) {
                    if (isIE)
                        event.keyCode = 0;
                    else {
                        if (event.which != 0 && event.which != 8)
                            return false;
                    }

                }
            }
            else //DONOT ALLOW TO ENTER AFTER TWO DECIMAL BY NARENDRA -ELSE CONDITION
            {
                if ((objInput.value.length - 2) > objInput.value.indexOf('.')) {
                    //					    alert('2');		    
                    event.keyCode = 0;
                }
            }
            if ((objInput.value.length == (iMaxLen - 3)) && (objInput.value.indexOf('.') == -1)) {
                objInput.value = objInput.value + '.';

            }
        }

    }
    else {
        if (isIE)
            event.keyCode = 0;
        else {
            if (event.which != 0 && event.which != 8)
                return false;
        }
    }
}

// Disallow Invalid characters for NickName,FirstName, SurName, City etc for mantis item # 0013565 
function fncAvoidNotAllowedChars() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }

    if ($("#hdnCultureid").val() != undefined)
        varCulture = $("#hdnCultureid").val();
    else
        varCulture = 'EN';
    var keychar;
//    var numcheck;
//    if (window.event) keycode = window.event.keyCode;
//    else if (e) keycode = e.which;
//    else return true;
    keychar = String.fromCharCode(iKeyCode)
    if (window[varCulture + '_NotAllowedCharsAlphaNumericSpace'] == 'undefined')
        result = keychar.match(window['EN_NotAllowedCharsAlphaNumericSpace']);
    else
        result = keychar.match(window[varCulture + '_NotAllowedCharsAlphaNumericSpace']);

    if (result == null) {
        return true;
    }
    else {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
}

function fncInputCharOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }

    var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ";
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}

function fncInputCharDotOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ.";
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}

function fncInputNumCharSpaceOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ "
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}

function fncInputAlphabateWithSpaceOnly(inputstring) {

    var filter = /^[a-zA-Z ]+$/i;
    return filter.test(args.Value);
}

function fncInputAlphabateOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ "
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}


function fncInputNumCharOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ"
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}
function fncInputNumOnly() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890"
    
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}

function fncAllowNumOnly() 
{
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    if (iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
        return false;

    return true;
}

function fncInputForName() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ()_-&"
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}
function fncInputForPassword() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPFQRSTUVWXYZ()_-&!@#$%^&*?~"
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}
function fncInputPhoneNo() {
    detectBrowser();
    var event = window.event || arguments.callee.caller.arguments[0];
    if (isIE) {
        iKeyCode = event.keyCode;
        objInput = event.srcElement;
    } else {
        iKeyCode = event.which;
        objInput = event.target;
        if (iKeyCode == 0 || iKeyCode == 8)
            return true;
    }
    var valid = "1234567890()+-"
    if (valid.indexOf(String.fromCharCode(iKeyCode)) < 0) {
        event.returnValue = false;
        event.cancelBubble = true;
        return false;
    }
    return true;
}

function showcustomvalidation(errormessage) {
    var popup = "<div class='jqmNotification' id='ex3b'>";
    popup = popup + " <div class='jqmNotificationWindow'>";

    popup = popup + "<div class='jqmNotificationTitle clearfixNotification'>";
    popup = popup + document.title;
    //            popup = popup + "<a href='#' class='jqmNotificationClose'><em>Close</em></a>";

    popup = popup + "</div><div class='jqmNotificationContent'><ul>";
    popup = popup + "<li >" + errormessage + "</li>";
    popup = popup + "</ul></div>";
    popup = popup + "<input style='align:right;' type='submit' value='OK' class='jqmNotificationClose' />";
    //close = true;
    popup = popup + " </div>";
    popup = popup + " </div>";

    //if condition to check whether the page was validated successfully.
    
        document.getElementById('ltrPopup').innerHTML = popup;
        $().ready(function() {
            $('#ex3b').jqm({ overlay: 100 });
            $('#ex3b').jqmShow();
            $('.ex3b').jqmShow();
        });
}

function EmailChecking(str) {

    var at = "@"
    var dot = "."
    var lat = str.indexOf(at)
    var lstr = str.length
    var ldot = str.indexOf(dot)
    if (str.indexOf(at) == -1) {
        //alert("Invalid E-mail ID")
        showcustomvalidation("Invalid E-mail ID");
        return false
    }

    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at, (lat + 1)) != -1) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot, (lat + 2)) == -1) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(" ") != -1) {
        alert("Invalid E-mail ID")
        return false
    }

    return true
}

function ValidateEmailAddress(id) {
    var EmaiAddress = document.getElementById(id).value;  //document.getElementById("txtemail").value;
    var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/;
    if (!RegExEmail.test(EmaiAddress)) {
        alert("Please Enter Valid E-mail Adress");
    }
    //    else {
    //        alert("Go Ahead!");
    //    }
}

function validateSummaryControls(validationgroup) {
    var DomainURL = $("#hdnDomainURL").val();
    var popup = "<div class='jqmNotification' id='ex3b'>";
    popup = popup + " <div class='jqmNotificationWindow'>";
    popup = popup + "<div class='jqmNotificationTitle clearfixNotification'>";
    popup = popup + "<table cellpadding=2 ><tr><td><img alt='alert' src='" + DomainURL + "/Images/icon_alert.jpg' /></td><td>";
    if (document.title == null || document.title == "") {
        popup = popup + " Error ";
    }
    else {
        popup = popup + document.title;
    }
    popup = popup + "</td></tr></table></div><div class='jqmNotificationContent'><ul>";

    //Page_Validators is an array of validation controls in the page. 
    if (Page_Validators != undefined && Page_Validators != null) {
        //Looping through the whole validation collection.
        for (var i = 0; i < Page_Validators.length; i++) {
            if (Page_Validators[i].validationGroup == validationgroup) {
                ValidatorEnable(Page_Validators[i]);
                //if condition to check whether the validation was successfull or not.
                if (!Page_Validators[i].isvalid) {
                    popup = popup + "<li >" + Page_Validators[i].errormessage + "</li>";
                    //break;
                }
            }
        }
        popup = popup + "</ul></div>";
        popup = popup + "<input type='submit' value='OK' class='jqmNotificationClose' />";
        //close = true;
        //popup = popup + "<div class='clr'></div>";
        popup = popup + " </div>";
        popup = popup + " </div>";
    }

    //if condition to check whether the page was validated successfully.
    if (!Page_IsValid) {
        document.getElementById('ltrPopup').innerHTML = popup;
        $().ready(function() {
            $('#ex3b').jqm({ overlay: 100 });
            $('#ex3b').jqmShow();
            $('.ex3b').jqmShow();
        });
    }
    //window.setTimeout("$('#ex3b').jqmHide();$('.ex3b').jqmHide();", "20000");
}

