// JavaScript Document
  $(document).ready(function() {
  //alert("123");
            $(".dropdown img.flag").addClass("flagvisibility");

            $(".dropdown dt a").click(function() {
                $(".dropdown dd ul").toggle();
            });

            $(".dropdown dd ul li a").click(function() {
            alert("ok");
                var text = $(this).html();
                $(".dropdown dt a span").html(text);
                $(".dropdown dd ul").hide();
                $("#subcategory").html(getSelectedValue("sample"));
            });

            function getSelectedValue(id) {
            alert(id);
              $(id.frm).submit();
             //   return $("#" + id).find("dt a span.value").html();
             return $("#" + id).submit();


            }

            $(document).bind('click', function(e) {
          //  alert("yes");
                var $clicked = $(e.target);
                if (! $clicked.parents().hasClass("dropdown"))

                    $(".dropdown dd ul").hide();
                     //alert("success");
            });


            $("#flagSwitcher").click(function() {
              alert("no");
                $(".dropdown img.flag").toggleClass("flagvisibility");
            });
        });




