var varErrorColorForClientSideErrors = '#CFE0F8'

function openGlossaryWindow(strTerm) {
    jsWindow = window.open("/GlossaryItem.aspx?term=" + strTerm, "glossary_win", "width=390,height=250,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
    jsWindow.focus();
}

function sdcOpenNewWindow(strURL) {
    jsWindow = window.open(strURL, "new_win", "width=950,height=" + (screen.height - 150) + ",top=1,left=1,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
    jsWindow.focus();
}
function sdcOpenNewSmallWindow(strURL) {
    jsWindow = window.open(strURL, "small_win", "width=600,height=500,top=1,left=1,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no");
    jsWindow.focus();
}

function openCopyrightWindow(strURL, strHeight, strWidth) {
    jsWindow = window.open(strURL, "search_criteria_win", "width=950" + strWidth + ",height=300" + strHeight + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,top=1,left=1");
    jsWindow.focus();
}

function sdcOpenWindow(strDestination, strWindowName, strOptions) {
    jsWindow = window.open(strDestination, strWindowName, strOptions);
    jsWindow.focus();
}

function sdcOpenWindowBlurry(strDestination, strWindowName, strOptions) {
    jsWindow = window.open(strDestination, strWindowName, strOptions);
}

function ToggleOnOff(id) {
    var item = document.getElementById(id);
    if (item.style.display == 'none') {
        item.style.display = '';
    }
    else {
        item.style.display = 'none';
    }
}

function openWindow(strURL) {
    //    jsWindow = window.open("", "new_win", "width=800,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //    jsWindow.close();
    //    newWin = window.open(strURL, "new_win", "width=800,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //      if (window.focus) {
    //          newWin.focus();
    //   }
    jsWindow = window.open(strURL, "new_win", "width=800,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //jsWindow.focus();
}

function openWindowPDF(strURL) {
    //    jsWindow = window.open("", "new_win", "width=800,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //    jsWindow.close();
    //    newWin = window.open(strURL, "new_win", "width=800,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //      if (window.focus) {
    //          newWin.focus();
    //   }
    jsWindow = window.open(strURL, "new_win", "width=1000,height=1200,toolbar=yes,menubar=yes, location=yes, scrollbars=yes,resizable=yes,top=1,left=1");
    //jsWindow.focus();
}

/* ========== Rotating Masthead Script ================ */

var backgroundSrcs = new Array("/images/masthead01.jpg", "/images/masthead02.jpg", "/images/masthead03.jpg", "/images/masthead04.jpg", "/images/masthead05.jpg")

function pickimage() {
    var bgimage = backgroundSrcs[(Math.round(Math.random() * (backgroundSrcs.length - 1)))]

    document.getElementById("masthead").style.background = "url('" + bgimage + "') no-repeat top right #ffffff";
}

/* ============= End Rotating Masthead Script =============== */


function addListeners() {
    var link = document.getElementById('hideMe');
    link.addEventListener('click', HideAll, false);
}


/*  ------ Collapsible menu - Idividual Subjects  ------ */
menu_status = new Array();
function showHide(theid) {
    if (document.getElementById) {
        var switch_id = document.getElementById(theid);

        if (document.getElementById(theid).className == 'show') {
            switch_id.className = 'hide';
        }
        else {
            switch_id.className = 'show';
        }
    }
}

function swap(obj) {
    var img = obj.getElementsByTagName('img')[0];
    if (document.getElementById) {
        if (img.src.indexOf("/images/expanded.gif") != -1) {
            img.src = "/images/collapsed.gif";
        }
        else {
            img.src = "/images/expanded.gif";
        }
    }
}

function addListeners() {
    var link = document.getElementById('hideRes');
    link.addEventListener('click', HideResAll, false);
}
/*----------------------------*/


function printpr() {
    var PPVIEW = 7;
    /* PPVIEW values:
    * 6 - print
    * 7 - print preview
    * 1 - open window
    * 4 - Save As
    */
    var PROMPT = 1; // 2 DONTPROMPTUSER 
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(PPVIEW, PROMPT);
    WebBrowser1.outerHTML = "";
}

function openHelpWindow(strFileName) {
    jsWindow = window.open(strFileName, "winHelp", "width=350,height=150,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
    jsWindow.focus();
}

function bValidEmailAddress(emailStr) {
    var emailPat = /^(.+)@(.+)$/
    var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    var validChars = "\[^\\s" + specialChars + "\]"
    var quotedUser = "(\"[^\"]*\")"
    var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    var atom = validChars + '+'
    var word = "(" + atom + "|" + quotedUser + ")"
    var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
    var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")
    var matchArray = emailStr.match(emailPat)
    if (matchArray == null) {
        alert("Please enter a valid email address.")
        return false
    }
    var user = matchArray[1]
    var domain = matchArray[2]

    if (user.match(userPat) == null) {
        alert("Please enter a valid email address.")
        return false
    }

    var IPArray = domain.match(ipDomainPat)
    if (IPArray != null) {
        // this is an IP address
        for (var i = 1; i <= 4; i++) {
            if (IPArray[i] > 255) {
                alert("Please enter a valid email address.")
                return false
            }
        }
        return true
    }

    // Domain is symbolic name
    var domainArray = domain.match(domainPat)
    if (domainArray == null) {
        alert("Please enter a valid email address.")
        return false
    }

    var atomPat = new RegExp(atom, "g")
    var domArr = domain.match(atomPat)
    var len = domArr.length
    if (domArr[domArr.length - 1].length < 2 ||
		domArr[domArr.length - 1].length > 3) {
        alert("Please enter a valid email address.")
        return false
    }

    if (len < 2) {
        var errStr = "Please enter a valid email address."
        alert(errStr)
        return false
    }
    return true;
}

function sdcJumpField(txtCurrentField, txtDestField, iNumChar) {
    if (txtCurrentField.value.length >= iNumChar && event.keyCode != 9 && event.keyCode != 16 && event.keyCode != 37 && event.keyCode != 39) {
        txtDestField.focus();
    }
}

function bAllTheSameCharacter(strStringToCheck) {
    var iIndex;
    var charLength = strStringToCheck.length;
    var firstChar = strStringToCheck.substring(0, 1);
    var retval = 0;

    if (charLength == 0) {
        retval += 1;
    }

    for (var iIndex = 0; iIndex <= charLength; iIndex++) {
        if (firstChar != strStringToCheck.substring(iIndex, 1)) {
            return false;
        }
    }

    return true;
}


/*-- Clear Text Input On Focus --*/

function clearText(thefield) {
    if (thefield.defaultValue == thefield.value)
        thefield.value = ""
}

function change(that, fgcolor) {
    that.style.color = fgcolor;
}

/*-- End Input Text Style --*/

function isValidDate(dateStr) {
    var reg = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/

    // If it doesn't conform to the right format (with either a 2 digit year or 4 digit year), fail
    if (reg.test(dateStr) == false) {
        return false;
    }
    return true;
}

function validatePhoneNumber(Number, IsWork) {
    /*
    This function validates the phone numbers based upon the NANP standard i.e.
    NXX-NXX-XXXX
    where N is any digit 2-9 and X is any digit 0-9.
    This function also validates the repetitive occurances in the area code e.g.
    555 or 333 or 666 are invalid area codes.
    HAPPY PROGRAMMING!!!
    */
    //alert(Number.replace(/\s+/g,"") );//Jam's trimming!
    if (!IsWork) {
        var RegEx = /^(\d)(\1)\2\d{7}|[01]\d{9}|\d{3}[01]\d{6}$/; // Home/Mobile Validation
    }
    else {
        var RegEx = /^([^8])(\1)\2\d{7}|[01]\d{9}|\d{3}[01]\d{6}$/; // Work Validataion
    }
    if ((Number == '') || (Number.replace(/\s+/g, "").length < 10) || (isNaN(Number)) || (Number.match(RegEx))) {

        return false;
    } else {

        return true;

    }
}

function AutoTab(Source, Destination) {
  
    if (Source.getAttribute &&
            Source.value.length == Source.getAttribute("maxlength")) {
        //alert(Destination);
        Destination.focus()
    }
}

function PhoneNumberAutoTab(Source) {
    var curctl; curctl = Source.id.split('_');
   // Source.blur();
   // Source.focus();
    if (Source.getAttribute && Source.value.length == Source.getAttribute("maxlength")) {
        if (curctl[2] == "tbFirst") {
            //document.getElementById(curctl[0] +  '_' + curctl[1] + '_tbSecond').value = '';
           document.getElementById(curctl[0] + '_' + curctl[1] + '_tbSecond').focus();
        }
        else if (curctl[2] == "tbSecond") {
            //document.getElementById(curctl[0] + '_' + curctl[1] + '_tbThird').value = '';
          document.getElementById(curctl[0] + '_' + curctl[1] + '_tbThird').focus();
        }
        
    }
}

function PhoneNumbertbFirstEnable(me) {   
    ValidatorEnable(document.getElementById(me.id), true); 
}
function PhoneNumbertbSecondEnable(me) {
    ValidatorEnable(document.getElementById(me.id), true);
}
function PhoneNumbertbThirdEnable(me) {
    ValidatorEnable(document.getElementById(me.id), true);
}

function goNewWin() {
    TheNewWin = window.open("scc.aspx?pid=460", 'TheNewpop', 'toolbar=1, location=1,directories=1,status=1,menubar=1, scrollbars=1,resizable=1');
    TheNewWin.blur();
}

function goNewWinalt() {
    TheNewWin = window.open("scc.aspx?pid=460", 'TheNewpop', 'toolbar=1, location=1,directories=1,status=1,menubar=1, scrollbars=1,resizable=1');
    TheNewWin.blur();
}


function Querystring(qs) {
    this.params = new Object()
    this.get = Querystring_get

    if (qs == null)
        qs = location.search.substring(1, location.search.length)

    if (qs.length == 0) return

    qs = qs.replace(/\+/g, ' ')
    var args = qs.split('&')

    for (var i = 0; i < args.length; i++) {
        var value;
        var pair = args[i].split('=')
        var name = unescape(pair[0])

        if (pair.length == 2)
            value = unescape(pair[1])
        else
            value = name

        this.params[name] = value
    }
}

function Querystring_get(key, default_) {
    if (default_ == null) default_ = null;

    var value = this.params[key]
    if (value == null) value = default_;

    return value
}


function showClassesOnlineMessage(DropDown, SchoolName) {
    if (DropDown[DropDown.selectedIndex].value == 'Y') {
        alert(SchoolName + ' requires that you must be able to physically attend classes. \n\n  If you can physically attend classes and are still interested in this offer, please select NO for your answer to this question');
    }
}


function findPosX(obj) {
   
    var curleft = 0;
    if (obj.offsetParent)
        while (1) {
            curleft += obj.offsetLeft;
            if (!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}

function findPosY(obj) {
   
    try {
        
        var curtop = 0;
        if (obj.offsetParent)
            while (1) {
                curtop += obj.offsetTop;
                if (!obj.offsetParent)
                    break;
                obj = obj.offsetParent;
            }
        else if (obj.y)
            curtop += obj.y;
        return curtop;
    }
    catch (err) {}
}



//Start question roll overs
function getHelpTopic(helpTopicID) {

    $.ajax({
        type: "POST",
        url: "/HelpTopic.aspx",
        data: "topicid=" + helpTopicID,
        dataType: "json",
        success: function (msg) {

            setHelpTopic(msg);
        }

    });
}
function setHelpTopic(transport) {
    var json = transport;
    var title;
    var desc;
    title = json.title;
    desc = json.desc;
    $(".tooltip").html('<strong>' + title + '</strong><br />' + desc);


}
//End question roll overs


// ================================================================== Start Content Management System functions
function setLink(Lselection, Lid, Lbox, Lrange, LstartContainer) {

    if (Lselection != "") {

        document.getElementById(Lbox).innerHTML = Lselection;
      
        Lrange = Lselection.getRangeAt(0);

        LstartContainer = Lrange.startContainer;
       
        var spanNode = document.createElement("a");
        spanNode.setAttribute('href', '/SCHLINK_' + Lid + '/');
        var docfrag = Lrange.extractContents();
        spanNode.appendChild(docfrag);
        Lrange.insertNode(spanNode);
        spanNode.innerHTML = " " + document.getElementById(Lbox).innerHTML;
    }

}

function parseTreeviewParentId(Phref, Pid) {
    Phref = Phref.substring(1, Phref.length - 1);
    var id_array = Phref.split("/");
    if (id_array.length == 1) {
        id = id_array[0];
    }
    else if (id_array.length == 2) {
        Pid = id_array[0];
        id = id_array[1];
    }

    return id;
}



function insertAtCaret(areaId, text) {
    var txtarea = document.getElementById(areaId);
    var scrollPos = txtarea.scrollTop;
    var strPos = 0;
    var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ?
		"ff" : (document.selection ? "ie" : false));
    if (br == "ie") {
        txtarea.focus();
        var range = document.selection.createRange();
        range.moveStart('character', -txtarea.value.length);
        strPos = range.text.length;
    }
    else if (br == "ff") strPos = txtarea.selectionStart;

    var front = (txtarea.value).substring(0, strPos);
    var back = (txtarea.value).substring(strPos, txtarea.value.length);
    txtarea.value = front + text + back;
    strPos = strPos + text.length;
    if (br == "ie") {
        txtarea.focus();
        var range = document.selection.createRange();
        range.moveStart('character', -txtarea.value.length);
        range.moveStart('character', strPos);
        range.moveEnd('character', 0);
        range.select();
    }
    else if (br == "ff") {
        txtarea.selectionStart = strPos;
        txtarea.selectionEnd = strPos;
        txtarea.focus();
    }
    txtarea.scrollTop = scrollPos;
}


function handleCommonPageTemplateElements(lnk) {
    if (lnk != '') {
        $(lnk).each(function () {
            $("a[href^=/]").attr("target", "_top");
        });
    }
  
}


function setSizeiframe() {
    $('iframe').load(function () {
        if (this.id != '') {
            this.style.height =
        this.contentWindow.document.body.offsetHeight + 50 + 'px';
            this.style.width = '100%';
        }

    });

}

function handleTooltips(areaId, posx, posy, showchild) {
 
    if ($.browser.msie && $.browser.version == "6.0") {
        $(areaId).click(function (e) {
            openFileWindow('/HelpTopic.aspx?topicid=' + $(this).attr('id') + '');
        });
    }
    else {

        $(areaId).mouseenter(function (e) {

            getHelpTopic($(this).attr('id'));
            $(this).css('z-index', '15')
		            .children(showchild)
		            .fadeIn("fast")
		            .css({ 'bottom': posx, 'left': posy, 'display': 'block' });

        }).mousemove(function (e) {
            //$(this).children("div.tooltip").css({'bottom': posiX,'left': posiY});
        }).mouseleave(function () {
            $(this).css('z-index', '1')
		.children(showchild)
		.hide()
        });
    }

}

function breakOutFrame() {
    $("a[href^=/]").attr("target", "_top");
}

function SelectAll(id) {
    var frm = document.forms[0];
    for (i = 0; i < frm.elements.length; i++) {
        if (frm.elements[i].type == "checkbox") {
            frm.elements[i].checked = document.getElementById(id).checked;
        }
    }
}

function formatTextLink(el) {
    /* IF INTERNET EXPLORER */
    if (window.showModalDialog) {


        var myText = window.showModalDialog('chooseLink.aspx',
                                                    'name',
                                                    'dialogWidth:900px;dialogHeight:600px;');

        if (myText != "iamempty") {
            var selectedText = document.selection.createRange().text;

            if (selectedText.toLowerCase().indexOf("<a ") >= 0) {
                selectedText = $(selectedText).text();
            }



            if (selectedText != "") {

                var newText = myText + selectedText + "</a>";
                document.selection.createRange().text = newText;

            }

            else {

                el.focus(el.caretPos);
                el.caretPos = document.selection.createRange().duplicate();
                if (el.caretPos.text.length == 0) {
                    if (el.caretPos.text != '') {

                        el.caretPos.text = myText + "</a>";
                    }

                }
            }

        }
    }
    /* IF MOZILLA */
    else {
        window.open('chooseLink.aspx',
                            'name',
                            'height=180,width=530,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes');
    }


}

function toggleView(areaone, arearwo, areaid) {
    if ($(areaone).is(':visible')) {
        $(areaone).hide();
        $(arearwo).html($(areaid).val());
        $(arearwo).show();
    }
    else {
        $(areaone).show();
        $(arearwo).hide();
    }

}

//End Content Management System functions

function formatString(str) {
    str = str.replace('&amp;', '&');
    return str;
}


function IsNumeric(strString) {

    var strValidChars = "0123456789.";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;
    //  test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }
    return blnResult;
}





function errorModalServer() {

    $(document).ready(function () {
        window.scrollTo(0, findPosY(document.getElementById('outermost')));

        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({ 'width': maskWidth, 'height': maskHeight });
        $('#dialog').css({ 'top': 100 });
        $('#mask').fadeIn(500);
        $('#mask').fadeTo("fast", 0.8);
        $("#dialog").fadeIn(100);

        $('#mask').click(function () {
            $(this).hide();
            $('.window').hide();
        });

        $('.window .close_error_modal').click(function (e) {
            window.scrollTo(0, findPosY(document.getElementById($('select[class*="controlInErrorServer"],input[type=text][class*="controlInErrorServer"], span[class*="controlInErrorServer"]').eq(0).attr("id"))));
            e.preventDefault();
            $('#mask').hide();
            $('.window').hide();
        });
    });
}

function scrollToOnServerError() {
    $(document).ready(function () {

        var scrollToArea='';
        scrollToArea = $('class*="controlInErrorServer",select[class*="controlInErrorServer"],input[type=text][class*="controlInErrorServer"],span[class*="customValidatorCssErrorEnsureOptInServer"],span[class*="controlInErrorServer"],table[class*="controlInErrorServer"],td[class*="controlInErrorServer"]').eq(0).attr("id");
       window.scrollTo(0, findPosY(document.getElementById(scrollToArea)));
    });
}

function scrollToOnClientError() {
    window.scrollTo(0, findPosY(document.getElementById($('class*="controlInErrorServer",div[class*="validatorAreaInError"],span[class*="customValidatorCssError"]').eq(0).attr("id")))); 
}



function onkeyupval(obj) {
    obj.blur();
    obj.focus();
}



function PageValidate() {
    var scrollToId='';
    var _varPageIsValid = 'true';
    var  valCtrl='';
    var divArea =''
    if (typeof (Page_ClientValidate) == 'function' && Page_Validators != undefined && Page_Validators != null) {
        
        for (var i = 0; i < Page_Validators.length;  i++) {

            ValidatorEnable(Page_Validators[i]);

            if (!Page_Validators[i].isvalid) {
                if (document.getElementById(Page_Validators[i].controltovalidate) != null){
                valCtrl = document.getElementById(Page_Validators[i].controltovalidate);
                divArea = valCtrl.id;
                divArea = divArea.replace('_', '_validationarea_');
                }
                if (document.getElementById(divArea) != null) {
                    if (document.getElementById(Page_Validators[i].controltovalidate) != undefined && document.getElementById(divArea).style.display !='' && document.getElementById(divArea).style.display != 'none') {
                        _varPageIsValid = 'false'; if (scrollToId == '') { scrollToId = divArea; }
                    }
                    else {
                        if (document.getElementById(divArea).style.display == 'none') { ValidatorEnable(Page_Validators[i],false); }
                        else {
                            if (scrollToId == '') { scrollToId = divArea; }
                            _varPageIsValid = 'false';
                        }
                    }
                }
                else if (scrollToId == '') { { scrollToId = valCtrl.id; _varPageIsValid = 'false'; } }

            }
                       
        }
       
    }

    if (_varPageIsValid == 'true') {
        if (vareventCapturebBnRegisterScholarshipSearch == 'btnRegister') {
            document.getElementById('btnRegister').value = 'Processing...';
            window.scrollTo(0, findPosY(document.getElementById('btnRegister')));
        }
        if (vareventCapturebBnSubmit == 'btnSubmit') {
            document.getElementById('btnSubmit').value = 'Processing...';
            window.scrollTo(0, findPosY(document.getElementById('btnSubmit')));
        }
       
        return true; 
    }
    else {
        //scrollToOnClientError();
       
        window.scrollTo(0, findPosY(document.getElementById(scrollToId)));
        if (vareventCapturebBnRegisterScholarshipSearch == 'btnRegister') {
            document.getElementById('btnRegister').value = 'Continue';
        }
        if (vareventCapturebBnSubmit == 'btnSubmit') {
            document.getElementById('btnSubmit').value = 'Continue';
        }      
            return false;
      
    }

    }
    var vareventCapturebBnSubmit;
    function eventCapturebBnSubmit(me) {
        vareventCapturebBnSubmit = me.id;
        return false;
    }

    function emailCheck(emailStr, chkBoxList) {
      
      
        var curctl; curctl = chkBoxList.split('_');
        var validatorAreaid;
        var validatorArea;
        var whichradio;
        if (curctl[1] == undefined) {
            validatorAreaid = chkBoxList;
            validatorArea = document.getElementById('validationarea_' + validatorAreaid); 
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + validatorAreaid);
            whichradio = curctl[0] + '_rblOptIn_0';
        }       
        var emailPat = /^(.+)@(.+)$/
        var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
        var validChars = "\[^\\s" + specialChars + "\]"
        var quotedUser = "(\"[^\"]*\")"
        var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
        var atom = validChars + '+'
        var word = "(" + atom + "|" + quotedUser + ")"
        var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
        var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")
        var matchArray = emailStr.match(emailPat)



        if ((document.getElementById(whichradio) == null) || (document.getElementById(whichradio).checked)) {


            if (matchArray == null) {
                //alert("Please enter a valid email address.")
                validatorArea.className = "validatorAreaInError";
                document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                return false;
            }
            var user = matchArray[1]
            var domain = matchArray[2]

            if (user.match(userPat) == null) {
                //alert("Please enter a valid email address.")
                validatorArea.className = "validatorAreaInError";
                document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                return false;
            }

            var IPArray = domain.match(ipDomainPat)
            if (IPArray != null) {
                // this is an IP address
                for (var i = 1; i <= 4; i++) {
                    if (IPArray[i] > 255) {
                        //alert("Please enter a valid email address.")
                        validatorArea.className = "validatorAreaInError";
                        document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                        return false;
                    }
                }
                return true;
            }

            // Domain is symbolic name
            var domainArray = domain.match(domainPat)
            if (domainArray == null) {
                //alert("Please enter a valid email address.")
                validatorArea.className = "validatorAreaInError";
                document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                return false
            }

            var atomPat = new RegExp(atom, "g")
            var domArr = domain.match(atomPat)
            var len = domArr.length
            if (domArr[domArr.length - 1].length < 2 ||
			domArr[domArr.length - 1].length > 4) {
                //alert("Please enter a valid email address.")
                validatorArea.className = "validatorAreaInError";
                document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                return false;
            }

            if (len < 2) {
                //var errStr = "Please enter a valid email address."
                //alert(errStr)
                validatorArea.className = "validatorAreaInError";
                document.getElementById(chkBoxList).style.backgroundColor = varErrorColorForClientSideErrors;
                return false;
            } 
        }
            validatorArea.className = "validatorAreaInErrorClear";
            document.getElementById(chkBoxList).style.backgroundColor = 'white';
            return true;
        
    }

    function ValidateMonthYear(source, args) {
      
        var validatorAreaid = source.id;
        var ctrToVal;
        var validatorArea;
        var curctl; curctl = source.id.split('_');
    
        if (curctl[1] == undefined) { //for pages
            ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);
        }
        else {
            //for user controls
           
            whichradio = curctl[0] + '_rblOptIn_0';
            if ((document.getElementById(whichradio) == null) || (document.getElementById(whichradio).checked)) {
                var arrComposite = document.getElementById(validatorAreaid).getAttribute("CompositeControlsValidation").split('|');
                var arrCompositeDiv = document.getElementById(validatorAreaid).getAttribute("compositeControlDivID");
                var arrCompositeControlValidatorID = document.getElementById(validatorAreaid).getAttribute("CompositeControlValidatorID");
                document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).innerHTML = '';
                document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).style.display = "none";
                validatorArea = curctl[0] + '_' + arrCompositeDiv;
                document.getElementById(curctl[0] + '_' + arrComposite[0]).style.backgroundColor = "#fff";
                document.getElementById(curctl[0] + '_' + arrComposite[1]).style.backgroundColor = "#fff";
                if (document.getElementById(curctl[0] + '_' + arrComposite[0]).selectedIndex == 0 && document.getElementById(curctl[0] + '_' + arrComposite[1]).selectedIndex == 0) {
                    document.getElementById(validatorArea).className = "validatorAreaInError";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).style.display = "block";
                    document.getElementById(curctl[0] + '_' + arrComposite[0]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(curctl[0] + '_' + arrComposite[1]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).innerHTML = "High school graduation month and year is required.";
                    args.IsValid = false;
                    return;
                }
                else if (document.getElementById(curctl[0] + '_' + arrComposite[0]).selectedIndex == 0 ) {
                    
                    document.getElementById(validatorArea).className = "validatorAreaInError";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).style.display = "block";
                    document.getElementById(curctl[0] + '_' + arrComposite[0]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).innerHTML = "High school graduation month is required."; 
                    args.IsValid = false;
                    return;

                }
                else if ( document.getElementById(curctl[0] + '_' + arrComposite[1]).selectedIndex == 0) {
                
                    document.getElementById(validatorArea).className = "validatorAreaInError";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).style.display = "block";
                    document.getElementById(curctl[0] + '_' + arrComposite[1]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).innerHTML = "High school graduation year is required."; 
                    args.IsValid = false;
                    return;
                }

              
                $('#'+validatorArea).removeAttr('class');
                document.getElementById(curctl[0] + '_' + arrCompositeControlValidatorID).style.display = "none";
                args.IsValid = true;
                return;
            }
        }
        $('#' + validatorArea).removeAttr('class');
        document.getElementById(source.id).style.display = "none";
        args.IsValid = true;
        return;

    }

   
    function ValidateDOB(source, args) {
      
        var validatorAreaid = source.id;      
        var validatorArea;
        var curctl; curctl = source.id.split('_');
        document.getElementById("ccvDOB").innerHTML = "";

        if (curctl[1] == undefined) {          
            validatorArea = document.getElementById('validationarea_DOB');
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_DOB'); 
              }
        
            var arrComposite = document.getElementById(validatorAreaid).getAttribute("CompositeControlsValidation").split('|');
            document.getElementById(arrComposite[0]).blur();
            document.getElementById(arrComposite[1]).blur();
            document.getElementById(arrComposite[2]).blur();
            var formattedMonth= document.getElementById(arrComposite[0]).value-1;
            var testDate = new Date(document.getElementById(arrComposite[2]).value, formattedMonth, document.getElementById(arrComposite[1]).value, 0, 0, 0, 0);
            document.getElementById(arrComposite[0]).style.backgroundColor = 'white';
            document.getElementById(arrComposite[1]).style.backgroundColor = 'white';
            document.getElementById(arrComposite[2]).style.backgroundColor = 'white';
            if ((document.getElementById(arrComposite[0]).options[document.getElementById(arrComposite[0]).selectedIndex].text != 'Month' && document.getElementById(arrComposite[1]).options[document.getElementById(arrComposite[1]).selectedIndex].text != 'Day' && document.getElementById(arrComposite[2]).options[document.getElementById(arrComposite[2]).selectedIndex].text != 'Year') && (testDate.getFullYear() != document.getElementById(arrComposite[2]).value || testDate.getMonth() != formattedMonth || testDate.getDate() != document.getElementById(arrComposite[1]).value)) {
                document.getElementById("ccvDOB").innerHTML = "Valid date is required.";
                validatorArea.className = "validatorAreaInError";
                document.getElementById("ccvDOB").style.display = "block";
                args.IsValid = false;
                return;

            }
          
            if (vareventCapturebBnRegisterScholarshipSearch == 'btnRegister') {

                if ((document.getElementById(arrComposite[0]).options[document.getElementById(arrComposite[0]).selectedIndex].text == 'Month') && (document.getElementById(arrComposite[1]).options[document.getElementById(arrComposite[1]).selectedIndex].text == 'Day') && (document.getElementById(arrComposite[2]).options[document.getElementById(arrComposite[2]).selectedIndex].text == 'Year')) {
                    validatorArea.className = "validatorAreaInError";
                    document.getElementById("ccvDOB").style.display = "block";
                    document.getElementById("ccvDOB").innerHTML = "Please select date of birth.";
                    document.getElementById(arrComposite[0]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(arrComposite[1]).style.backgroundColor = "#CFE0F8";
                    document.getElementById(arrComposite[2]).style.backgroundColor = "#CFE0F8";
                    args.IsValid = false;
                    return;
                }
                if ((document.getElementById(arrComposite[0]).options[document.getElementById(arrComposite[0]).selectedIndex].text == 'Month') ) {
                    validatorArea.className = "validatorAreaInError";
                    document.getElementById("ccvDOB").style.display = "block";
                    document.getElementById("ccvDOB").innerHTML = "Please select month.";
                    document.getElementById(arrComposite[0]).style.backgroundColor = "#CFE0F8";                   
                    args.IsValid = false;
                    return;
                }
                else if ((document.getElementById(arrComposite[1]).options[document.getElementById(arrComposite[1]).selectedIndex].text == 'Day') ) {
                    validatorArea.className = "validatorAreaInError";
                    document.getElementById("ccvDOB").style.display = "block";
                    document.getElementById("ccvDOB").innerHTML = "Please select day.";
                    document.getElementById(arrComposite[1]).style.backgroundColor = "#CFE0F8";
                    args.IsValid = false;
                    return;
                }
                else if ((document.getElementById(arrComposite[2]).options[document.getElementById(arrComposite[2]).selectedIndex].text == 'Year') ) {
                    validatorArea.className = "validatorAreaInError";
                    document.getElementById("ccvDOB").style.display = "block";
                    document.getElementById("ccvDOB").innerHTML = "Please select year.";
                    document.getElementById(arrComposite[2]).style.backgroundColor = "#CFE0F8";
                    args.IsValid = false;
                    return;
                }
            validatorArea.className = "validatorAreaInErrorClear";               
                args.IsValid = true;
                document.getElementById(arrComposite[0]).blur();
                document.getElementById(arrComposite[1]).blur();
                document.getElementById(arrComposite[2]).blur();
                return;

            }

        validatorArea.className = "validatorAreaInErrorClear";
            document.getElementById(arrComposite[0]).style.backgroundColor = 'white';
            document.getElementById(arrComposite[1]).style.backgroundColor = 'white';
            document.getElementById(arrComposite[2]).style.backgroundColor = 'white';
            args.IsValid = true;
            document.getElementById(arrComposite[0]).blur();
            document.getElementById(arrComposite[1]).blur();
            document.getElementById(arrComposite[2]).blur();
            return;
      

    }


    function validateZipPlusFour(oSrc, args) {
   
        var curctl; curctl = oSrc.id.split('_');
        var validatorAreaid;
        var validatorArea;
        if (curctl[1] == undefined) {
            validatorAreaid = oSrc.id;
            var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_txtZoningImprovementPlan');
            }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + ctrToVal);

         }


         if (oSrc.getAttribute("CompositeControlsValidation") != null) {
             var arrComposite = oSrc.getAttribute("CompositeControlsValidation").split('|'); 
             if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1' && !IsNumeric(document.getElementById(arrComposite[1]).value) && document.getElementById(arrComposite[1]).value.length == 4) {
                 validatorArea.className = "validatorAreaInError";
                 document.getElementById("ccvZip").innerHTML = "Zip plus 4 code must be numeric.";
                 document.getElementById("ccvZip").style.display = "block";
                 document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors; 
                 args.IsValid = false;
                 return;
             }

             else if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1'  ) {
                 if ((document.getElementById(arrComposite[0]).value.length == 0) || (document.getElementById(arrComposite[0]).value.length != 5)) {
                    
                 validatorArea.className = "validatorAreaInError";
                 document.getElementById("ccvZip").innerHTML = "Zip code is required."; 
                 document.getElementById("ccvZip").style.display = "block";
                 document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                 args.IsValid = false;
                 return;
             }
             else if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1' && !IsNumeric(document.getElementById(arrComposite[0]).value)) {
                 validatorArea.className = "validatorAreaInError";
                 document.getElementById("ccvZip").innerHTML = "Zip code must be a numeric value.";
                 document.getElementById("ccvZip").style.display = "block";
                 document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                 args.IsValid = false;
                 return;
             }
             }

          

         validatorArea.className = "validatorAreaInErrorClear"; 
            document.getElementById("ccvZip").style.display = "none";
             args.IsValid = true;
             return;
         }
         else {
             args.IsValid = true;
             return;
         }
    }

    function validateZip(oSrc, args) {
      
        var curctl; curctl = oSrc.id.split('_');
        var validatorAreaid;
        var validatorArea;
        if (curctl[1] == undefined) {
            validatorAreaid = oSrc.id;
            var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);
          
            if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1' && document.getElementById(ctrToVal).value == "") {
                validatorArea.className = "validatorAreaInError"; 
                document.getElementById(oSrc.id).innerHTML = "ZIP is required";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                args.IsValid = false;
                return;
            }
            else if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1' && !IsNumeric(document.getElementById(ctrToVal).value)) {
                validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "ZIP must be a numeric value.";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                args.IsValid = false;
                return;
            }
            else if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value == '1' && document.getElementById(ctrToVal).value.length != 5) {
                validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "Current Zip Code must be 5 characters.";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                args.IsValid = false;
                return;
            }
          
        validatorArea.className = "validatorAreaInErrorClear";
            args.IsValid = true;
            document.getElementById(ctrToVal).style.backgroundColor = 'white';
           
            return;
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_'+'validationarea_' + ctrToVal);
           
        }

    }

    function validatePostalCode(oSrc, args) {

        var curctl; curctl = oSrc.id.split('_');
        var validatorAreaid;
        var validatorArea;
        if (curctl[1] == undefined) {
            validatorAreaid = oSrc.id;
            var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);

            if (document.getElementById("lstCountry").options[document.getElementById("lstCountry").selectedIndex].value != '1' && document.getElementById(ctrToVal).value.length == 0) {
                validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "International addresses must have a postal code.";
                document.getElementById(oSrc.id).style.display = "block";                
                args.IsValid = false;
                return;
            }
          

        validatorArea.className = "validatorAreaInErrorClear";
            args.IsValid = true;
            return;
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + ctrToVal);

        }
    }

    function ValidateGPA(oSrc, args) {
        var curctl; curctl = oSrc.id.split('_');
        var validatorAreaid;
        var validatorArea;
        if (curctl[1] == undefined) {
            validatorAreaid = oSrc.id;
            var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);
           
            if (document.getElementById(ctrToVal).value.length ==0) {
                validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "GPA is required.";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                args.IsValid = false;
                return;
            }
            else if (!IsNumeric(document.getElementById(ctrToVal).value)) {
                validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "GPA must be a numeric value.";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors; 
                args.IsValid = false;
                return;
            }

            else if (document.getElementById(ctrToVal).value <= 0 || document.getElementById(ctrToVal).value>4) {
             validatorArea.className = "validatorAreaInError";
                document.getElementById(oSrc.id).innerHTML = "GPA must be a value greater than 0 and less than or equal to 4.";
                document.getElementById(oSrc.id).style.display = "block";
                document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors;
                args.IsValid = false;
                return;
            }
           
        validatorArea.className = "validatorAreaInErrorClear";
            args.IsValid = true;
            return;
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + curctl[1]);

        }


    }

    function ValidatePassword(oSrc, args) {
        var validatorArea;
        var validatorAreaid;
        validatorAreaid = oSrc.id;
        var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
        validatorArea = document.getElementById('validationarea_password');
        var arrComposite = document.getElementById(validatorAreaid).getAttribute("CompositeControlsValidation").split('|'); 

        if ((document.getElementById(arrComposite[0]).value.length == 0) || (document.getElementById(arrComposite[1]).value.length == 0)){
            validatorArea.className = "validatorAreaInError";
            document.getElementById("ccvPassword").style.display = "block";
            document.getElementById("ccvPassword").innerHTML = "Password is required.";
            document.getElementById(arrComposite[0]).style.backgroundColor = varErrorColorForClientSideErrors;
            document.getElementById(arrComposite[1]).style.backgroundColor = varErrorColorForClientSideErrors;         
            args.IsValid = false;
            return;

        }
        else if (document.getElementById(arrComposite[0]).value != document.getElementById(arrComposite[1]).value) {
            validatorArea.className = "validatorAreaInError";
            document.getElementById("ccvPassword").style.display = "block";
            document.getElementById("ccvPassword").innerHTML = "Verification password does not match password.";

            args.IsValid = false;
            return;
        }

        else if ((document.getElementById(arrComposite[0]).value.length < 6) || (document.getElementById(arrComposite[0]).value.length > 12)) {
            validatorArea.className = "validatorAreaInError";
            document.getElementById("ccvPassword").style.display = "block";
            document.getElementById("ccvPassword").innerHTML = "Please supply a password that is 6 to 12 characters long.";
            args.IsValid = false;
            return;
        }

        else {
        validatorArea.className = "validatorAreaInErrorClear";          
            document.getElementById("ccvPassword").style.display = "none";
            document.getElementById(arrComposite[0]).style.backgroundColor = 'white';
            document.getElementById(arrComposite[1]).style.backgroundColor = 'white';
            args.IsValid = true;
            document.getElementById(arrComposite[0]).blur();
            document.getElementById(arrComposite[1]).blur();
            return;
        }
    }

    function ValidateRadio(source, args) {
        var RBL = document.getElementById(source.controltovalidate);
        var radio = RBL.getElementsByTagName("input");
        var validatorAreaid = source.id;
        var ctrToVal;
        var validatorArea;
        var curctl; curctl = RBL.id.split('_');
        var whichradio;//detect optin radio

        if (curctl[1] == undefined) { //for pages

            ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);
        }
        else {
            validatorAreaid = curctl[1];//for user controls
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + curctl[1]);
            whichradio = curctl[0] + '_rblOptIn_0';
        }

        if ((document.getElementById(whichradio) == null) || (document.getElementById(whichradio).checked)) {

            var isChecked = false;
            for (var i = 0; i < radio.length; i++) {
                if (radio[i].checked) {
                    isChecked = true;
                    break;
                }
            }
            if (!isChecked) {
                validatorArea.className = "validatorAreaInError";
               
                args.IsValid = false;
                return;
            }
           validatorArea.className="validatorAreaInErrorClear";
            args.IsValid = true;
            return;
        }
        validatorArea.className = "validatorAreaInErrorClear";
        args.IsValid = true;
        return;

    }

    function ValidateYearOfFinancialNeed(source, args) {
        var validatorAreaid = source.id;
        var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
        var validatorArea;
        validatorArea = document.getElementById('validationarea_' + ctrToVal);
        var sYearOfFinancialNeed = document.getElementById(ctrToVal).value;
        var bShowConfMessage = false;
        var sCurrentSchoolYear = document.getElementById("ddlSchoolYear").value; 
        switch (sYearOfFinancialNeed) {
            case '1':
                if (sCurrentSchoolYear == '6' || sCurrentSchoolYear == '7' || sCurrentSchoolYear == '8' || sCurrentSchoolYear == '9' || sCurrentSchoolYear == '10' || sCurrentSchoolYear == '11' || sCurrentSchoolYear == '12') {
                    bShowConfMessage = true;
                }
                break;
            case '2':
                if (sCurrentSchoolYear == '1' || sCurrentSchoolYear == '2' || sCurrentSchoolYear == '3' || sCurrentSchoolYear == '4' || sCurrentSchoolYear == '7' || sCurrentSchoolYear == '8' || sCurrentSchoolYear == '9' || sCurrentSchoolYear == '10' || sCurrentSchoolYear == '11' || sCurrentSchoolYear == '12') {
                    bShowConfMessage = true;
                }
                break;
            case '3':
                if (sCurrentSchoolYear == '1' || sCurrentSchoolYear == '2' || sCurrentSchoolYear == '3' || sCurrentSchoolYear == '4' || sCurrentSchoolYear == '5' || sCurrentSchoolYear == '8' || sCurrentSchoolYear == '9' || sCurrentSchoolYear == '10' || sCurrentSchoolYear == '11' || sCurrentSchoolYear == '12') {
                    bShowConfMessage = true;
                }
                break;
            case '4':
                if (sCurrentSchoolYear == '1' || sCurrentSchoolYear == '2' || sCurrentSchoolYear == '3' || sCurrentSchoolYear == '4' || sCurrentSchoolYear == '5' || sCurrentSchoolYear == '6' || sCurrentSchoolYear == '9' || sCurrentSchoolYear == '10' || sCurrentSchoolYear == '11' || sCurrentSchoolYear == '12') {
                    bShowConfMessage = true;
                }
                break;
            case '5':
                if (sCurrentSchoolYear == '1' || sCurrentSchoolYear == '2' || sCurrentSchoolYear == '3' || sCurrentSchoolYear == '4' || sCurrentSchoolYear == '5' || sCurrentSchoolYear == '6' || sCurrentSchoolYear == '7') {
                    bShowConfMessage = true;
                }
                break;
        }

        if (bShowConfMessage) {
            if (!confirm('Your current school year is:\n\n' + document.getElementById("ddlSchoolYear")[document.getElementById("ddlSchoolYear").selectedIndex].text + '\n\nhowever you are seeking financial assistance for the school year:\n\n' + document.getElementById("ddlFinancialYear")[document.getElementById("ddlFinancialYear").selectedIndex].text + '\n\nIf this is correct click OK or click Cancel to make changes.')) {
                validatorArea.className = "validatorAreaInError";         
                args.IsValid = false;
                return; 
            }
        }

        if (sYearOfFinancialNeed == '') {
            validatorArea.className = "validatorAreaInError";
            document.getElementById("ddlFinancialYear").style.backgroundColor = varErrorColorForClientSideErrors;      
            args.IsValid = false;
            return; 
        }

    validatorArea.className = "validatorAreaInErrorClear";
        args.IsValid = true;
        return;

    }

    function ValidateRange(oSrc, args) {
        validatorAreaid = oSrc.id;
        ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
        validatorArea = document.getElementById('validationarea_' + ctrToVal); 
        var maxv = oSrc.getAttribute("MaximumValue");
        var minv = oSrc.getAttribute("MinimumValue");
        document.getElementById(ctrToVal).style.backgroundColor = 'white';


        if ((vareventCapturebBnSubmit == 'btnSubmit') && (document.getElementById(ctrToVal).value.length >= 0) && (document.getElementById(ctrToVal).value != 0) && document.getElementById(ctrToVal).value <= parseInt(maxv) && document.getElementById(ctrToVal).value >= parseInt(minv)) {
        validatorArea.className = "validatorAreaInErrorClear";
            args.IsValid = true;
            return;
        }
        if ((document.getElementById(ctrToVal).value.length != 0) && !IsNumeric(document.getElementById(ctrToVal).value)) {
            validatorArea.className = "validatorAreaInError";
            args.IsValid = false;
            return;
        }
        else if ((document.getElementById(ctrToVal).value <= parseInt(maxv) && document.getElementById(ctrToVal).value >= parseInt(minv)) || (document.getElementById(ctrToVal).value.length == 0)) {
        validatorArea.className = "validatorAreaInErrorClear";
            args.IsValid = true; 
            return;

        }
        else {
            validatorArea.className = "validatorAreaInError";  
            args.IsValid = false;
            return;
        }
             

   
    validatorArea.className = "validatorAreaInErrorClear";
        args.IsValid = true;
        return;
    }

  
    var vareventCapturebBnRegisterScholarshipSearch;
    function eventCapturebBnRegisterScholarshipSearch(me) {
        vareventCapturebBnRegisterScholarshipSearch = me.id;
    }


    function clearContents(txtTextBox) {
        txtTextBox.value = '';
    }


    function submitPageAndRedirect(strDestination) {
        var frmForm = window.document.frmProfilePage;
        frmForm.action = frmForm.action + '?destination=' + strDestination;
        if (checkFields()) {
            frmForm.submit();
        }
    }

    function validateTextBox(oSrc, args) {
        var curctl; curctl = oSrc.id.split('_');
        var tbValue = args.Value;
        var divArea = oSrc.getAttribute("ValidationAreaID");
        var validationArea = curctl[0] + '_' + divArea;
       
       if (tbValue=="")  {
           document.getElementById(validationArea).className = "validatorAreaInError";
           oSrc.className = "customValidatorErrorSpan";
         args.IsValid = false;
        return;
       }
    else {
        validationArea.className = "validatorAreaInErrorClear";
        oSrc.className = "validatorAreaInErrorClear";
      args.IsValid = true;
        return;
       }



}

