jQuery(document).ready(function(e){flagKeyCode=!1,flagClick=!0,setOptionSelectBox=function(t){var s=t,l=s.val().toLowerCase();l=e.trim(l);var r=!1,c=s.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced");c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span").each(function(t){var s=e(this),o=s.text();if(o=e.trim(o),""!=o&&o.toLowerCase()==l){r=!0;var i=s.attr("rel");return c.find("select").val(i).trigger("change"),!1}}),r||s.val(c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span:first").text())};var t=function(t){var s=t,l=t.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced").find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list").is(":visible");l||showList(s.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced").find(".jquery-selectbox-list.jquery-custom-selectboxes-replaced-list"));var r=s.val().toLowerCase();r=e.trim(r);var c=!1,o=s.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced"),i=o.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list").scrollTop();o.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span").each(function(t){var s=e(this),l=s.text();if(l=e.trim(l),""!=l&&l.toLowerCase()==r){var u=s.position().top;return o.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list").scrollTop(i+u),c=!0,!1}}),c||(s.val(o.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span:first").text()),l&&o.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list").scrollTop(0))};e(".jquery-selectbox.jquery-custom-selectboxes-replaced input").live("keydown",function(t){flagClick=!0;var s=t.keyCode,l=e(this),r=l.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced");if((9==s||81==s)&&(flagKeyCode=!0),9==s){var c=r.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list"),o=c.is(":visible");if(o){var i={className:"jquery-selectbox",animationSpeed:"fast",listboxMaxSize:10,replaceInvisible:!1};c.slideUp(i.animationSpeed,function(){r.removeClass("selecthover")})}}}),e(".jquery-selectbox.jquery-custom-selectboxes-replaced").live("click",function(e){flagClick=!1}),e(".jquery-selectbox.jquery-custom-selectboxes-replaced input").live("focusout",function(t){var s=e(this),l=s.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced"),r=s.val().toLowerCase();r=e.trim(r);var c=!1,o=0;return l.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span").each(function(t){var s=e(this),l=s.text();l=e.trim(l),""!=l&&l.toLowerCase()==r&&(c=!0,o=s.attr("rel"))}),c||s.val(l.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span:first").text()),flagKeyCode?(l.find("select").val(o).trigger("change"),flagKeyCode=!1,!1):void(flagClick?l.find("select").val(o).trigger("change"):flagClick=!0)}),e(".jquery-selectbox.jquery-custom-selectboxes-replaced input").live("keyup",function(s){var l=s.which,r=e(this),c=r.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced"),o=c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list").is(":visible");if(9!=l&&8!=l&&16!=l){var i="";if(40==l||38==l?(i=r.val().toLowerCase(),i=e.trim(i),o&&hideList(r.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced").find(".jquery-selectbox-list.jquery-custom-selectboxes-replaced-list"))):i=String.fromCharCode(s.which).toLowerCase(),13!=l){var u=!1;if(c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span").removeClass("listelementhover"),c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span").each(function(s){var c=e(this),o=c.text();if(40!=l&&38!=l&&(o=o.substring(0,1)),o.toLowerCase()==i){if(40==l){if(!(c.next().length>0))return!1;c.removeClass("listelementhover"),c.next().addClass("listelementhover"),r.val(e.trim(c.next().text()))}else if(38==l){if(!(c.prev().length>0))return!1;c.removeClass("listelementhover"),c.prev().addClass("listelementhover"),r.val(e.trim(c.prev().text()))}else r.val(e.trim(c.text())),c.addClass("listelementhover"),t(r);return u=!0,!1}}),!u){var a=c.find("div.jquery-selectbox-list.jquery-custom-selectboxes-replaced-list span:first");r.val(a.text()),a.addClass("listelementhover"),o&&t(r)}}else 13==l&&(setOptionSelectBox(r),o&&hideList(r.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced").find(".jquery-selectbox-list.jquery-custom-selectboxes-replaced-list")))}}),e(".jquery-selectbox.jquery-custom-selectboxes-replaced input").live("click",function(s){var l=e(this);return 0!=l.parent("div.jquery-selectbox.jquery-custom-selectboxes-replaced").find("div.selectboxBlock").length?!1:void t(l)}),e(".jquery-selectbox-moreButton").live("click",function(){var s=e(this),l=s.closest(".jquery-selectbox.jquery-custom-selectboxes-replaced").find(".jquery-selectbox-currentItem");t(l),l.focus()})});