        $(document).ready(function() {
            $(".dropdownFlags img.flag").addClass("flagvisibility");

            $(".dropdownFlags dt a").click(function() {
                $(".dropdownFlags dd ul").toggle();
            });
                        
            $(".dropdownFlags dd ul li a").click(function() {
                var text = $(this).html();
                $(".dropdownFlags dt a span").html(text);
                $(".dropdownFlags dd ul").hide();
               // $("#result").html("Selected value is: " + getSelectedValue("sample"));
            });
                        
            /*function getSelectedValue(id) {
                return $("#" + id).find("dt a span.value").html();
            }*/

            $(document).bind('click', function(e) {
                var $clicked = $(e.target);
                if (! $clicked.parents().hasClass("dropdownFlags"))
                    $(".dropdownFlags dd ul").hide();
            });


            /*$("#flagSwitcher").click(function() {
                $(".dropdownFlags img.flag").toggleClass("flagvisibility");
            });*/
        });
