var Qs_Form_Element_Email = { message: new Qs_Message({ 'eng': { }, 'uk': { } }), element: null, idTimer: null, options: {}, elementOptions: {}, init: function (id, options) { var element = document.getElementById(id); if (!element) { alert('Qs_Form_Element_Email. Can not find element with id = ' + id); return false; } if (!element.tagName || element.tagName != 'INPUT') { alert('Qs_Form_Element_Email. Element (id = ' + id + ') is not "input"'); return false; } if (element.type != 'text') { alert('Qs_Form_Element_Email. Element (id = ' + id + ') type is not "text"'); return false; } $(element).focus(Qs_Form_Element_Email.onFocus); $(element).blur(Qs_Form_Element_Email.onBlur); Qs_Form_Element_Email.setElementOptions(id, options); $(element).qtip({ content: 'Example: mail@example.com', prerender: true, position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' } }, style: { tip:true, width:200 } }); }, getElementOptions: function (id) { if (typeof Qs_Form_Element_Email.elementOptions[id] == 'undefined') { return null; } return Qs_Form_Element_Email.elementOptions[id]; }, getElementOption: function (id, name) { var options = Qs_Form_Element_Email.getElementOptions(id); if (options) { if (typeof options[name] != 'undefined') { return options[name]; } } return null; }, setElementOption: function (id, name, value) { var options = Qs_Form_Element_Email.getElementOptions(id); if (options) { options[name] = value; } else { Qs_Form_Element_Email.elementOptions[id] = {name: value}; } }, setElementOptions: function (id, options) { Qs_Form_Element_Email.elementOptions[id] = options; }, onFocus: function () { $(this).qtip('show'); return true; }, onBlur: function () { $(this).qtip('hide'); return true; } }