$(document).ready(function(){

	// Remove focus outline on all links when clicked
	$("a").focus(function(){
	  $(this).blur();
	});
	
	// Search box hide/display default text on focus/blur
	$("#searchField").focus(function() {
		if(this.value == this.defaultValue) {
			this.value = "";
		}
		
		}).blur(function() {
			if(!this.value.length) {
				this.value = this.defaultValue;
			}
		});
	  
	$('#searchForm').hide();
	$('#searchBox a').click(function() {
		$('#searchForm').animate({
			height: 'toggle'
		}, 400);
	});
	
	//Language Selector
	
	$('#language-fieldset').hide();
	$('#language-dropdown').show();
	
    $(".dropdown dt a").click(function() {
        $(".dropdown dd ul").toggle();
    });
                
    $(".dropdown dd ul li a").click(function() {
        var text = $(this).html();
        $(".dropdown dt a span").html(text);
        $(".dropdown 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("dropdown"))
            $(".dropdown dd ul").hide();
        });
    
   


	
 });
