render_html = function(output, regionId, append){ if(append == undefined || typeof append != "boolean"){ append = false; } if(output == undefined || typeof output != "string"){ output = ""; } if(regionId == undefined || typeof regionId != "string"){ if(document.write){ document.write(output); return true; }else{ alert('Unable to render html; document.write unavailable, and no region is defined'); } }else{ if(document.getElementById){ if(document.getElementById(regionId) != null){ if(append){ document.getElementById(regionId).innerHTML += output; }else{ document.getElementById(regionId).innerHTML = output; } }else{ alert('Unable to render html; region \''+ regionId +'\' doesn\'t exist'); } }else{ alert('Unable to render html; region \''+ regionId +'\' specified, but document.getElementById is unavailable'); } } return false; } function str_replace(search, replace, subject){ return subject.replace(new RegExp(search,"g"), replace); } function enable(id) { document.getElementById(id).disabled = false; } function disable(id) { document.getElementById(id).disabled = true; } function show(id, mode) { if(typeof mode == "undefined"){ mode = "block"; } document.getElementById(id).style.display = mode; } function hide(id) { document.getElementById(id).style.display = "none"; } function select_by_value(control, text) { var i = 0; var len = control.options.length; for(i = 0; i < len; i++){ if(control.options[i].value == text){ control.selectedIndex = i; return true; } } return false; } function is_array(arr){ return (typeof arr == "object" && arr.length); } function trim(str) { return (str.replace(/^(\s)*/, '')).replace(/(\s)*$/, ''); }