var _N = null, _W = window, movieWindow = _N, focusInterval = _N, imageWindow = _N, oOpts = _N, sSel = _N, sTable = _N, sFilter = _N;

function enableInputFocusFeatures(id){
    var inputs = document.getElementsByTagName("input");
    var validInputs = new Array();
    var startStr = "i_" + id + "_";
    for( var i = 0; i < inputs.length; i++){
        if(inputs[i].id.substring(0,startStr.length) == startStr){
            validInputs[validInputs.length] = inputs[i];
        }
    }
    for( var i = 0; i < validInputs.length; i++){
        validInputs[i].onkeypress = function(){
            var e = _W.event;
            var keyCode = e.keyCode?e.keyCode:e.which?e.which:e.charCode;
            if(keyCode == 32){
                this.parentNode.onclick();
            }
            return false;
        }
    }
}
function getKeyCode(e){
    return e.keyCode?e.keyCode:e.which?e.which:e.charCode;
}
function validateUserName(obj,e,len){
    if(obj.value.length >= len)
        return false;
    var keyCode = getKeyCode(e);
    return isValidUsernameKey(keyCode);
}
function userNameChanged(obj,len,errObj){
    if(obj.value != ""){
        var objVal = obj.value.toLowerCase(), newObjValue = "", errorFound = false;
        for( var i = 0; i < objVal.length; i++){
            if(!isValidUsernameKey(objVal.charCodeAt(i))){
                errorFound = true;
            }else{
                newObjValue += objVal.substring(i,i + 1);
            }
        }
        if(newObjValue.length > len){
            newObjValue = newObjValue.substring(0,len - 1);
            errorFound = true;
        }
        obj.value = newObjValue;
        if(errorFound && errObj){
            errObj.innerText = " Invalid charcters were removed.";
        }else if(errObj){
            errObj.innerText = "";
        }
    }
}
function isValidUsernameKey(keyCode){
    if(keyCode == 8 || (keyCode > 34 && keyCode < 40) || keyCode == 9 || keyCode == 42 || keyCode == 44 || keyCode == 45 || keyCode == 46 || (keyCode >= 48 && keyCode <= 57) || keyCode == 64 || (keyCode >= 65 && keyCode <= 90) || keyCode == 95 || (keyCode >= 97 && keyCode <= 122)){
        return true;
    }else{
        return false;
    }
}
/*
 * function submitF() { var sizes = getPageSizeWithScroll();
 * $("resubPreventer").style.height = sizes[1] + "px";
 * $("resubPreventer").style.width = sizes[0] + "px";
 * $("resubPreventer_iframe").style.height = sizes[1] + "px";
 * $("resubPreventer_iframe").style.width = sizes[0] + "px";
 * $("resubPreventer").style.display = "block";
 * $("resubPreventer_iframe").style.display = "block";
 * document.forms[0].submit(); }
 */
