BhpModals = new Object(); BhpModals.CreateModalDiv = function(hash) { var id = 'bhpModalDiv' + (hash ? hash : ''); if ($("#" + id).length == 0) { $("body").append("
"); } return id; } BhpModals.HorseLookupModal = function(triggerexpr, textexpr, onselect) { $().ready(function() { var setHref = function() { $(triggerexpr).attr('href', '/Modal/ModalHorseLookup?horseName=_FIELD1_'.replace("_FIELD1_", escape($(textexpr).val()))); } setHref(); $(textexpr).keyup(function(event) { setHref(); if (event.keyCode == 13) { if ($(textexpr).val() != '') { $(triggerexpr).click(); } } }); var myhash = triggerexpr.substring(1, triggerexpr.length); //remove # var divexpr = '#' + BhpModals.CreateModalDiv(myhash); $(divexpr).jqm({ ajax: '@href', ajaxText: " Loading...", toTop: true, trigger: triggerexpr, onLoad: function(hash) { $().ready(function() { $(divexpr + ' a.select').click(function() { onselect($(this).attr("referencenumber"), $(this).attr("horsename")); $(divexpr).jqmHide(); }) }) } }); }); } BhpModals.StallionLookupModal = function(triggerexpr, textexpr, onselect) { $().ready(function() { //alert('HorseLookupModel p1= ' + triggerexpr + ' p2= ' + textexpr + ' p3 = ' + onselect); var setHref = function() { $(triggerexpr).attr('href', '/Modal/ModalStallionLookup?horseName=_FIELD1_'.replace("_FIELD1_", escape($(textexpr).val()))); } setHref(); $(textexpr).keyup(function(event) { setHref(); if (event.keyCode == 13) { if ($(textexpr).val() != '') { $(triggerexpr).click(); } } }); var myhash = triggerexpr.substring(1, triggerexpr.length); //remove # var divexpr = '#' + BhpModals.CreateModalDiv(myhash); $(divexpr).jqm({ ajax: '@href', ajaxText: " Loading...", toTop: true, trigger: triggerexpr, onLoad: function(hash) { $().ready(function() { $(divexpr + ' a.select').click(function() { onselect($(this).attr("referencenumber"), $(this).attr("horsename")); $(divexpr).jqmHide(); }) }) } }); }); } BhpModals.MyMaresLookupModal = function(triggerexpr, onselect) { $().ready(function() { var divexpr = '#' + BhpModals.CreateModalDiv('dike'); $(divexpr).jqm({ ajax: '/Modal/ModalMyMareLookup', ajaxText: " Loading...", toTop: true, trigger: triggerexpr, onLoad: function(hash) { $().ready(function() { $(divexpr + ' a.select').click(function() { onselect($(this).attr("referencenumber"), $(this).attr("horsename")); $(divexpr).jqmHide(); }) }) } }); }); }