/* Contao Open Source CMS, (c) 2005-2016 Leo Feyer, LGPL license */
var Stylect={template:new Element("div",{"class":"styled_select",html:"<span></span><b><i></i></b>"}),update:function(e){var t=e.retrieve("div"),n=e.getElement('option[value="'+Slick.escapeRegExp(e.value)+'"]');t&&n&&t.getElement("span").set("text",n.get("text"))},keydown:function(e){setTimeout(function(){Stylect.update(e)},100)},focus:function(e){e.addClass("focused")},blur:function(e){e.removeClass("focused")},convertSelects:function(){Browser.ie6||Browser.ie7||Browser.ie8||$$("select").each(function(e){if(!e.get("multiple")&&!e.hasClass("tl_chosen")){var t=e.get("class"),n=e.retrieve("div"),c=e.get("style");n||(n=Stylect.template.clone(),n.addClass(t).inject(e,"before")),e.setStyle("opacity",0),e.addEvents({change:function(){Stylect.update(e)},keydown:function(){Stylect.keydown(e)},focus:function(){Stylect.focus(n)},blur:function(){Stylect.blur(n)}}),e.disabled&&n.addClass("disabled"),e.hasClass("active")&&n.addClass("active"),c&&c.test("(^width|[^-]width)")&&n.setStyle("width",e.getStyle("width")),e.store("div",n),Stylect.update(e)}})}};window.addEvent("domready",function(){Stylect.convertSelects()}),window.addEvent("ajax_change",function(){Stylect.convertSelects()});