function scJQGeneralAdd() { $('input:text.sc-js-input').listen(); $('input:password.sc-js-input').listen(); $('input:checkbox.sc-js-input').listen(); $('input:radio.sc-js-input').listen(); $('select.sc-js-input').listen(); $('textarea.sc-js-input').listen(); } // scJQGeneralAdd function scFocusField(sField) { var $oField = $('#id_sc_field_' + sField); if (0 == $oField.length) { $oField = $('input[name=' + sField + ']'); } if (0 == $oField.length && document.F1.elements[sField]) { $oField = $(document.F1.elements[sField]); } if (false == scSetFocusOnField($oField) && $("#id_ac_" + sField).length > 0) { if (false == scSetFocusOnField($("#id_ac_" + sField))) { setTimeout(function() { scSetFocusOnField($("#id_ac_" + sField)); }, 500); } } else { setTimeout(function() { scSetFocusOnField($oField); }, 500); } } // scFocusField function scSetFocusOnField($oField) { if ($oField.length > 0 && $oField[0].offsetHeight > 0 && $oField[0].offsetWidth > 0 && !$oField[0].disabled) { $oField[0].focus(); return true; } return false; } // scSetFocusOnField function scEventControl_init(iSeqRow) { scEventControl_data["txt_login" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""}; scEventControl_data["txt_senha" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""}; scEventControl_data["link" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": ""}; } function scEventControl_active(iSeqRow) { if (scEventControl_data["txt_login" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["txt_login" + iSeqRow]["change"]) { return true; } if (scEventControl_data["txt_senha" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["txt_senha" + iSeqRow]["change"]) { return true; } if (scEventControl_data["link" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["link" + iSeqRow]["change"]) { return true; } return false; } // scEventControl_active function scEventControl_onFocus(oField, iSeq) { var fieldId, fieldName; fieldId = $(oField).attr("id"); fieldName = fieldId.substr(12); scEventControl_data[fieldName]["blur"] = true; scEventControl_data[fieldName]["change"] = false; } // scEventControl_onFocus function scEventControl_onBlur(sFieldName) { scEventControl_data[sFieldName]["blur"] = false; if (scEventControl_data[sFieldName]["change"]) { if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val()) { scEventControl_data[sFieldName]["change"] = false; } } } // scEventControl_onBlur function scEventControl_onChange(sFieldName) { scEventControl_data[sFieldName]["change"] = false; } // scEventControl_onChange function scEventControl_onAutocomp(sFieldName) { scEventControl_data[sFieldName]["autocomp"] = false; } // scEventControl_onChange var scEventControl_data = {}; function scJQEventsAdd(iSeqRow) { $('#id_sc_field_txt_login' + iSeqRow).bind('blur', function() { sc_login_txt_login_onblur(this, iSeqRow) }) .bind('focus', function() { sc_login_txt_login_onfocus(this, iSeqRow) }); $('#id_sc_field_txt_senha' + iSeqRow).bind('blur', function() { sc_login_txt_senha_onblur(this, iSeqRow) }) .bind('focus', function() { sc_login_txt_senha_onfocus(this, iSeqRow) }); $('#id_sc_field_link' + iSeqRow).bind('blur', function() { sc_login_link_onblur(this, iSeqRow) }) .bind('focus', function() { sc_login_link_onfocus(this, iSeqRow) }); } // scJQEventsAdd function sc_login_txt_login_onblur(oThis, iSeqRow) { do_ajax_login_validate_txt_login(); scCssBlur(oThis); } function sc_login_txt_login_onfocus(oThis, iSeqRow) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_login_txt_senha_onblur(oThis, iSeqRow) { do_ajax_login_validate_txt_senha(); scCssBlur(oThis); } function sc_login_txt_senha_onfocus(oThis, iSeqRow) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_login_link_onblur(oThis, iSeqRow) { do_ajax_login_validate_link(); scCssBlur(oThis); } function sc_login_link_onfocus(oThis, iSeqRow) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function scJQPopupAdd(iSeqRow) { $('.scFormPopupBubble' + iSeqRow).each(function() { var distance = 10; var time = 250; var hideDelay = 500; var hideDelayTimer = null; var beingShown = false; var shown = false; var trigger = $('.scFormPopupTrigger', this); var info = $('.scFormPopup', this).css('opacity', 0); $([trigger.get(0), info.get(0)]).mouseover(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); if (beingShown || shown) { // don't trigger the animation again return; } else { // reset position of info box beingShown = true; info.css({ top: trigger.position().top - (info.height() - trigger.height()), left: trigger.position().left - ((info.width() - trigger.width()) / 2), display: 'block' }).animate({ top: '-=' + distance + 'px', opacity: 1 }, time, 'swing', function() { beingShown = false; shown = true; }); } return false; }).mouseout(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); hideDelayTimer = setTimeout(function() { hideDelayTimer = null; info.animate({ top: '-=' + distance + 'px', opacity: 0 }, time, 'swing', function() { shown = false; info.css('display', 'none'); }); }, hideDelay); return false; }); }); } // scJQPopupAdd function scJQUploadAdd(iSeqRow) { } // scJQUploadAdd function scJQElementsAdd(iLine) { scJQEventsAdd(iLine); scEventControl_init(iLine); scJQPopupAdd(iLine); scJQUploadAdd(iLine); } // scJQElementsAdd