/***************************** * common javascript library * *****************************/ var useslayers; var usesdocall; var usesdom; (document.layers) ? useslayers = true : useslayers = false; (document.all) ? usesdocall = true : usesdocall = false; (document.getelementbyid) ? usesdom = true : usesdom = false; /** * given a destination element id and a piece of text, sets the * text of the element. used to allow interactive data point display * with svg charts */ function postmessage(evt, dest, text) { try { eltochange = document.getelementbyid(dest); eltochange.innerhtml = text; } catch (e) { alert("no element with the following id was found: " + dest); } } /** * sets units based upon user selection. * function def.'s required: * setunits */ function determineandsetunits(newunitsidx) { switch (newunitsidx) { case 1: setunits("metric"); break; case 2: setunits("us"); break; case 3: setunits(""); break; default: break; } } /** * displays recalculate button in the page header. * global variable def.'s required: * needrecalc */ function displayrecalcmsg(flag) { needrecalc = flag; setvisible("recalcmsgheader", flag, window.top.selectionbody); } /** * displays the save button at the specified location. */ var header = 1; var footer = 2; var header_and_footer = 3; function displaysavebutton(flag, type) { switch (type) { case header: setvisible("savebuttonheader", flag, top.navbar); break; case footer: setvisible("savebuttonfooter", flag, top.footer); break; case header_and_footer: setvisible("savebuttonheader", flag, top.navbar); setvisible("savebuttonfooter", flag, top.footer); break; } } /** * hides/shows a twistie section on the page. * global variable def.'s required: org_images_path */ function displaytwistiesection(twistiesection, twistiegraphic) { displaytwistiesectionandspecifysave(twistiesection, twistiegraphic, true); } function displaytwistiesectionandspecifysave(twistiesection, twistiegraphic, savetoform) { displaytwistiesectionandspecifysavewithorgimagepath(twistiesection, twistiegraphic, savetoform, org_images_path); } function displaytwistiesectionandspecifysavewithorgimagepath(twistiesection, twistiegraphic, savetoform, orgimagespath) { displaytwistiesection_shared(twistiesection, twistiegraphic, orgimagespath, savetoform, false); } /** * converts a number using regional settings into a simple decimal format * consisting of no digit grouping symbols, and a period as the decimal symbol. * this conversion is necessary in order to compare numbers in javascript that * use regional settings. */ function getsimpledecimalformat(originalnum, digitgroupingsymbol, decimalsymbol) { var newstring = ""; var retval = ""; //alert('originalnum='+originalnum); //alert('digitgroupingsymbol='+digitgroupingsymbol); //alert('decimalsymbol='+decimalsymbol); // build new number string without digit grouping symbols for (i = 0; i < originalnum.length; i++) { if (originalnum.charat(i) != digitgroupingsymbol) { newstring = newstring + originalnum.charat(i); } } // convert decimal symbol to period for (i = 0; i < newstring.length; i++) { if (newstring.charat(i) == decimalsymbol) { // replace with period retval = retval + "."; } else { // otherwise just copy character retval = retval + newstring.charat(i); } } //alert('retval='+retval); return retval; } /** * converts a number from simple decimal format, * consisting of no digit grouping symbols, and a period as the decimal symbol * back into a number in the user's locale * this conversion is necessary in order to restore compared numbers in javascript that * use regional settings. */ function getoriginaldecimalformat(originalnum, decimalsymbol) { var originalstring = new string(originalnum); var retval = ""; //alert('originalnum='+originalnum); //alert('decimalsymbol='+decimalsymbol); // convert period to decimal symbol for (i = 0; i < originalstring.length; i++) { if (originalstring.charat(i) == ".") { // replace with decimal symbol //alert('retval1='+retval); retval = retval + decimalsymbol; } else { // otherwise just copy character //alert('retval2='+retval); retval = retval + originalstring.charat(i); } } //alert('retval='+retval); return retval; } function removecommafromnumber(originalnum) { var newstring = ""; //filter out the comma for (i = 0; i < originalnum.length; i++) { if (originalnum.charat(i) != ",") { newstring = newstring + originalnum.charat(i); } } return parsefloat(newstring); } /** * determines if a form field is checked or not. */ function ischecked(id) { var ischecked = false; if (useslayers) { if (top.selectionbody.document.layers["" + id + ""].checked == true) { ischecked = true; } } else { if (usesdocall) { if (top.selectionbody.document.all["" + id + ""].checked == true) { ischecked = true; } } else { if (usesdom) { if (top.selectionbody.document.getelementbyid("" + id + "").checked == true) { ischecked = true; } } } } return ischecked; } /** * determines whether or not the navbar has been loaded. */ function isnavbarloaded() { return top.navbarloaded; } /** * preloads images for the page to reduce load time. */ function mm_preloadimages() { //v3.0 var d = document; if (d.images) { if (!d.mm_p) { d.mm_p = new array(); } var i, j = d.mm_p.length, a = mm_preloadimages.arguments; for (i = 0; i < a.length; i++) { if (a[i].indexof("#") != 0) { d.mm_p[j] = new image; d.mm_p[j++].src = a[i]; } } } } /** * activates when the user sets the units. * function def.'s required: * onchangefield */ function onsetunits(flagstoset) { onchangefield(flagstoset); } /** * called when resetting the page. function resetpage() { var reset = false; var msg = "nthis will undo all changes made to thisn" + "page since it was last displayed.nn"; if(confirm(msg)) { reset = true; } return reset; } */ /** * marks specified form field as dirty. */ function setdirtyflag(dirtyfield) { upserthiddeninput(dirtyfield, 'true'); } /** * sets navbarloaded property to true. */ function setnavbarloaded() { top.navbarloaded = true; } /** * sets issavedflag form field appropriately. */ function setsavedflag(flagsetting) { if (flagsetting) { upserthiddeninput('issavedflag', 'true'); } else { upserthiddeninput('issavedflag', 'false'); } } /** * sets a form field to visible. */ function setvisible(id, flag, frame) { if (flag) { if (useslayers && frame.document.layers["" + id + ""] != null) { frame.document.layers["" + id + ""].visibility = "show"; } else { if (usesdocall && frame.document.all["" + id + ""] != null) { frame.document.all["" + id + ""].style.visibility = "visible"; } else { if (usesdom && frame.document.getelementbyid("" + id + "") != null) { frame.document.getelementbyid("" + id + "").style.visibility = "visible"; } } } } else { if (useslayers && frame.document.layers["" + id + ""] != null) { frame.document.layers["" + id + ""].visibility = "hide"; } else { if (usesdocall && frame.document.all["" + id + ""] != null) { frame.document.all["" + id + ""].style.visibility = "hidden"; } else { if (usesdom && frame.document.getelementbyid("" + id + "") != null) { frame.document.getelementbyid("" + id + "").style.visibility = "hidden"; } } } } } /** * validates then submits the page. * function def.'s required: * submitpage */ function submitpagewithvalidation(targetpage) { /* this function is also called from navbar.xsl */ return submitpage(targetpage, true, false); } /** * function def.'s required: * submitpage */ function submitpagewithoutvalidation(targetpage) { /* this function is also called from navbar.xsl */ /* when there is no validation, the istargetheadloss param doesn't matter, so just set it to false.*/ return submitpage(targetpage, false, false); } /** * function def.'s required: * submitpage */ function submitpagewithvalidationgoingtoheadloss(targetpage) { /* this function is also called from navbar.xsl */ /* when going to the headlossmodule, the validation should skip the head check.*/ return submitpage(targetpage, true, true); } /* this function is only called from navbar.xsl */ function submitandcallconfigurator(configuratortab) { upserthiddeninput("dorejectvalidation", "true"); upserthiddeninput("configuratortab", configuratortab); if(!submitpagewithvalidation("")) { upserthiddeninput("dorejectvalidation", "false"); upserthiddeninput("configuratortab", ""); return false; } return true; } /** * the following functions will open a popup window * @return */ //open preferences party in party management, with the "units" tab active function openuomwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1200,height=500,left=20,top=20"); } } //open preferences party in party management, with the "curve" tab active function opencurveprefwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1200,height=500,left=20,top=20"); } } //open preferences party in party management, with preferences tab set in applications.xml function openprefwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1200,height=500,left=20,top=20"); } } //open preferences party in party management, with the "details" tab active function openedituserwindow(target) { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1200,height=500,left=20,top=20"); } function openadvsortwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=760,height=140,left=100,top=100"); } } function openliquidpropertieswindow(target, liquidsource) { if (needrecalc) { alert(label_recalc_before_saving); } else { var winheight = 105; if (liquidsource == "2") { winheight = 390; } window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=640,height=" + winheight + ",left=100,top=100"); } } function opendriverratingwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=800,height=395,left=100,top=100"); } } function openisodebugwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=640,height=420,left=20,top=100"); } } function openregenapiwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=640,height=420,left=20,top=100"); } } function openxmldownloadwindow(target) { var originaltarget = document.forms[0].target; if (needrecalc) { alert(label_recalc_before_saving); } else { document.forms[0].method = 'post'; document.forms[0].target = "_blank"; document.forms[0].action = target; document.forms[0].submit(); document.forms[0].target = originaltarget; return true; } } function openselectionsearchlogwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=640,height=420,left=20,top=100"); } } function opensearchresultslogwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=640,height=420,left=20,top=100"); } } function opennpshavailablewindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=640,height=230,left=100,top=100"); } } function openmultipleconditionswindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=450,height=345,left=100,top=100"); } } function openlcclogwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=640,height=420,left=100,top=100"); } } function openpdfxmlwindow(target, currentpage) { var originaltarget = document.forms[0].target; if (needrecalc) { alert(label_recalc_before_saving); } else { document.forms[0].method = 'post'; document.forms[0].target = "_blank"; document.forms[0].currentpage.value = currentpage; document.forms[0].targetpage.value = "downloadpdfxml=true"; document.forms[0].action = target; document.forms[0].submit(); document.forms[0].target = originaltarget; } } function openitemxmldownload(target, currentpage){ var originaltarget = document.forms[0].target; if (needrecalc) { alert(label_recalc_before_saving); } else { document.forms[0].method = 'post'; document.forms[0].target = "_blank"; document.forms[0].currentpage.value = currentpage; document.forms[0].targetpage.value = "downloaditemxml=true"; document.forms[0].action = target; document.forms[0].submit(); document.forms[0].target = originaltarget; } } function openfittingselectionwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400,left=100,top=100"); } } function openspecialfittingwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=700,height=275,left=100,top=100"); } } function openroughnesswindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=400,height=210,left=100,top=100"); } } function opencfactorwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=400,height=210,left=100,top=100"); } } function openviewallinstanceswindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "width=1000,height=650,resizable=1,scrollbars=yes,status=yes"); } } function showkelogs(target) { target = appendparametertourl(target, "viewtype", "ke-logs"); window.top.achildwindow = window.open(target, "_blank", "width=1000,height=650,resizable=1,scrollbars=yes,status=yes"); } function opencurvecommentwindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=755,height=117,left=100,top=100"); } } function openapi610window(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=870,height=200,left=100,top=100"); } } function openslurryconditionspopupwindow(target, selectedviscosityspecid) { var targeturl = target + '&initialload=true'; var height = 300; if (needrecalc) { alert(label_recalc_before_saving); } else { if (selectedviscosityspecid == '6') { height = 380; } window.top.achildwindow = window.open(targeturl, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=755,height="+height+",left=100,top=100"); } } function openmaxworkingpressurewindow(target) { if (needrecalc) { alert(label_recalc_before_saving); } else { window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=yes,resizable=yes,width=755,height=290,left=100,top=100"); } } function openrejectreasonswindow(target, currentpage, index, pumptypeindex, selectedcombinedconditionnumber) { // doesn't have to be modal target = appendparametertourl(target, "currentpageurl", currentpage); target = appendparametertourl(target, "index", index); target = appendparametertourl(target, "selectedcombinedconditionnumber", selectedcombinedconditionnumber); target = appendparametertourl(target, "pumptypeindex", pumptypeindex); window.open(target, '_blank', 'status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400,left=100,top=100'); } /* this function requires the page defines the global variables: needrecalc, label_recalc_before_saving and requires common-util-functions.js */ function opengasconstituentswindow(target, conditionindex) { if (needrecalc) { alert(label_recalc_before_saving); } else { target = appendparametertourl(target, "conditionindex", conditionindex); target = appendparametertourl(target, "firsthit", "true"); window.top.achildwindow = window.open(target, "_blank", "status=no,toolbar=no,scrollbars=no,resizable=yes,width=900,height=400,left=100,top=100"); } } /* this function requires the page defines the global variables: needrecalc, label_recalc_before_saving and requires common-util-functions.js */ function openviewallinstanceswindowforselconfig(target, selconfigmodulename) { target = appendparametertourl(target, "selconfigmodule", selconfigmodulename); openviewallinstanceswindow(target); } function createinputfieldandattachtoform(name, value){ $('').attr({name: ''+name+'', value: ''+value+''}).appendto( $(document.forms[0])); } // enable or disable the more>> link to enable the api610 settings popup function checkapi610display(hydselspecselectname, api610value){ var hydselspecselect = document.getelementbyid(hydselspecselectname); var apilink = document.getelementbyid(hydselspecselectname+'_api610popuplink'); if(hydselspecselect != null && apilink != null) { if (hydselspecselect.options[hydselspecselect.selectedindex].value==api610value){ apilink.style.visibility = "visible"; } else { apilink.style.visibility = "hidden"; } } } function checkslurrypopuplinkdisplay(solidsconcentrationbyvolumefieldid, solidsconcentrationbyweightfieldid, fluiddensityfieldid){ var viscositycorrectionspecselectedvalue = $('#'+viscosity_correction_spec).val(); var slurrypopuplink = document.getelementbyid(viscosity_correction_spec+'_slurry_popuplink'); if(viscositycorrectionspecselectedvalue != null && slurrypopuplink != null) { if (jquery.inarray(viscositycorrectionspecselectedvalue,viscosity_correction_spec_ids_with_slurry_array) != -1) { slurrypopuplink.style.visibility = "visible"; $('#'+solidsconcentrationbyvolumefieldid).attr('disabled', true); // solid concentration by weight is not available for every org. if ($('#'+solidsconcentrationbyweightfieldid).length) { $('#'+solidsconcentrationbyweightfieldid).attr('disabled', true); } $('#'+fluiddensityfieldid).attr('disabled', true); if ($('#'+const_froth_factor).length > 0) { $('#'+const_froth_factor).val(froth_factor_min_formatted); $('#'+const_froth_factor).attr('disabled', true); } } else { slurrypopuplink.style.visibility = "hidden"; $('#'+solidsconcentrationbyvolumefieldid).attr('disabled', false); if ($('#'+solidsconcentrationbyweightfieldid).length) { $('#'+solidsconcentrationbyweightfieldid).attr('disabled', false); } $('#'+fluiddensityfieldid).attr('disabled', false); if ($('#'+const_froth_factor).length > 0) { $('#'+const_froth_factor).attr('disabled', false); } } } } /* * submits units selection set by user. * global variable def.'s required: * current_page * target_navigation_flags * target_set_units */ function submitunitsselection(type) { var targetpage = target_set_units; if (type == "us") { targetpage = targetpage + "&type=us"; } else { if (type == "metric") { targetpage = targetpage + "&type=metric"; } } if (type == "us" || type == "metric") { document.forms[0].action = target_navigation_flags; document.forms[0].currentpage.value = current_page; document.forms[0].targetpage.value = targetpage; document.forms[0].isrecalcsubmit.value = "true"; document.forms[0].submit(); } else { openuomwindow(targetpage); } } function requestliquidpropertieswindow() { document.forms[0].displayliquidpropertieswindow.value = "true"; recalculatepage(); } function requestprefwindow(targetprefs, label_recalc_before_saving) { if (top.selectionbody) { if (top.selectionbody.needrecalc) { top.selectionbody.alert(label_recalc_before_saving); } else if(top.selectionbody.document.forms[0].displayprefwindow){ top.selectionbody.document.forms[0].displayprefwindow.value = "true"; top.selectionbody.recalculatepage(); } else { openprefwindow(targetprefs); } } } function requestedituserwindow() { document.forms[0].displayedituserwindow.value = "true"; recalculatepage(); } function requestadvsortwindow() { document.forms[0].displayadvsortwindow.value = "true"; recalculatepage(); } function requestdownloaditemxmlwindow() { recalculatepageforitemxmldownload(); } function requestdriverratingwindow() { document.forms[0].displaydriverratingwindow.value = "true"; recalculatepage(); } function requestnpshavailablewindow() { document.forms[0].displaynpshavailablewindow.value = "true"; recalculatepage(); } function requestslurryconditionspopupwindow() { document.forms[0].displayslurryconditionspopupwindow.value = "true"; recalculatepage(); } function requestcalculateliquidpropertiesspecifiers() { document.forms[0].calculateliquidpropertiesspecifiers.value = "true"; recalculatepage(); } function requestmultipleconditionswindow() { document.forms[0].displaymultipleconditionswindow.value = "true"; recalculatepage(); } function setsessioncustomizationvalue(currentdiabledstate){ var value = 'true'; if (currentdiabledstate=='true'){ value = 'false' } if($("#notify").is(':checked')){ cookies.set('advancedmodenotifyoff', 'true'); } upserthiddeninput('disablesessioncustomization', value); recalculatepage(); } function openadvancedmodedialog(currentdisabledstate) { if(cookies.get('advancedmodenotifyoff') == 'true') { setsessioncustomizationvalue(currentdisabledstate); } else { $('#advanced_mode_dialog').foundation('open'); } } function requestpdfxmlwindow() { //document.forms[0].displaypdfxmlwindow.value="true"; //recalculatepage(); recalculatepageforpdfxmldownload(); } /** * new style popup request, idd#5830. * use this when a recalc of the main window is required before the popup is displayed. * a recalc is necessary in situations when the popup is dependent on the data entered in the main window. * if a recalc is not necessary, then you should call the appropriate open*window() function directly. */ function requestpopupwindow(servleturl, performrecalc) { //alert('requestpopupwindow 1'); document.forms[0].displaypopupwindow.value = servleturl; //alert('requestpopupwindow 2'); recalculatepage(); //alert('requestpopupwindow 3'); } /** * the number is value at this point, according to the "display value" limits * make sure the value falls within the highprecision limits, if not just set it to the min or max limit * (i.e. the display value is rounded and that rounding may cause the value to exceed the true limit **/ function rangevalidationhighprecision(value, minlimithighprecision, maxlimithighprecision, digitgroupingsymbol, decimalsymbol) { // get comparable versions of numbers (without digit grouping symbol, and decimal symbol always a period) var valuecompare = getsimpledecimalformat(value, digitgroupingsymbol, decimalsymbol); var minhighprecisioncompare = getsimpledecimalformat(minlimithighprecision, digitgroupingsymbol, decimalsymbol); var maxhighprecisioncompare = getsimpledecimalformat(maxlimithighprecision, digitgroupingsymbol, decimalsymbol); //get the value that is in range, and convert back to original locale var retval = getoriginaldecimalformat(math.max(minhighprecisioncompare, math.min(maxhighprecisioncompare, valuecompare)), decimalsymbol); return retval; } function initrequest(url) { var req; if (window.xmlhttprequest) { req = new xmlhttprequest(); } else { if (window.activexobject) { req = new activexobject("microsoft.xmlhttp"); } } return req; } /* notifies the server that pumpsizelist has been received and loaded. */ function setservertoclientendtime(url) { if (url != null) { $.ajax({ type: 'get', url: url, datatype: 'text', success: function(data) { }, error: function(data, textstatus, errorthrown){ alert(error_in_ajax); }, data: {} }); return false; } } function getreadaccessstatus(url) { if (url != null) { $.ajax({ type: 'get', url: url, datatype: 'xml', success: function(data) { var msg = null; var item = data.getelementsbytagname("readaccessstatus")[0]; //--firstchild could be null, this check is needed if (item != null && item.firstchild != null) { msg = item.firstchild.nodevalue; } //alert("processajaxreadaccessstatus: "+msg); refreshstatusmsg(msg); }, data: {} }); return false; } } /* * the following two functions send navbar twistie display style change request to the backend through ajax */ function savenavbartwistieoption(baseurl, displaystyle){ var url = baseurl + displaystyle; //alert('ajax twistie option, url='+url); if (url != null) { $.ajax({ type: 'get', url: url, datatype: 'text', success: function(data) { }, error: function(data, textstatus, errorthrown){ alert("error in javascript: commonfunctions.savenavbartwistieoption"); }, data: {} }); return false; } } function printdebug(text) { alert(text); } function focusonresultlink() { self.focus(); var myelement = document.getelementbyid('linkid_table1_row1'); if(myelement != null) { myelement.focus(); } } function focusoncoslink() { self.focus(); var coselement = document.getelementbyid('cossubmit'); if(coselement != null) { coselement.focus(); } } function fieldsfocusloader(){ inputfieldfocushandler = function() { var els = document.getelementsbytagname("input"); for (var i=0; i 0 && maxfield.length > 0){ maxfield.val(ratedfield.val()); setdirtyflag(maxdirtyflagid); } } // the settimeout(0) is necessary so that the event loop would load the navbar while the images are being requested. function lazyloadimages(){ $( '.js_lazyload' ).each( function(){ if($(this).is('object')) { settimeout(function(self) { $(self).attr('data', $(self).attr('data-src')); }, 0, this); } else { settimeout(function(self) { $(self).attr('src', $(self).attr('data-src')); }, 0, this); } } ); }