$(document).ready(function() {

    var search_name = $('#search_field').val();


   $(".search_field_submit").click(function() {
	$('body').append('<form method="get" action="/SearchResult.aspx" id="searchform1">'
        + '<input type="hidden" name="searchtext" value="' + $('#search_field').val() + '" />'
        + '</form>'
    );
    $('#searchform1').submit();


   });

    // Define what happens when the textbox comes under focus
    // Remove the watermark class and clear the box
    $("#search_field").focus(function() {

        $(this).filter(function() {

            // We only want this to apply if there's not
            // something actually entered
            return $(this).val() == "" || $(this).val() == search_name

        }).removeClass("searchWatermarkOn").val("");

    });

    // Define what happens when the textbox loses focus
    // Add the watermark class and default text
    $("#search_field").blur(function() {

        $(this).filter(function() {

            // We only want this to apply if there's not
            // something actually entered
            return $(this).val() == ""

        }).addClass("searchWatermarkOn").val(search_name);
    });
});
