var el_brands=document.getElementById("dd_brands");if(el_brands!=null){load_brand_dropdown()}function load_brand_dropdown(){var el_dd_brand_name=document.getElementById("dd_brand_name");var el_dd_brands=document.getElementById("dd_brands");if(el_dd_brand_name!=null){load_brands();$(el_dd_brand_name).change(function(){if(this.value!=""){$(el_dd_brands)[0].submit()}});$(el_dd_brands).submit(function(){return check_brands()});$(el_dd_brands).attr("action","/search/")}}function load_brands(){document.forms.dd_brands.Nr.options.length=1;$.get('/partfinder/brand/0',{},function(data){data=$.trim(data);data=data.split("|");for(i=0;i<data.length;i++){document.forms.dd_brands.Nr.options[i+1]=new Option(data[i],"AND(brand:"+data[i]+")")}})}function check_brands(){if(document.forms.dd_brands.Nr.value==''){alert('Please select a brand');return false}else{document.forms.dd_brands.submit()}}