var eleId = "ctl00_";

//3rent is invalid naming convention.
//

// Javascript Document
var ie4 = document.all;
var dom = document.getElementById;

function set_action(frm, action) { object = ie4 ? eval('document.all.' + frm) : document.getElementById(frm); if (object != '' && object != null) { object.action = action; } }

//v1.0 //Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) { return src.replace(/\?/, ext + '?'); } else { return src + ext; } }

function AC_Generateobj(objAttrs, params, embedAttrs) { var str = '<object '; for (var i in objAttrs) { str += i + '="' + objAttrs[i] + '" '; } str += '>'; for (var i in params) { str += '<param name="' + i + '" value="' + params[i] + '" /> '; } str += '<embed '; for (var i in embedAttrs) { str += i + '="' + embedAttrs[i] + '" '; } str += ' ></embed></object>'; document.write(str); }

function AC_FL_RunContent() { var ret = AC_GetArgs(arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash"); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); }

function AC_SW_RunContent() { var ret = AC_GetArgs(arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000", null); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); }

function AC_GetArgs(args, ext, srcParamName, classid, mimeType) { var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i = 0; i < args.length; i = i + 2) { var currArg = args[i].toLowerCase(); switch (currArg) { case "classid": break; case "pluginspage": ret.embedAttrs[args[i]] = args[i + 1]; break; case "src": case "movie": args[i + 1] = AC_AddExtension(args[i + 1], ext); ret.embedAttrs["src"] = args[i + 1]; ret.params[srcParamName] = args[i + 1]; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": case "codebase": ret.objAttrs[args[i]] = args[i + 1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "name": case "id": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1]; } } ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret; }

function printPage() {
    var sOption = "toolbar=yes,location=no,directories=yes,menubar=no,scrollbars=yes,width=550,height=500,left=100,top=25";
    var sTitle = document.title;
    var sUrl = document.location;

    var winprint = window.open("about:blank", "", sOption);
    var sTabs = '';
    winprint.document.open();

    /*
    objLogo=ie4? document.all.logo : document.getElementById('logo');
    objTestimonial=ie4? document.all.testimonial : document.getElementById('testimonial');
    objFooterPromo=ie4? document.all.footerpromo : document.getElementById('footerpromo');
    objInfoFooter=ie4? document.all.infofooter : document.getElementById('infofooter');
    if(objLogo != '' && objLogo != null){sLogo=objLogo.innerHTML;}else{sLogo="";}
    sTestimonial = "\n<div><br /><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" ><tr><td height=\"2\" align=\"left\" valign=\"top\" bgcolor=\"000000\"></td></tr>\n</table>\n</div><br />\n";
    if(objTestimonial != '' && objTestimonial != null){sTestimonial=objTestimonial.innerHTML+sTestimonial;}else{sTestimonial=""}
    sFooterPromo = "\n<div><br /><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" ><tr><td height=\"2\" align=\"left\" valign=\"top\" bgcolor=\"000000\"></td></tr>\n</table>\n</div><br />\n";
    if(objFooterPromo != '' && objFooterPromo != null){sFooterPromo=objFooterPromo.innerHTML+sFooterPromo;}else{sFooterPromo=""}
    sInfoFooter = "\n";
    if(objInfoFooter != '' && objInfoFooter != null){sInfoFooter=objInfoFooter.innerHTML+sInfoFooter;}else{sInfoFooter=""}
    <script type=\"text/JavaScript\">\nfunction turnoffreadlinks(){\nvar ie4=document.all;\nfor(i=1;i<5;i++){\nlinkobject=ie4? eval('document.all.enewslink'+i) : document.getElementById(\"enewslink\"+i);\nif(linkobject != '' && linkobject != null){linkobject.style.display='none';}}}</script>
    */

    objFooter = ie4 ? document.all.print_footer : document.getElementById('print_footer');
    if (objFooter != '' && objFooter != null) { sFooter = objFooter.innerHTML; } else { sFooter = ""; }

    objContent1 = ie4 ? document.all.print_content_one : document.getElementById('print_content_one');
    if (objContent1 != '' && objContent1 != null) { sContent1 = objContent1.innerHTML; } else { sContent1 = ""; }

    objContent2 = ie4 ? document.all.print_content_two : document.getElementById('print_content_two');
    if (objContent2 != '' && objContent2 != null) { sContent2 = "<hr noshade=\"noshade\" color=\"#335A83\" size=\"1px\" align=\"left\" class=\"no_padding\">" + objContent2.innerHTML + "<br /><br />"; } else { sContent2 = ""; }

    objContent3 = ie4 ? document.all.print_content_three : document.getElementById('print_content_three');
    if (objContent3 != '' && objContent3 != null) { sContent3 = objContent3.innerHTML; } else { sContent3 = ""; }

    winprint.document.write("<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/print.css\" >\n<title>" + sTitle + "</title>\n</head>\n<body>\n");
    winprint.document.write("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tr><td align=\"right\" valign=\"top\" id=\"strongprint\"><a href=\"javascript:window.print();\"><img src=\"/images/icons/printer.png\" border=\"0\" width=\"14\" height=\"14\" valign=\"bottom\"/></a></td><td width=\"13%\" align=\"right\"><a href=\"javascript:window.print();\">Print Page</a></td><td width=\"2%\" style=\"font-size:10px; font-weight:bold;\">&nbsp;|&nbsp;</td><td width=\"5%\"><a href=\"javascript:window.close();\">Close</a></td></tr></table>");
    winprint.document.write("<div><hr noshade=\"noshade\" color=\"#000000\" size=\"1px\" align=\"left\" class=\"no_padding\"></div>");
    /*
    winprint.document.write("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n");
    winprint.document.write("<tr><td align=\"left\">"+sLogo+"</td>");
    winprint.document.write("<td align=\"left\">&nbsp;&nbsp;&nbsp;<strong>"+sTitle+"</strong></td></tr>");
    winprint.document.write("\n<div><br /><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" ><tr><td height=\"2\" align=\"left\" valign=\"top\" bgcolor=\"000000\"></td></tr>\n</table>\n</div><br />\n");
    winprint.document.write(sTabs);
    winprint.document.write("\n<div><br /><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" ><tr><td height=\"2\" align=\"left\" valign=\"top\" bgcolor=\"000000\"></td></tr>\n</table>\n</div><br />\n");
    winprint.document.write(sTestimonial);
    winprint.document.write(sFooterPromo);
    winprint.document.write(sInfoFooter);
    winprint.document.write("<br /><br /><br />\n");
    winprint.document.write("National Rural Recruitment &amp; Retention Network for Healthcare Professionals<br /><br />");
    */
    winprint.document.write(sContent1);
    winprint.document.write(sContent2);
    winprint.document.write(sContent3);
    ////winprint.document.write("\n<p>&nbsp;</p>");
    winprint.document.write("<div><hr noshade=\"noshade\" color=\"#000000\" size=\"1px\" align=\"left\" class=\"no_padding\"></div>");
    winprint.document.write(sFooter);
    winprint.document.write("\n<div align=\"center\" class=\"website_address\">https://www.3rnet.org/</div>");
    winprint.document.write("\n</body>\n</html>");


    winprint.document.close();
    winprint.focus();
    //window.print()
    return false;
}



function check_uncheck(Val) {
    var ValChecked = Val.checked;
    var ValId = Val.id;
    var frm = document.forms[0];
    // Loop through all elements
    for (i = 0; i < frm.length; i++) {
        // Look for Header Template's Checkbox and Select/Deselect checkbox
        if (this != null) {
            if (ValId.indexOf('CheckAll') != -1 || ValId.indexOf('cboSelectDeselect') != -1) {
                // Check if checkbox is checked,
                // then select or deselect datagrid checkboxes
                if (ValChecked)
                    frm.elements[i].checked = true;
                else
                    frm.elements[i].checked = false;
            }
        }
    }
}
// TADemet (06/02/2010) - Passing in ClientID instead of hard coding control IDs
function professionSelected(ClientID) {

    objSecialty = Dom.get('ctl' + ClientID + '_divSpecialty');  //ie4 ? eval('document.all.ctl' + ClientID + '_divSpecialty') : document.getElementById('ctl' + ClientID + '_divSpecialty');
    objProfessionID = Dom.get('ctl' + ClientID + '_ddlProfessionID');  //ie4 ? eval('document.all.ctl' + ClientID + '_ddlProfessionID') : document.getElementById('ctl' + ClientID + '_ddlProfessionID');
    objtrSpecialtyPAorNP = Dom.get('ctl' + ClientID + '_trSpecialtyPAorNP');  //ie4 ? eval('document.all.ctl' + ClientID + '_trSpecialtyPAorNP') : document.getElementById('ctl' + ClientID + '_trSpecialtyPAorNP');
    objSpecialtyPAorNPID = Dom.get('ctl' + ClientID + '_ddlSpecialtyPAorNP');  //ie4 ? eval('document.all.ctl'+ ClientID + '_ddlSpecialtyPAorNP') : document.getElementById('ctl' + ClientID + '_ddlSpecialtyPAorNP');
    objPhysicianSpecialty = Dom.get('ctl' + ClientID + '_ddlSpecialty');  //ie4 ? eval('document.all.ctl' + ClientID + '_ddlSpecialty') : document.getElementById('ctl' + ClientID + '_ddlSpecialty');
    objPhysicianStatus = Dom.get('ctl' + ClientID + '_ddlProfessionalStatus');  //ie4 ? eval('document.all.ctl' + ClientID + '_ddlProfessionalStatus') : document.getElementById('ctl' + ClientID + '_ddlProfessionalStatus');

    var professionlength;
    var professionid;
    var specialtylength;
    var specialtyid;

    //Praveena 10/15/2009 check objProfessionID is not null
    if (objProfessionID) {
        professionlength = objProfessionID.length;
        professionid = "";
        for (i = 0; i < professionlength; i++) {
            if (objProfessionID.options[i].selected) {
                professionid = objProfessionID.options[i].value;
            }
        }
    }

    if (objtrSpecialtyPAorNP)  //Praveena 10/14/2009 added this line to avoid  errors on Components/controls/PublicOppurtunitySearch.ascx
    {
        if (professionid == "169" || professionid == "34") {
            objtrSpecialtyPAorNP.style.display = 'table-row';
        } else {
            objtrSpecialtyPAorNP.style.display = 'none';
        }
    }

    if (objSecialty)  //Praveena 10/14/2009 added this line to avoid  errors on Components/controls/PublicOppurtunitySearch.ascx
    {
        if (professionid == "60") {
            objSecialty.style.display = 'table-row';
        } else {
            objSecialty.style.display = 'none';
        }
    }

    //Praveena 10/13/2009
    var objProfessionID = Dom.get('ctl' + ClientID + '_ddlProfessionID');   //ie4 ? eval('document.all.ctl' +  + '_ddlProfessionID') : document.getElementById('ctl' + ClientID + '_ddlProfessionID');

    if (objProfessionID) {
        ProfessionIDlength = objProfessionID.length;
        ProfessionID = "";
        for (i = 0; i < ProfessionIDlength; i++) {
            if (objProfessionID.options[i].selected) {
                ProfessionID = objProfessionID.options[i].value;
            }
        }
    }
    //Test this and delete the following
    //     else {
    //         objProfReq = ie4 ? document.all.ctl00_divSpecialty : document.getElementById('ctl00_reqProfessionID');
    //         if (objProfReq) {
    //             objProfReq.enabled = false;
    //         }
    //     }

    var objProfessionIDOther = Dom.get('ctl' + ClientID + '_trProfessionOther');    //  ie4 ? document.all.ctl00_trProfessionOther : document.getElementById('ctl00_trProfessionOther');

    var objProfessionOtherrequired = Dom.get('ctl' + ClientID + '_valProfessionOther');    //ie4 ? document.all.ctl00_valProfessionOther : document.getElementById('ctl00_valProfessionOther');

    if (objProfessionIDOther) {
        if (ProfessionID == "37" || ProfessionID == "227") {
            var objlblProfessionOther = Dom.get('ctl' + ClientID + '_lblProfessionOther');
            if (objlblProfessionOther) {
                if (ProfessionID == "227") {
                    objlblProfessionOther.innerHTML = 'Hello World';
                } else {
                    objlblProfessionOther.innerHTML = 'Profession if &quot;Other&quot;';
                }
            }
            
            objProfessionIDOther.style.display = 'table-row';

            //Added for requiredfield validator 
            objProfessionOtherrequired.enabled = true;
            ValidatorUpdateDisplay(objProfessionOtherrequired)            

        } else {
            objProfessionIDOther.style.display = 'none';
            //Added for requiredfield validator
            objProfessionOtherrequired.enabled = false;
            ValidatorUpdateDisplay(objProfessionOtherrequired)
        }
    }

    if (objPhysicianSpecialty) {
        var PhysicianSpecialityId = "";
        for (i = 0; i < objPhysicianSpecialty.length; i++) {
            if (objPhysicianSpecialty.options[i].selected) {
                PhysicianSpecialityId = objPhysicianSpecialty.options[i].value;
                break;
            }
        }
        var objPhysicianSpecialtyOther = Dom.get('ctl' + ClientID + '_trSpecialtyOther');    //ie4 ? document.all.ctl00_trSpecialtyOther : document.getElementById('ctl00_trSpecialtyOther');
        var objPhysicianOtherrequired = Dom.get('ctl' + ClientID + '_reqSpecialtyOther');     //ie4 ? document.all.ctl00_reqSpecialtyOther : document.getElementById('ctl00_reqSpecialtyOther');
        if (PhysicianSpecialityId == "50") {
            objPhysicianSpecialtyOther.style.display = 'table-row';

            objPhysicianOtherrequired.enabled = true;
            ValidatorUpdateDisplay(objPhysicianOtherrequired);
        }
        else {
            objPhysicianSpecialtyOther.style.display = 'none';

            objPhysicianOtherrequired.enabled = false;
            ValidatorUpdateDisplay(objPhysicianOtherrequired);
        }
    }

    ///Should be added later

    if (objPhysicianStatus) {


        var PhysicianStatusId = ""
        for (i = 0; i < objPhysicianStatus.length; i++) {
            if (objPhysicianStatus.options[i].selected) {
                PhysicianStatusId = objPhysicianStatus.options[i].value;
                break;
            }
        }
        var objPhysicianSatusOther = Dom.get('ctl'+ ClientID + '_trProfessionStatusOther'); //ie4 ? document.all.ctl00_trProfessionStatusOther : document.getElementById('ctl00_trProfessionStatusOther');
        var objPhysicianStatusOtherrequired = Dom.get('ctl' + ClientID + '_valProfessionalStatusOther');   //ie4 ? document.all.ctl00_valProfessionalStatusOther : document.getElementById('ctl00_valProfessionalStatusOther');

        if (PhysicianStatusId == "41") {
            objPhysicianSatusOther.style.display = 'table-row';
            objPhysicianStatusOtherrequired.enabled = true;
            ValidatorUpdateDisplay(objPhysicianStatusOtherrequired);
        }
        else {
            objPhysicianSatusOther.style.display = 'none';
            objPhysicianStatusOtherrequired.enabled = false;
            ValidatorUpdateDisplay(objPhysicianStatusOtherrequired);

        }


    }
}

function countStates(lb) {
    //var lb = document.getElementById(sender.controltovalidate);
    var count = 0;
    var messageID = 'divErrorMessage';
    var containerID = 'divContainer';
    var lbPos = Dom.findPosition(lb);
    var bod = Dom.get(document.body);
    

    bod.style.position = 'relative';

    if (Dom.get(containerID) == null) {
        var container = document.createElement('div');
        container.id = containerID;
        container.style.position = 'absolute';
        container.style.zIndex = '101';
        container.style.left = lbPos[0] + 'px';
        container.style.top = lbPos[1] + lb.offsetHeight + 'px';
        container.style.height = '20px';
        container.style.width = '300px';
        //container.style.backgroundColor = '#ccc';
        Dom.add(container, bod);
    }

    // Add Events
    Event.add(window, 'resize', function () {
        //alert('Window Resize');
        var lbPos = Dom.findPosition(lb);
        //alert(lbPos[0]);
        Dom.get(containerID).style.left = lbPos[0] + 'px';
        Dom.get(containerID).style.top = lbPos[1] + lb.offsetHeight + 'px';
    });

    Event.add(window, 'load', function () {
        //alert('Window Load!');
        var lbPos = Dom.findPosition(Dom.get(eval(lb.id)));
        Dom.get(containerID).style.left = lbPos[0] + 'px';
        Dom.get(containerID).style.top = lbPos[1] + lb.offsetHeight + 'px';
    });

    for (i = 0; i < lb.length; i++) {
        if (lb.options[i].selected) {
            count++;
        }
    }
    //args.IsValid = count <= 6;

    if (count > 6) {
        if (Dom.get(messageID) == null) {
            var message = document.createElement("div");
            message.id = messageID;
            message.className = "validstar";
            message.innerHTML = "You may select up to six states of interest.";
            Dom.add(message, containerID);
        }
    } else {
        if (Dom.get(messageID) != null) { Dom.remove(Dom.get(messageID)); }
    }
}



var Dom = {
    get: function (el) {
        if (typeof el == 'string') {
            return document.all ? eval('document.all.' + el): document.getElementById(el);
        } else {
            return el;
        }
    },
    add: function (el, dest) {
        var el = this.get(el);
        var dest = this.get(dest);
        dest.appendChild(el);
    },
    remove: function (el) {
        var el = this.get(el);
        el.parentNode.removeChild(el);
    },
    findPosition: function (obj) {
        var curLeft = curTop = 0;
        if (obj.offsetParent) {
            curLeft = obj.offsetLeft;
            curTop = obj.offsetTop;

            while (obj = obj.offsetParent) {
                curLeft += obj.offsetLeft;
                curTop += obj.offsetTop;

            }
        }
        return [curLeft, curTop];
    }

};

var Event = {
    add: function() {
        if (window.addEventListener) {
            return function(el, type, fn) {
                Dom.get(el).addEventListener(type, fn, false);
            };
        } else if (window.attachEvent) {
            return function(el, type, fn) {
                var f = function() {
                    fn.call(Dom.get(el), window.event);
                };
                Dom.get(el).attachEvent('on' + type, f);
            };
        }
    } ()
};

function doClear(theText) {
    if (theText.value == theText.defaultValue) {
        theText.value = ""
    }
}

//default namespace. lead 3 is not allowed
rnet = {

    Email: {

        isExistingEmail: false,

        //is true if an email exist in the system
        //rnet.Email.findEmailAddress(accountType, emailaddress)
        findEmailAddress: function(accountType, email, successFn) {


            $.ajax({
                type: "POST",
                url: "/handlers/registration.ashx",
                data: ({ email: escape(email), accountType: accountType }),
                dataType: 'json',
                success: successFn
            });


        },

        regExEmail: function() {

            //ToDo: Add email regular express to check if email address is valid format on the client
            return true;
        }

    },

    //an array of professions that can have a specialty associated with it.
    getProfessionSpecialtyList: function() {
        return ['Physician', 'Nurse Practitioner (NP)', 'Physician Assistant (PA)'];
    },

    //Test if a given profession is in the specialty list
    isSpecialtyVisible: function(profession) {

        return ($.inArray(profession, rnet.getProfessionSpecialtyList()) == -1) ? false : true;

    }


};

/*****************************************************************************************
*  facilities section. All facilities JS places here
******************************************************************************************/
facilities = {


    register: {

        init: function() {

            $('#isExistingEmail').hide();

            //add handler to email input onChange event
            $('#ctl00_txtEmailAddress').change(facilities.register.checkEmail);

        },

        //check email input value
        checkEmail: function() {
            //call function to check email
            rnet.Email.findEmailAddress("facilityAccount", this.value, facilities.register.doResponse);
        },

        //function to execute when server resp
        doResponse: function(data) {

            var isExistingEmail = document.getElementById('isExistingEmail');
            $(isExistingEmail).hide();
            if (data.isExistingEmail) {
                $(isExistingEmail).show();
            }
        }


    },

    faq: {

        isChanged: false,

        init: function() {


            $('#ctl00_bodyContent_faqEditPanel_saveBtn').hide();
            $('#editHtml').hide();

            //$('#editHtml').change(facilities.faq.change);

            $('#editBtn').click(facilities.faq.edit);


            $('#cancelBtn').click(facilities.faq.cancel);

            $('#previewBtn').click(facilities.faq.preview);

            $('#editHtml').change(facilities.faq.change);

            $('#editBtn').attr('disabled', false);

        },

        save: function() {

            return false;
        },

        edit: function() {


            $('#faqHtml').hide();

            $('#editHtml').val($('#faqHtml').html());

            $('#editHtml').show();

            $('#editBtn').attr('disabled', true);


        },

        cancel: function() {


            $('#faqHtml').show();

            $('#editHtml').val("");

            $('#editHtml').hide();

            $('#previewHtml').hide();

            $('#ctl00_bodyContent_faqEditPanel_finalHtml').val("");

            $('#editBtn').attr('disabled', false);
            $('#ctl00_bodyContent_faqEditPanel_saveBtn').hide();

        },

        preview: function() {

            var html = $('#editHtml').val();

            $('#faqHtml').hide();
            if (html == "")
                $('#previewHtml').html("There are no changes to preview. Click 'edit' or 'cancel' to continue.");
            else
                $('#previewHtml').html($('#editHtml').val());

            $('#previewHtml').show();

            $('#editHtml').hide();

            $('#ctl00_bodyContent_faqEditPanel_finalHtml').val(html);

            if (facilities.faq.isChanged)
                $('#ctl00_bodyContent_faqEditPanel_saveBtn').show();

        },

        change: function() {
            facilities.faq.isChanged = true;

        }

    },

    formInit: function() {

        var profession = $('#ctl00_ddlProfessionSpecialtyID :selected').text();

        if (!rnet.isSpecialtyVisible(profession))
            $('#ctl00_trSpecialtyPAorNP').hide();

        if (profession != 'Other')
            $('#ctl00_trProfessionOther').hide();


        $('#ctl00_ddlProfessionSpecialtyID').change(function() {

            profession = $('#' + this.id + ' :selected').text();


            var ddlSpecialtyPAorNP = document.getElementById('ctl00_ddlSpecialtyID');

            if (profession == 'Other') {

                $('#ctl00_trSpecialty').hide();
                $('#ctl00_trProfessionOther').show();
                ddlSpecialtyPAorNP.selectedIndex = 0
            }
            else if (!rnet.isSpecialtyVisible(profession)) {
                $('#ctl00_trProfessionOther').hide();
                $('#ctl00_trSpecialty').hide();
                ddlSpecialtyPAorNP.selectedIndex = 0
            }
            else {
                $('#ctl00_trProfessionOther').hide();
                $('#ctl00_trSpecialty').show();
            }
        });

    }

};

/*****************************************************************************************
*  candidates section. All facilities JS places here
******************************************************************************************/
candidates = {


    registrationFormInit: function() {



        $('#ctl00_trProfessionOther').hide();

        $('#ctl00_trSpecialtyPAorNP').hide();
        $('#ctl00_ddlProfessionID').change(function() {

            if ($('#' + this.id + ' :selected').text() == 'Other') {
                $('#ctl00_trSpecialtyPAorNP').hide();
                $('#ctl00_trProfessionOther').show();
            }
            else {
                $('#ctl00_trProfessionOther').hide();
                $('#ctl00_trSpecialtyPAorNP').show();
            }
        });



    }

};

// addded 10-16-2009  for candidate signup page
function otherSelected(controlid,subID) {
    //ctl08_ddlVisaStatus
    if (controlid.indexOf('ddlVisaStatus') != -1) {
        var objVisastatus = Dom.get(controlid);  //ie4 ? document.all.ctl00_ddlVisaStatus : document.getElementById(controlid);

            if (objVisastatus) {
                visaStatuslength = objVisastatus.length;
                visaStatusid = "";
                for (i = 0; i < visaStatuslength; i++) {
                    if (objVisastatus.options[i].selected) {
                        visaStatusid = objVisastatus.options[i].value;
                    }
                }
            }
            var objVisastatusOther = Dom.get('ctl' + subID + '_trVisastatusOther'); ;  //ie4 ? document.all.ctl00_trVisastatusOther : document.getElementById('ctl00_trVisastatusOther');

            //11/06/2009 Added to  enable\disable Reqiredfield validator for VisaStatusOther textbox
            var objVisastatusOtherrequired = Dom.get('ctl' + subID + '_valVisaStatusOther');   // ie4 ? document.all.ctl00_valVisaStatusOther : document.getElementById('ctl00_valVisaStatusOther');

            //Praveena 10/15/2009 check objVisastatusOther is not null
            if (objVisastatusOther) {
                if (visaStatusid == "56") {
                    objVisastatusOther.style.display = 'table-row';

                    //Added for requiredfield validator 
                    objVisastatusOtherrequired.enabled = true;
                    ValidatorUpdateDisplay(objVisastatusOtherrequired)

                } else {
                    objVisastatusOther.style.display = 'none';
                    //Added for requiredfield validator
                    objVisastatusOtherrequired.enabled = false;
                    ValidatorUpdateDisplay(objVisastatusOtherrequired)
                }
            }
    } else if (controlid.indexOf('ddlHowHeard') != -1) {
        var objHowHeard = Dom.get(controlid);//  ie4 ? document.all.ctl00_ddlHowHeard : document.getElementById(controlid);

            if (objHowHeard) {
                howHeardlength = objHowHeard.length;
                howHeardid = "";
                for (i = 0; i < howHeardlength; i++) {
                    if (objHowHeard.options[i].selected) {
                        howHeardid = objHowHeard.options[i].value;
                    }
                }
            }
            var objHowheardOther = Dom.get('ctl' + subID + '_trHeardofOther');  //ie4 ? document.all.ctl00_trHeardofOther : document.getElementById('ctl00_trHeardofOther');

            //11/06/2009 Added to  enable\disable Reqiredfield validator for HoeheardOther
            var objHowheardOtherrequired = Dom.get('ctl' + subID + '_valHearOfOther');  //ie4 ? document.all.ctl00_valHearOfOther : document.getElementById('ctl00_valHearOfOther');

            //Praveena 10/15/2009 check objVisastatusOther is not null
            if (objHowheardOther) {
                if (howHeardid == "28") {
                    objHowheardOther.style.display = 'table-row';
                    objHowheardOtherrequired.enabled = true;
                    ValidatorUpdateDisplay(objHowheardOtherrequired);
                } else {
                    objHowheardOther.style.display = 'none';
                    objHowheardOtherrequired.enabled = false;
                    ValidatorUpdateDisplay(objHowheardOtherrequired);
                }
            }
    }
    
    switch (controlid) {
        case 'ctl00_ddlVisaStatus':
           break;

        case 'ctl00_ddlHowHeard':
            break;
    }
}


var hash = {
    'pdf': 1,
    'doc': 1
};

function check_extension(filename) {
    var re = /\..+$/;
    var ext = filename.match(re);
    if (hash[ext]) {
        return true;
    } else {
        alert("Invalid filename, please select another file");
        return false;
    }
}





function getQuerystring(key, default_) {
    if (default_ == null) default_ = "";
    key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
    var qs = regex.exec(window.location.href);
    if (qs == null)
        return default_;
    else
        return qs[1];
}
$(document).ready(function () {
    var count = 3;
    var interval = 30;
    initBanners(count);
    //var functionCall = "rotateBanner(" + count + ")";
    //var oInterval = setInterval(functionCall, interval * 1000);
    //$('#clickme').click(function () { rotateBanner(2); });
});

function initBanners(count) {
    $('#banner_list > li').each(function (index) {
        if (index < count) {
            $(this).css({ 'display': 'block' });
            $(this).width($(this).find('img').width());
            $(this).find('.banner_title').width($(this).find('img').width());
        }
    });
}
function rotateBanner(count) {
    $('#banner_list > li:first').fadeToggle('slow', 'linear', function () {
        $('#banner_list').append($('li:first'));
        var listItem = $('#banner_list > li').filter(function (index) { return index == count - 1 });
        listItem.fadeToggle('slow', 'linear', function () {
            $(this).find('.banner_title').width($(this).find('img').width());
        });
    });
}