function validateZipCodeStandard(oSrc, args) {
    var curctl; curctl = oSrc.id.split('_');
    var tbValue = args.Value;
    var divArea = oSrc.getAttribute("ValidationAreaID");
    var validationArea = curctl[0] + '_' + divArea;

    if ((tbValue == "") || !IsNumeric(tbValue) || tbValue.length != 5) {
        document.getElementById(validationArea).className = "validatorAreaInError";
        oSrc.className = "customValidatorErrorSpan";
        document.getElementById(oSrc.controltovalidate).style.backgroundColor = varErrorColorForClientSideErrors;
        args.IsValid = false;
        return;
    }


    else {
        document.getElementById(validationArea).className = "validatorAreaInErrorClear";
        oSrc.className = "validatorAreaInErrorClear";
        document.getElementById(oSrc.controltovalidate).style.backgroundColor = "white";
        args.IsValid = true;
        return;
    }


}

    function validateDropDown(oSrc, args) {
        var curctl; curctl = oSrc.id.split('_');
        var validatorAreaid;
        var validatorArea;
        if (curctl[1] == undefined) {
            validatorAreaid = oSrc.id;
            var ctrToVal = document.getElementById(validatorAreaid).controltovalidate;
            validatorArea = document.getElementById('validationarea_' + ctrToVal);
        }
        else {
            validatorAreaid = curctl[1];
            validatorArea = document.getElementById(curctl[0] + '_' + 'validationarea_' + ctrToVal);  

        }

        if (document.getElementById(ctrToVal).options[document.getElementById(ctrToVal).selectedIndex].value == "") {
            validatorArea.className = "validatorAreaInError";
            document.getElementById(ctrToVal).style.backgroundColor = varErrorColorForClientSideErrors; 
            args.IsValid = false;
            return;
        }
     validatorArea.className = "validatorAreaInErrorClear";
        document.getElementById(ctrToVal).style.backgroundColor = 'white';
        args.IsValid = true;
        return;
    }                          


