//***** //***** Function to display a tool tip. //***** @version $Id: util.js,v 1.2 2016/09/13 04:49:14 hardtj Exp $ //***** @param obj - Object to display the tool tip for //***** @param msg - Message to display //***** @param displayseconds - *Optional* Number of seconds to display the tool tip //***** @return void //***** var HideTipTimer = 0; function tooltips(obj,msg,displayseconds) { //alert('calltooltips'); // If not passed in set the default value for the optional displayseconds parameter displayseconds = (typeof(displayseconds)=="undefined") ? 10 : displayseconds; // Figure out where the input field object is on the screen by adding // up all the offsets for all the containing parent objects var obj_pos = FindPosition(obj); var tip_left = obj_pos[0]; var tip_top = obj_pos[1]; // Add obj height to top position so tip box DIV will show up underneath "obj" tip_top += obj.clientHeight; // Create DIV tag object through DOM to hold the "tip" message (if it does not already exist) if (document.getElementById("tip") == null) { tipdiv = document.createElement("div"); document.body.appendChild(tipdiv); tipdiv.setAttribute("id", "tip"); } else { // Div Tag allready esists, clear out old timer and get reference to it clearTimeout(HideTipTimer); tipdiv = document.getElementById("tip"); tipdiv.style.display="none"; // Hide any old message tipdiv.innerHTML = ""; } // Position tip box DIV tipdiv.style.zIndex = "500"; tipdiv.style.position = "absolute"; tipdiv.style.top = tip_top + "px"; tipdiv.style.left = tip_left + "px"; // Roughly figure how how wide to make tip box DIV based on the number // of characters in the message. If max width is exceeded then just use max width var iFontSize = 10; var iCharWidth = iFontSize / 2; // Assume characters are half as wide as they are tall var iMaxWidth = 250; var iNumChars = msg.length; var tip_width = (iNumChars * iCharWidth + 6 > iMaxWidth ) ? iMaxWidth : iNumChars * iCharWidth + 6; tipdiv.style.width = tip_width + "px"; // Format the appearance of tip box DIV tipdiv.style.fontFamily = "Arial"; tipdiv.style.fontSize = iFontSize + "px"; tipdiv.style.backgroundColor = "lightyellow"; tipdiv.style.border = "1px solid black"; tipdiv.style.padding = "2px 2px 2px 4px"; tipdiv.style.textAlign = "left"; // If message is empty then set display type to hide tip box DIV (msg != "") ? display_type = "block" : display_type = "none"; // Show/hide div and assign the message to the tip box tipdiv.style.display = display_type; tipdiv.innerHTML = msg; // If tip is being displayed then wait 10 seconds then hide the tip box DIV if (display_type == "block") { var cmd = 'document.getElementById("tip").style.display="none";'; displayseconds = displayseconds * 1000; HideTipTimer = setTimeout(cmd,displayseconds); } } function showAlert(message, control) { // This is used to resolve infinite loops on onblur calls in Chrome. It seems to be a bug in chrome that the onblur call is repeated every time Ok is pressed on an alert message. var event = control.onblur; control.onblur = null; alert(message); setTimeout(function () { control.focus(); control.onblur = event; }, 0); } function grayOut(vis, options) { // Pass true to gray out screen, false to ungray // options are optional. This is a JSON object with the following (optional) properties // opacity:0-100 // Lower number = less grayout higher = more of a blackout // zindex: # // HTML elements with a higher zindex appear on top of the gray out // bgcolor: (#xxxxxx) // Standard RGB Hex color code // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'}); // Because options is JSON opacity/zindex/bgcolor are all optional and can appear // in any order. Pass only the properties you need to set. var options = options || {}; var zindex = options.zindex || 50; var opacity = options.opacity || 70; var opaque = (opacity / 100); var bgcolor = options.bgcolor || '#000000'; var dark=document.getElementById('darkenScreenObject'); if (!dark) { // The dark layer doesn't exist, it's never been created. So we'll // create it here and apply some basic styles. // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917 var tbody = document.getElementsByTagName("body")[0]; var tnode = document.createElement('div'); // Create the layer. tnode.style.position='absolute'; // Position absolutely tnode.style.top='0px'; // In the top tnode.style.left='0px'; // Left corner of the page tnode.style.overflow='hidden'; // Try to avoid making scroll bars tnode.style.display='none'; // Start out Hidden tnode.id='darkenScreenObject'; // Name it so we can find it later tbody.appendChild(tnode); // Add it to the web page dark=document.getElementById('darkenScreenObject'); // Get the object. } if (vis) { // Calculate the page width and height if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) { var pageWidth = document.body.scrollWidth+'px'; var pageHeight = document.body.scrollHeight+'px'; } else if( document.body.offsetWidth ) { var pageWidth = document.body.offsetWidth+'px'; var pageHeight = document.body.offsetHeight+'px'; } else { var pageWidth='100%'; var pageHeight='100%'; } //set the shader to cover the entire page and make it visible. dark.style.opacity=opaque; dark.style.MozOpacity=opaque; dark.style.filter='alpha(opacity='+opacity+')'; dark.style.zIndex=zindex; dark.style.backgroundColor=bgcolor; dark.style.width= pageWidth; dark.style.height= pageHeight; dark.style.display='block'; } else { dark.style.display='none'; } } // This function will trim all fields in the form by calling the trimSpace function function trimAll() { // strips leading and trailing spaces for (i=0; i < document.forms[0].elements.length; i++) { var str = document.forms[0].elements[i].value; if ( (str != null) && (str != "") ) document.forms[0].elements[i].value = trimSpaces(document.forms[0].elements[i].value); } } // This function is for stripping leading and trailing spaces function trimSpaces(str) { if ( (str != null) && (str != "") ) { var i; for (i=0; i < str.length; i++) { if (str.charAt(i)!=" ") { str=str.substring(i,str.length); break; } } for (i = str.length-1; i >= 0; i--) { if (str.charAt(i)!=" ") { str = str.substring(0,i+1); break; } } if (str.charAt(0)==" ") { return ""; } else { return str; } } return str; } // fct to return a short str (20 chars) after stripping all ', ", new line function cleantext(text) { var str = trimSpaces(text); if ( (str != null) && (str.length > 0) ) { if (str.length > 20) str = str.substring(0,20) + "..."; str = str.replace('\'','`'); str = str.replace('"',''); str = str.replace('\n',''); } return str; } function cleanandconfirm(text) { var str = "Deleting '" + cleantext(text) + "' - Press OK to proceed."; if (confirm(str)) return true; return false; } // Check or Uncheck checkboxes in the form function checkboxes(checkchar, mode) { if (document.forms[0].elements.length > 1) { for (i=0; i= 4) { win.window.focus(); } } function opendemo(path) { var w = 600; var h = 400; var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops2 = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; win = window.open(path, 'demogroup', winprops2); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function opengshelp(id, dirLevel) { //alert(id + " " + dirLevel); var lvl = getDirLevel(dirLevel); var jsp = lvl + 'help2.jsp' + id; var w = 400; var h = 250; var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops3 = 'height='+h+',width='+w+',top='+w+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; win = window.open(jsp, 'helptext', winprops3); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function openPopupLocation(width, height, location) { //alert ("Popupw " + screen.availWidth + "/" + screen.availHeight); var w = width; var h = height; if (w == 0) w=600; if (h == 0) h=400; var winl = ((screen.availWidth-30) - w) / 2; var wint = ((screen.availHeight-50) - h) / 2; winprops4 = 'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; //winprops4 = 'height=' + h + ',width=' + w + ',top=' + wint + ',screenY=' + wint + ',left=' + winl + ',screenX=' + winl + ',scrollbars=yes,resizable=yes,menubar=no,status=yes'; //alert(winprops4); win = window.open(location, 'popup', winprops4); win.window.focus(); } function getDirLevel(dirLevel) { //alert(dirLevel); var lvl = ''; if ( dirLevel != 1 ) { for (i = 0; i < dirLevel; i++) { lvl = lvl + '../'; } lvl = lvl + 'jsp/'; } return lvl; } // note menubar adds at least 100 pixels to overall height function popupw(width, height) { //alert ("Popupw " + screen.availWidth + "/" + screen.availHeight); var w = width; var h = height; if (w == 0) w=600; if (h == 0) h=400; var winl = ((screen.availWidth-30) - w) / 2; var wint = ((screen.availHeight-50) - h) / 2; winprops4 = 'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; //winprops4 = 'height=' + h + ',width=' + w + ',top=' + wint + ',screenY=' + wint + ',left=' + winl + ',screenX=' + winl + ',scrollbars=yes,resizable=yes,menubar=no,status=yes'; //alert(winprops4); win = window.open('', 'popup', winprops4); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function popupbuilder(width, height) { var w = width; var h = height; if (w == 0) w=600; if (h == 0) h=400; var winl = ((screen.availWidth-30) - w) / 2; var wint = ((screen.availHeight-50) - h) / 2; winprops4 = 'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; win = window.open('', 'popupbuilder', winprops4); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function popupw2(width, height, wname) { var w = width; var h = height; if (w == 0) w=600; if (h == 0) h=400; if ( (screen.width-w) < 100 ) w=screen.width-100; //always makes popup smaller than the available screen if ( (screen.height-h) < 100 ) h=screen.height-100; var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; //alert(w+" ds "+h+" "+winl+" "+wint+" "+screen.width+" "+screen.height); winprops5 = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; win = window.open('', wname, winprops5); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function popupwvrs() { var w = 700; var h = 600; if (w == 0) w=600; if (h == 0) h=400; var winl = ((screen.availWidth-30) - w) / 2; var wint = ((screen.availHeight-50) - h) / 2; winprops4 = 'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; win = window.open('b_viewallvrs.jsp', 'popup', winprops4); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function popupreview(width, height) { //alert('popup review'); var w = width; var h = height; if (w == 0) w=600; if (h == 0) h=400; var winl = ((screen.availWidth-30) - w) / 2; var wint = ((screen.availHeight-50) - h) / 2; winprops4 = 'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar=no,status=yes'; win = window.open('', 'preview', winprops4); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function popup_submit(width, height, frm, act) { var action = act; var form = frm; popupreview(width, height); eval('document.' + form + '.action.value=\'' + action + '\'' ); eval('document.' + form + '.submit()'); return true; } function Comma(number) { number = '' + number; var neg = 0; if ( (number.substring(0,1) == "-")&&(number.length > 4) ) { neg = 1; number = number.substring(1, number.length); } if ((number.length > 3)&&(number.substring(0,1) != "-")) { var mod = number.length % 3; var output = (mod > 0 ? (number.substring(0,mod)) : ''); for (i=0 ; i < Math.floor(number.length / 3); i++) { if ((mod == 0) && (i == 0)) output += number.substring(mod+ 3 * i, mod + 3 * i + 3); else output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3); } if (neg ==1) { output = "-"+output; } return (output); } else return number; } function isNumberTest(c) { var test = "" + c; if ( test == "0" || test == "1" || test == "2" || test == "3" || test == "4" || test == "5" || test == "6" || test == "7" || test == "8" || test == "9" || test == "-" || test == ".") { return true; } else { return false; } } function setCommas(elm, precision, maxchar) { var test = elm.value; var idx; var v; var vdec; //alert(test + " - " + precision); if (precision == 0) { // if precision = 0 then throw away the ., if any idx = test.indexOf("."); //alert("Period idx " + idx); if (idx >= 0) elm.value = test.substring(0, idx); //string.substring(from, to) - not including to idx } v = stripComma(elm.value); elm.value = v; FillVal(elm, maxchar); // new TD 4/2/10 - after filling w/ commas, fix # to given precision if (precision > 0) { test = elm.value; idx = test.indexOf("."); if (idx >= 0 && idx != (test.length-1)) //there is a . but it's not at the end { v = test.substring(0, idx); vdec = test.substring(idx +1); //read all decimals if (vdec.length > precision) //too many decimals { vdec = test.substring(idx+1, idx + precision + 1); elm.value = v + "." + vdec; } } } } function validate(elm, precision, maxchar) { if (elm != null) { var test = elm.value; test = stripComma(test); for (var k = 0; k < test.length; k++) { var c = test.substring(k, k+1); if ( (k > 0 && c == "-") ||((k == 0) && (test.length==1) && (c == "-"))) { showAlert("A negative sign ('-') is only allowed in front of a number. If you wish to enter a negative number, please use the format '-###' (e.g. '-100').", elm); elm.focus(); return false; } if (isNumberTest(c) == false) { showAlert(c + " is not a number. Please enter a number. Note: $ < > = + symbols are NOT allowed.", elm); elm.focus(); return false; } if ((precision == 0) && (c == ".")) //strip out . in setCommas above { //alert("Decimals are not allowed for this number."); //elm.focus(); //return false; } } try { var fl = parseFloat(test); if ( !isNaN(fl) ) { var result = fl.toFixed(precision); elm.maxLength = maxchar + 1; elm.value = result; FillVal(elm, maxchar); } } catch ( e ) { } } return true; } function FillVal(element, maxchar) { var numCommas = 1;//adjust for decimal var nStr = element.value; nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); numCommas++; } var kd = x1 + x2; var newL = maxchar + numCommas; element.maxLength = newL; element.value = kd; //alert(kd); } function addCommas(form1) { for (var i=0, j=form1.elements.length; i= 0) { numvar = numvar + invar.substring(startidx,endidx); startidx = endidx + 1; } numvar = numvar + invar.substring(startidx,invar.length); invar = numvar; what = invar; //.value return what; } function validateta(c) { var test = c.value; var len = test.length; if (test.length > 2000) { showAlert("This field cannot be greater than 2000 characters in length. It is currently "+len+" characters long. Please limit it to 2000 characters.", c); c.focus(); return false; } return true; } function CheckNullInput(c) { var test = c.value; var len = test.length; if (len == 0) { showAlert("Please enter a value for this input field!", c); c.focus(); return false; } return true; } function downloadWarn() { return (confirm("This may take a few minutes - press OK to proceed. For some browser, use right-click and select 'Save Target As...'.")); } var dlcount=0; function downloadWarn2() { if (dlcount == 0) { if (confirm("This may take a few minutes - press OK to proceed. For some browser, use right-click and select 'Save Target As...'.")) { dlcount++; return true; } else return false; } else { alert("Please wait for the previous download to finish."); return false; } } var spsltcount=0; function selectPanelWarn() { if (spsltcount == 0) { if (confirm("Depending on the panel size, this may take a few minutes - press OK to proceed.")) { spsltcount++; return true; } else return false; } else { alert("Please wait..."); return false; } } var survcount=0; function selectSurvWarn() { if (survcount == 0) { if (confirm("Depending on the survey size, this may take a few minutes - press OK to proceed.")) { survcount++; return true; } else return false; } else return false; } var disurvcount=0; function disableSurvWarn() { if (disurvcount == 0) { if (confirm("Deactivating survey - press OK to proceed.")) { disurvcount++; return true; } else return false; } else return false; } var survcount=0; function selectSurvWarnSubmit(formx) { var id = eval('document.' + formx + '.survId.value'); //alert (id); if (survcount == 0) { if (id != 0) { if (confirm("Depending on the survey size, this may take a few minutes - press OK to proceed.")) { survcount++; //alert(formx); eval('document.' + formx + '.submit()'); return true; } else return false; } } else return false; } function openSurvAtts() { if ( selectSurvWarn() ) { popupw(700,650); return true; } else { return false; } } var filtercount=0; function filterWarn() { if (filtercount == 0) { filtercount++; document.forms[0].submit(); } else { alert("Please wait..."); } } function filterpanelWarn() { if (filtercount == 0) { if (confirm("Creating a panel for this filtered result set - press OK to proceed.")) { filtercount++; return true; } else return false; } else { alert("Please wait..."); return false; } } var delpanelcount=0; function deletePanelWarn() { if (delpanelcount == 0) { if (confirm("Deleting this survey panel - press OK to proceed.")) { delpanelcount++; return true; } else return false; } else { alert("Please wait..."); return false; } } var canceluploadpanelwarn=0; function cancelUploadPanelWarn() { if (canceluploadpanelwarn == 0) { if (confirm("Stop current upload on next record - press OK to proceed.")) { canceluploadpanelwarn++; return true; } else return false; } else { alert("Please wait..."); return false; } } var sortpanelcount=0; function sortPanelWarn(type) { if (sortpanelcount == 0) { if ( ((type==1) && (confirm("Sort this panel by ID - press OK to proceed."))) || ((type==2) && (confirm("Sort this panel by Name - press OK to proceed."))) || ((type==3) && (confirm("Sort this panel by Org. ID - press OK to proceed."))) || ((type==4) && (confirm("Sort this panel by Org. Name - press OK to proceed."))) || ((type==5) && (confirm("Sort this panel by County - press OK to proceed."))) ) { sortpanelcount++; return true; } else return false; } else { alert("Retrieving panel members - Please wait..."); return false; } } function valCheckboxes(form1) { for (var i=0, j=form1.elements.length; i -1 && idx2 > -1 && idx1 < idx2) { document.forms[0].reportName.value = report.substring(idx1 + 9, idx2); } document.forms[0].reportUrl.value = report; document.forms[0].submit(); } function openBirtReportStateAddendum(report, actionUrl) { document.forms[0].reportName.value = report; document.forms[0].reportUrl.value = actionUrl; document.forms[0].submit(); } function openreport(slt) { var w = 700; var h = 500; var winl = (screen.width - w) / 2; var wint = ((screen.height - h) / 2)-10; var ind=slt.selectedIndex; if (ind == 0) { alert ("Please select a valid report format option."); } else { var report = slt.options[ind].value; winprops = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; win = window.open(report, 'Report', winprops); } } function openprint(slt,slt2) { var report = "" var report2 = "" var w = 700; var h = 500; var winl = (screen.width - w) / 2; var wint = ((screen.height - h) / 2)-10; var ind=slt.selectedIndex; var ind2=slt2.selectedIndex; if (ind == 0) { alert ("Please select a valid report format option!"); } else { report = slt.options[ind].value; report2 = slt2.options[ind2].value; var final_report = report+report2; winprops = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; win = window.open(final_report, 'Report', winprops); } } function openBirtPrint(slt,slt2,slt3,desname) { var report = ""; var report2 = ""; var report3 = ""; var reportjs = ""; var w = 700; var h = 500; var winl = (screen.width - w) / 2; var wint = ((screen.height - h) / 2)-10; var ind=slt.selectedIndex; var ind2=slt2.selectedIndex; var ind3=slt3.selectedIndex; if (ind == 0) { alert ("Please select a valid report format option!"); } else { report = slt.options[ind].value; var final_report = report; if (report.indexOf('hardcopy_survey.pdf?v=2') == -1) { if (desname != null && desname != '') { report = report.replace('CACHE','mail'); report = report.replace('cache','mail'); report = report.replace('LOCALFILE','mail'); report = report.replace('localfile','mail'); var i = report.indexOf('desname'); report = report.substring(0,i)+'desname='+desname+'+from="surveysupport@aha.org"+schedule=now'; alert("A separate window will open letting you know that your request has been received. You may close the window and continue working. You should receive your survey via email shortly."); } report2 = slt2.options[ind2].value; report3 = slt3.options[ind3].value; if (report.indexOf('asprint.rptdesign') >= 0 && ind3 != 0) { //for non-spreadsheet options for historical years, use the historical version if (ind3 == 1) { report = report.replace('asprint.rptdesign', 'asprint_hist_1.rptdesign'); } else if (ind3 == 2) { report = report.replace('asprint.rptdesign', 'asprint_hist_2.rptdesign'); } else if (ind3 == 3) { report = report.replace('asprint.rptdesign', 'asprint_hist_3.rptdesign'); } else if (ind3 == 4) { report = report.replace('asprint.rptdesign', 'asprint_hist_4.rptdesign'); } } var final_report = report+report2+report3; } //winprops = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; //win = window.open(final_report, 'Report', winprops); openBirtReport2(final_report); } } function openAHABirtReport(slt,slt2) { var report = ""; var report2 = ""; var reportjs = ""; var w = 700; var h = 500; var winl = (screen.width - w) / 2; var wint = ((screen.height - h) / 2)-10; var ind=slt.selectedIndex; var ind2=slt2.selectedIndex; if (ind == 0) { alert ("Please select a valid report format option."); } else if ((ind2 == 0) && (slt2.options[ind2].value != "0")) { alert ("Please select a state"); } else { var state_id = ""; //if (slt2.options[ind2].value != "0") { state_id = slt2.options[ind2].value; //} report = slt.options[ind].value; report2 = "&p_state_id="+state_id; var final_report = report+report2; //winprops = 'height='+h+',width='+w+',top='+wint+',screenY='+wint+',left='+winl+',screenX='+winl+',scrollbars,resizable,menubar'; //win = window.open(final_report, 'Report', winprops); openBirtReport2(final_report); } } function noSAHist() { // alerts user that history is not available for State Addendum var j = 0; var k = document.forms[0].PrtOption.options.length; for(var i=0;i 0) // current year listed first, then historical years { j++; } if (j == 2) { alert("No history is available for the State Addendum. Please choose another option."); document.forms[0].PrtDate.options.selectedIndex = 0; } return true; } function enableDisableSectionF() { // alerts user that history is not available for State Addendum //alert("hi"); var j = 0; var k = document.forms[0].PrtDate.options.length; var m = 0; var n = document.forms[0].PrtOption.options.length; for(var i=0;i 2012) { for(var m=0;m 0) { document.forms[0].PrtOption.options[m].disabled = true; } } } else { for(var m=0;m 0) { document.forms[0].PrtOption.options[m].disabled = false; } } } } } return true; } // only check for checkbox, text and textarea null fields - TD 03/16/04 function areFieldsEmpty() { //alert("Number of fields: " + document.forms[0].elements.length); for ( var i=0; i 0) ) return false; else if ( (document.forms[0].elements[i].type == "textarea") && (document.forms[0].elements[i].value.length > 0) ) { //alert ("Text area: " + document.forms[0].elements[i].value.length); return false; } } //alert("Returns True for areFieldsEmpty()"); return true; } function MM_noactdeact(ownerOrg) { alert("Please contact " + ownerOrg + " to activate or deactivate your survey."); } function exportSubmit() { document.downloadForm.submit(); } function commentsExportSubmit() { document.commentsDownloadForm.submit(); } // adding back for numeric fields that do not have commas autofilled JH 12/11/07 function validate_nocommas(elm, precision,maxchar) { if (elm != null) { var test = elm.value; for (var k = 0; k < test.length; k++) { var c = test.substring(k, k+1); if ( (k > 0 && c == "-") ||((k == 0) && (test.length==1) && (c == "-"))) { showAlert("A negative sign ('-') is only allowed in front of a number. If you wish to enter a negative number, please use the format '-###' (e.g. '-100').", elm); elm.focus(); return false; } if (isNumberTest(c) == false) { showAlert(c + " is not a number. Please enter a number. Note: $ < > = + symbols are NOT allowed.", elm); elm.focus(); return false; } if ((precision == 0) && (c == ".")) { showAlert("Decimals are not allowed for this number.", elm); elm.focus(); return false; } } try { var fl = parseFloat(test); if ( !isNaN(fl) ) { var result = fl.toFixed(precision); elm.maxLength = maxchar + 1; elm.value = result; //FillVal(elm,maxchar); } } catch ( e ) { } } return true; }