$(document).ready(function(){ // Search drop down box var m=0; $("#defTitle").click(function(){ if(m==0) { $("#labCon").slideDown("fast"); $("#selectBox").css({ backgroundImage: "url(/images/sbc-bg-open.png)" }); m=1; } else { $("#labCon").slideUp("fast", function(){ $("#selectBox").css({ backgroundImage: "url(/images/sbc-bg.png)" }); }); m=0; } }); $("#selectBox label").click(function(){ var s = $(this).attr("for"); $("#defTitle").text($(this).text()); $("#labCon").slideUp("fast", function(){ $("#selectBox").css({ backgroundImage: "url(/images/sbc-bg.png)" }); }); m=0; var inp = $("#selectBox input#"+s).attr("checked", "checked"); }); // Hide drop down box $(document).bind("click", function (e) { if (e.target.id != $("#defTitle").attr("id")) { $("#labCon").slideUp("fast", function(){ $("#selectBox").css({ backgroundImage: "url(/images/sbc-bg.png)" }); }); m=0; } }); });