var toolTipTimeout = _N, toolTipObj = _N, toolTipShim = _N, toolTipContent = _N;
function showToolTip(triggerId,contentId,offset,width){
    position = getPos($(triggerId));
    if(toolTipTimeout)
        hideToolTip();
    if(!width)
        width = 250;
    if(!offset)
        offset = { x :0, y :0 };
    if(!toolTipObj)
        toolTipObj = $("toolTipObj");
    if(!toolTipShim)
        toolTipShim = $("toolTipShim");
    if(!toolTipContent)
        toolTipContent = $("toolTipContent");
    toolTipContent.innerHTML = $(contentId).innerHTML;
    toolTipObj.style.width = width + "px";
    toolTipShim.style.width = width + "px";
    toolTipShim.style.display = "block";
    toolTipObj.style.display = "block";
    toolTipObj.style.top = ((position.y + offset.y) - toolTipObj.offsetHeight) + "px";
    toolTipShim.style.top = ((position.y + offset.y) - toolTipObj.offsetHeight) + "px";
    toolTipObj.style.left = (position.x - offset.x) + "px";
    toolTipShim.style.left = (position.x - offset.x) + "px";
    toolTipShim.style.height = toolTipObj.offsetHeight - 8;
}
function startToolTipTimer(){
    toolTipTimeout = _W.setTimeout("hideToolTip()",1500);
}
function hideToolTip(){
    clearToolTipTimer();
    if(toolTipObj)
        toolTipObj.style.display = "none";
    if(toolTipShim)
        toolTipShim.style.display = "none";
}
function clearToolTipTimer(){
    if(toolTipTimeout)
        _W.clearTimeout(toolTipTimeout);
}
function performFilter(selId,tbId){
    var obj = $(selId);
    var letterPts = obj.value.split("-");
    var startLetter = letterPts[0];
    var endLetter = letterPts[1];
    var table = $(tbId);
    var rows = table.childNodes[0].childNodes;
    var showAll = false;
    if(obj.selectedIndex == 0){
        showAll = true;
    }
    for( var i = 0; i < rows.length; i++){
        if(!showAll){
            var namePts = $eit(rows[i]).split(",");
            var lastName = namePts[0];
            var lastNameLetters = lastName.substring(0,1);
            if(lastName.length > 1)
                lastNameLetters = lastName.substring(0,2);
            if(lettersWithinRange(lastNameLetters,startLetter.toLowerCase(),endLetter.toLowerCase())){
                rows[i].style.display = "inline";
            }else{
                rows[i].style.display = "none";
            }
        }else{
            rows[i].style.display = "inline";
        }
    }
}
function lettersWithinRange(letters,start,end){
    var firstLetter = letters.substring(0,1).toLowerCase();
    var secondLetter = "";
    if(letters.length > 1)
        secondLetter = letters.substring(1,2).toLowerCase();
    var greaterThanStart = false;
    var lessThanEnd = false;
    if(firstLetter > start.substring(0,1)){
        greaterThanStart = true;
    }else if(firstLetter == start.substring(0,1)){
        if(secondLetter >= start.substring(1,2)){
            greaterThanStart = true;
        }
    }
    if(firstLetter < end.substring(0,1)){
        lessThanEnd = true;
    }else if(firstLetter == end.substring(0,1)){
        if(secondLetter <= end.substring(1,2)){
            lessThanEnd = true;
        }
    }
    return (greaterThanStart && lessThanEnd);
}
var dateValid = true;
function validateDate(obj){
    if(obj.value.length == 10){
        var datePts = obj.value.split("/");
        var validM = false;
        var validD = false;
        var validY = false;
        if((datePts[0] * 1 < 13) && (datePts[0] * 1 > 0)){
            validM = true;
        }
        if((datePts[1] * 1 < 32) && (datePts[1] * 1 > 0)){
            validD = true;
        }
        if(datePts[2] * 1 < 2020 && datePts[2] * 1 > 1900){
            validY = true;
        }
        if(validD && validM && validY){
            dateValid = true;
            obj.style.border = "solid 1px gray";
        }else{
            dateValid = false;
            obj.style.border = "solid 1px red";
        }
    }else{
        if(obj.value != ""){
            dateValid = false;
            obj.style.border = "solid 1px red";
        }else{
            dateValid = true;
            obj.style.border = "solid 1px gray";
        }
    }
}
function performProcedureFilter(path,filter,table){
    table.parentNode.style.backgroundImage = "url('/css/images/loading.jpg')";
    table.parentNode.style.backgroundPosition = "center center";
    table.parentNode.style.backgroundRepeat = "no-repeat";
    table.style.display = "none";
    sTable = table;
    sFilter = filter;
    if(sSel == _N){
        sSel = $(table.id.substring(2,table.id.length));
    }
    if(oOpts == _N){
        oOpts = new Array();
        var o = sSel.options;
        for( var i = 0; i < o.length; i++){
            oOpts[i] = new Array(o[i].value,o[i].text);
        }
    }
    sSel.options.length = 0;
    _W.setTimeout("filterTheTable()",1);
}
function filterTheTable(){
    var l = oOpts.length;
    for( var i = 0; i < l; i++){
        if(sFilter == "custom"){
            if(oOpts[i][1].indexOf("C ") == 0){
                sSel.options[sSel.options.length] = new Option(oOpts[i][1],oOpts[i][0]);
            }
        }else if(sFilter == "standard"){
            if(oOpts[i][1].indexOf("S ") == 0){
                sSel.options[sSel.options.length] = new Option(oOpts[i][1],oOpts[i][0]);
            }
        }else if(sFilter == "draft"){
            if(oOpts[i][1].indexOf("D ") == 0){
                sSel.options[sSel.options.length] = new Option(oOpts[i][1],oOpts[i][0]);
            }
        }else if(sFilter == "notes"){
            if(oOpts[i][1].indexOf("src=") != -1){
                sSel.options[sSel.options.length] = new Option(oOpts[i][1],oOpts[i][0]);
            }
        }else{
            sSel.options[sSel.options.length] = new Option(oOpts[i][1],oOpts[i][0]);
        }
    }
    if(sFilter == "custom"){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "inline";
        $("custFilter_off").style.display = "none";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(sFilter == "draft"){
        $("draftFilter_on").style.display = "inline";
        $("draftFilter_off").style.display = "none";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(sFilter == "standard"){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "none";
        $("standFilter_on").style.display = "inline";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(sFilter == "notes"){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "none";
            $("noteFilter_on").style.display = "inline";
        }
    }else if(sFilter == ""){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }
    document.body.removeChild(sTable.parentNode);
    sSel.style.visibility = "visible";
    clearSInterval(sSel.id);
    new Scroller(sSel.id,"sT",0,0);
}
function notNullOrBlank(val){
    return val != _N && val != "";
}
var continueResizing = true;
var resizableObjs = new Array();
var resizeInterval = _N;


var resizing=false;
function resizeWithScreen(obj, spaceFromBottom){
    obj.spaceFromBottom=spaceFromBottom; 
    resizableObjs.push(obj);
    resizeElements();
    window.onresize=function(){
        if(!resizing){
            resizing=true;
            window.setTimeout(function(){
                resizeElements();                
            },50);
        }
        return false;               
   }
}

function resizeElements(){
    resizing=false;
    if(continueResizing){
        var h = (getClientHeight() * 1) - 50;
        for( var i = 0; i < resizableObjs.length; i++){
            try{
                resizableObjs[i].topPosition = getPos(resizableObjs[i]).y;
                var newBottom = (h - resizableObjs[i].spaceFromBottom) * 1;
                var newHeight = newBottom - (resizableObjs[i].topPosition * 1);
                resizableObjs[i].style.height = newHeight + "px";
            }catch(ignored){
            }
        }
    }
}
function getClientHeight(){
    return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);
}
function f_filterResults(n_win,n_docel,n_body){
    var n_result = n_win?n_win:0;
    if(n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body))?n_body:n_result;
}
function getPos(inputElement){
    var coords = new Object();
    coords.x = 0;
    coords.y = 0;
    try{
        targetElement = inputElement;
        if(targetElement.x && targetElement.y){
            coords.x = targetElement.x;
            coords.y = targetElement.y;
        }else{
            if(targetElement.offsetParent){
                coords.x += targetElement.offsetLeft;
                coords.y += targetElement.offsetTop;
                while(targetElement = targetElement.offsetParent){
                    coords.x += targetElement.offsetLeft;
                    coords.y += targetElement.offsetTop;
                }
            }else{
            }
        }
        return coords;
    }catch(error){
        return coords;
    }
}
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){
    var curtop = 0;
    if(obj.offsetParent){
        while(obj.offsetParent){
            curtop += obj.offsetTop;
            obj = obj.offsetParent;
        }
    }else if(obj.y)
        curtop += obj.y;
    return curtop;
}
function validateKeyPress(obj,e,maxLength){
    if(obj.value.length < maxLength){
        var keyCode = getKeyCode(e);
        if(keyCode != 13 && keyCode != 34){
            return true;
        }
    }
    return false;
}
String.prototype.replaceAll = function(s1,s2){
    return this.split(s1).join(s2)
};
function replaceAll(field,origStr,newStr){
    var returnString = "";
    for( var i = 0; i <= field.length; i++){
        if(field.substring(i,i + 1) == origStr)
            returnString += newStr;
        else
            returnString += field.substring(i,i + 1);
    }
    return returnString;
}
function loadChecklist(id){
    $("actionSource").value = "otherChecklistClicked";
    $("checklistId").value = id;
    document.forms[0].submit();
}
function b_mOver(btnId){
    var btn = $(btnId);
    if(btn.className == 'middleButtonPart'){
        btn.style.color="#0181c8"
    }
}
function b_mOut(btnId){
    var btn = $(btnId);    
    if(btn.style.color=="#0181c8"||(btn.style.color+"")=="rgb(1, 129, 200)"){
        btn.style.color="#000000"
    }
}
function b_click(btnId){
    var btn = $(btnId);
    if(btn.className.indexOf("ray") == -1){
        $("a_" + btnId).onclick();
    }
}
function b_kPress(btnId,obj,e,onclick){
    var keyCode = getKeyCode(e);
    if(keyCode == 13 || keyCode == 32){
        b_click(btnId);
    }else if(keyCode == 9){
        return true;
    }
    return false;
}
function sb_mOver(btnId){
    var btn = $(btnId);
    if(btn.className == 'middleSearchButtonPart'){
        btn.className = 'middleSearchButtonPartOver';
    }
}
function sb_mOut(btnId){
    var btn = $(btnId);
    if(btn.className == 'middleSearchButtonPartOver'){
        btn.className = 'middleSearchButtonPart';
    }
}
function sb_click(btnId){
    var btn = $(btnId);
    if(btn.className.indexOf("ray") == -1){
        $("a_" + btnId).onclick();
    }
}
function sb_kPress(btnId,obj,e,onclick){
    var keyCode = getKeyCode(e);
    if(keyCode == 13 || keyCode == 32){
        b_click(btnId);
    }else if(keyCode == 9){
        return true;
    }
    return false;
}
function enableButton(btnId){
    var btn = document.getElementById(btnId);
    if(btn){
        if(btn.className != "middleButtonPart" && btn.className != "middleButtonPartOver"){
            btn.className = "middleButtonPart";
        }
    }
}
function disableButton(btnId){
    var btn = document.getElementById(btnId);
    if(btn){
        if(btn.className != "middleButtonPartGray"){
            btn.className = "middleButtonPartGray";
        }
    }
}
function openTab(obj){
    var txt = $eit(obj);
    {
        if(txt == "Skills Checklists"){
            $("actionSource").value = "competencyChecklistsTabClicked";
        }else if(txt == "Procedure"){
            $("actionSource").value = "stepByStepTabClicked";
        }else if(txt == "Videos"){
            $("actionSource").value = "videosTabClicked";
        }else if(txt == "Images"){
            $("actionSource").value = "artTabClicked";
        }else if(txt == "Quick Lists"){
            $("actionSource").value = "quickListTabClicked";
        }
        document.forms[0].submit();
    }
}
function openATab(obj){
    var txt = $eit(obj);
    if(txt){
        if(txt == "Users"){
            $("actionSource").value = "maintainUsersTabClicked";
        }else if(txt == "Procedures"){
            $("actionSource").value = "maintainProceduresTabClicked";
        }else if(txt == "Skills Checklists"){
            $("actionSource").value = "maintainChecklistsTabClicked";
        }else if(txt == "Skills Checklist Records"){
            $("actionSource").value = "competencyChecklistRecordsTabClicked";
        }else if(txt == "Institution Setup"){
            $("actionSource").value = "maintainInstitutionsTabClicked";
        }else if(txt == "Quick Lists"){
            $("actionSource").value = "maintainQuicklistsTabClicked";
        }else if(txt == "Facility"){
            $("actionSource").value = "maintainFacilityTabClicked";
        }else if(txt == "Videos"){
            $("actionSource").value = "maintainVideos";
        }else if(txt == "Images"){
            $("actionSource").value = "maintainImages";
        }else if(txt == "Updates"){
            $("actionSource").value = "procedureUpdates";
        }
        document.forms[0].submit();
    }
}
function $(id){
    var elem = document.getElementById(id);
    if(elem)
        return elem;
    var elems = document.all?document.all:document.getElementsByTagName('*');
    for( var i = 0; i < elems.length; i++){
        if(elems[i].name){
            if(elems[i].name == id){
                return elems[i];
            }
        }
    }
    return _N;
}
function searchClicked(){
    var o = new StringBuffer("<table width='100%' height='140px'><tr><td valign='middle' align='center' style='font-weight:bold; font-size:16px'>Please Wait...</td></tr></table>");
    var str = document.getElementById("titleOrFullText").checked?"full text":"title";
    document.location.href = "/lnp/search.do?actionSource=search&searchQuery=" + document.getElementById("searchQuery").value + "&titleOrFullText=" + str +"&q="+document.getElementById("searchQuery").value
    try{
       Prompt(o.toString(), "div");
    }catch(ignored){}
}
function clickLink(url){
    var a = document.createElement("a");
    a.href = url;
    a.innerHTML = "&nbsp;";
    document.body.appendChild(a);

}
function logoutClicked(){
    try{
        document.location.href = "procedureSelect.do?actionSource=logout";
    }catch(exception){
        alert(exception.description);
    }
}
function searchButtonKeyPressed(obj,e){
    var keyCode = getKeyCode(e);
    if(keyCode == 13 || keyCode == 23){
        if(obj.value != ""){
            searchClicked();
        }
    }
    return false;
}
function searchPressCheck(obj,e){
    var keyCode = getKeyCode(e);
    if(keyCode == 13){
        if(obj.value != ""){
            searchClicked();
        }
        return false;
    }
    return true;
}
function searchKeyUp(obj){
    cleanQuery(obj);
    if(obj.value != ""){
        $("searchButton").className = "middleSearchButtonPart";
    }else{
        $("searchButton").className = "middleSearchButtonPartGray";
    }
}
function cleanQuery(obj){
    var val = obj.value, newval = obj.value.replaceAll("\\","");
    if(val != newval){
        obj.value = newval;
    }
}
function setupSearch(){
    if(document.getElementById("searchQuery").value != 'Enter Keywords'){
        $("searchButton").className = "middleSearchButtonPart";
    }
}
function getPageSizeWithScroll(){
    if(_W.innerHeight && _W.scrollMaxY){
        yWithScroll = _W.innerHeight + _W.scrollMaxY;
        xWithScroll = _W.innerWidth + _W.scrollMaxX;
    }else if(document.body.scrollHeight > document.body.offsetHeight){
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    }else{
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }
    arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
    return arrayPageSizeWithScroll;
}
function openFlashMovie(flashId){
    movieWindow = _W.open("./form/flashPlayer.jsp?flashId=" + flashId,_N,"height=300,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
    if(!movieWindow.closed){
        _W.setTimeout("movieWindow.focus();",100);
    }else{
        alert("Please disable your popup blocker in order to view this video.");
    }
}
function focusOnMovieWindow(){
    if(movieWindow.closed){
        _W.clearInterval(focusInterval);
    }else{
        movieWindow.focus();
    }
}
function suppressSection(checkbox,section,sectionId){
    if(checkbox.checked){
        removeSuppressedSection(section);
    }else{
        addSuppressedSection(section);
    }
    var sectionHeader = $("span_" + sectionId);
    if(sectionHeader){
        if(checkbox.checked){
            sectionHeader.style.display = "inline";
        }else{
            sectionHeader.style.display = "none";
        }
    }
    var divs = document.getElementsByTagName("div");
    for( var i = 0; i < divs.length; i++){
        if(divs[i].className){
            if(divs[i].className.toUpperCase() == section.toUpperCase()){
                if(checkbox.checked){
                    divs[i].style.display = "block";
                }else{
                    divs[i].style.display = "none";
                }
            }
        }
    }
}
function addSuppressedSection(field){
    var ss = $("sectionsSuppressed");
    var fields = ss.value.split(";");
    if(fields.length > 0 && fields[0] != ""){
        ss.value = ss.value + ";" + field;
    }else{
        ss.value = field;
    }
}
function removeSuppressedSection(field){
    var ss = $("sectionsSuppressed");
    var fields = ss.value.split(";");
    var newSSVal = "";
    for(i = 0; i < fields.length; i++){
        if(fields[i] != field && fields[i] != ""){
            if(newSSVal.length > 0)
                newSSVal += ";" + fields[i];
            else
                newSSVal += fields[i];
        }
    }
    ss.value = newSSVal;
}
String.prototype.trim = function(){
    var s = this.replace(/^\s*/,"");
    return s.replace(/\s*$/,"");
};
String.prototype.fix = function(){
    if(this && this != _N){
        if(this.length > 0){
            var newThis = this.replaceAll("'","").replaceAll('"','').replaceAll("-"," "), parts = newThis.split(" ");
            newThis = "";
            for( var i = 0; i < parts.length; i++){
                if(parts[i].trim().length > 0){
                    newThis += parts[i].substring(0,1).toUpperCase() + parts[i].substring(1,parts[i].length);
                    if(i + 1 < parts.length){
                        newThis += "_";
                    }
                }
            }
            return newThis;
        }
    }
    return "";
};
function $eit(obj){
    var t = obj.innerText;
    if(!t){
        t = obj.textContent;
    }
    return t;
}
function allowTabs(e){
    var keyCode = getKeyCode(e);
    if(keyCode == 9){
        return true;
    }
    return false;
}
function buttonKeyPressed(obj,e){
    var keyCode = getKeyCode(e);
    if(keyCode == 13){
        try{
            obj.parentNode.onclick();
        }catch(e){
        }
    }
}
function resizeModalWindow(w,h){
    var wPts = w.split("px");
    var hPts = h.split("px");
    var nw = wPts[0] * 1 + 20;
    var nh = hPts[0] * 1 + 30;
    DIALOG.resizeDialog(nw,nh);
}
function StringBuffer(str){
    this.buf = [];
    if(str)
        this.buf.push(str);
    this.append = function(str){
        this.buf.push(str);
    };
    this.toString = function(){
        return this.buf.join("");
    };
}
String.prototype.startsWith = function(str){
    if(this != null){
        return this.indexOf(str) == 0;
    }
    return false;
};
window.onready = DomReady;
function DomReady(a){
    if(document.addEventListener){
        document.addEventListener("DOMContentLoaded",a,false)
    }else{
        document.onreadystatechange = function(){
            readyState(a)
        }
    }
}
function readyState(a){
    if(document.readyState == "interactive" || document.readyState == "complete"){
        a()
    }
}
function removeFilter(){
    handleFilterButtons(-1);
    filter_box.removeFilter();
}
function setFilter(filter){
    handleFilterButtons(filter);
    filter_box.filter(filter);
}
function handleFilterButtons(num,enable){
    if(num == 2){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "inline";
        $("custFilter_off").style.display = "none";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(num == 3){
        $("draftFilter_on").style.display = "inline";
        $("draftFilter_off").style.display = "none";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(num == 1){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "none";
        $("standFilter_on").style.display = "inline";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }else if(num == 4){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "none";
            $("noteFilter_on").style.display = "inline";
        }
    }else if(num == -1){
        $("draftFilter_on").style.display = "none";
        $("draftFilter_off").style.display = "inline";
        $("custFilter_on").style.display = "none";
        $("custFilter_off").style.display = "inline";
        $("standFilter_off").style.display = "inline";
        $("standFilter_on").style.display = "none";
        if($("noteFilter_off")){
            $("noteFilter_off").style.display = "inline";
            $("noteFilter_on").style.display = "none";
        }
    }
}
function submitF(){
    pleaseWait();
}
var filter_box;

function pleaseWait(override){
    var o = new StringBuffer("<table width='100%' height='140px'><tr><td valign='middle' align='center' style='font-weight:bold; font-size:16px'>Please Wait...</td></tr></table>");
    Prompt(o.toString(),"div");
    if(!override){
        window.setTimeout(function(){
            document.forms[0].submit();
        },150);
    }
}
function openClineguideWindow(){
    var url = $("clineguide_url").value;
    if(navigator.userAgent.indexOf("MSIE 7.0") > -1){
        var c_window = window.open(url,'clineguide_window','status=0,resizable=1,menubar=1,toolbar=1,scrollbars=1,location=1,width=1000,height=700');
    }else{
        var c_window = window.open(url,'clineguide_window','status=0,resizable=1,menubar=1,toolbar=1,scrollbars=1,location=0,width=1000,height=700');
    }
    if(!c_window.closed){
        c_window.focus();
    }else{
        alert("Please disable your pop-up blocker and try again.");
    }
}
function printProcedures(){
    var o = new StringBuffer(), dt = new Date();
    if(navigator.userAgent.indexOf("MSIE 7.0") > -1){

        o.append("<p align='center' style='font-size:22pt; font-weight:bold'>Lippincott's Nursing Procedures and Skills<br/>List of Procedures</p>");
        o.append("<p align='center' style='font-size:18pt'>");
    }else{
        o.append("<p align='center' style='font-size:14pt; font-weight:bold'>Lippincott's Nursing Procedures and Skills<br/>List of Procedures</p>");
        o.append("<p align='center' style='font-size:11pt'>");

    }
    o.append((dt.getUTCMonth() * 1 + 1) + "/" + dt.getUTCDate() + "/" + dt.getFullYear() + " " + (dt.getHours() > 12?dt.getHours() - 12:dt.getHours()) + ":" + (dt.getMinutes() < 10?("0" + dt.getMinutes()):dt.getMinutes()) + ":" + (dt.getSeconds() < 10?("0" + dt.getSeconds()):dt.getSeconds()) + (dt.getHours() > 12?"PM":"AM") + "</p>");

    if(navigator.userAgent.indexOf("MSIE 7.0") > -1){
        o.append("<p style='font-size:18pt'>");
    }else{
        o.append("<p style='font-size:12pt'>");

    }

    o.append("<b>Nursing Category: " + ($("nursingCategory").value != null && $("nursingCategory").value != undefined?$("nursingCategory").value:"none selected") + "<br/>");
    o.append("Clinical Category: " + ($("clinicalCategory").value != null && $("clinicalCategory").value != undefined?$("clinicalCategory").value:"none selected") + "</b><br/><br/>");

    var opts = $("procedureId").options, optsLen = opts.length;
    for( var i = 0; i < optsLen; i = i + 1){
        o.append(opts[i].text + "<br/>");
    }
    o.append("</p>");
    $("printTitle").value = "Lippincott Williams & Wilkins - List of Procedures";
    $("printContent").value = o.toString();
    $("printForm").submit();
}
function newPrintProcedures(){
    var o = new StringBuffer(), dt = new Date();
    if(navigator.userAgent.indexOf("MSIE 7.0") > -1){

        o.append("<p align='center' style='font-size:22pt; font-weight:bold'>Lippincott's Nursing Procedures and Skills<br/>List of Procedures</p>");
        o.append("<p align='center' style='font-size:18pt'>");
    }else{
        o.append("<p align='center' style='font-size:14pt; font-weight:bold'>Lippincott's Nursing Procedures and Skills<br/>List of Procedures</p>");
        o.append("<p align='center' style='font-size:11pt'>");

    }
    o.append((dt.getUTCMonth() * 1 + 1) + "/" + dt.getUTCDate() + "/" + dt.getFullYear() + " " + (dt.getHours() > 12?dt.getHours() - 12:dt.getHours()) + ":" + (dt.getMinutes() < 10?("0" + dt.getMinutes()):dt.getMinutes()) + ":" + (dt.getSeconds() < 10?("0" + dt.getSeconds()):dt.getSeconds()) + (dt.getHours() > 12?"PM":"AM") + "</p>");

    if(navigator.userAgent.indexOf("MSIE 7.0") > -1){
        o.append("<p style='font-size:18pt'>");
    }else{
        o.append("<p style='font-size:12pt'>");

    }

    o.append("<b>Nursing Category: " + ($("nursingCategory").value != null && $("nursingCategory").value != undefined?$("nursingCategory").value:"none selected") + "<br/>");
    o.append("Clinical Category: " + ($("clinicalCategory").value != null && $("clinicalCategory").value != undefined?$("clinicalCategory").value:"none selected") + "</b><br/><br/>");

    var opts = $("procedures").getElementsByTagName("dd"), optsLen = opts.length;
    for( var i = 0; i < optsLen; i = i + 1){
        o.append(opts[i].childNodes[0].innerHTML + "<br/>");
    }
    o.append("</p>");
    $("printTitle").value = "Lippincott Williams & Wilkins - List of Procedures";
    $("printContent").value = o.toString();
    $("printForm").submit();
}