jQuery(document).ready(function() {
	
    $("#username").click(function() {
        if ($(this).val() == 'Username') {
            $(this).val('');
        }
    });
    $("#username").blur(function() {
        if ($(this).val() === '') {
            $(this).val('Username');
        }
    });

    $("#password").click(function() {
        if ($(this).val() == 'Password') {
            $(this).val('');
        }
    });
    $("#password").blur(function() {
        if ($(this).val() === '') {
            $(this).val('Password');
        }
    });

    $("#org_location").click(function() {
        if ($(this).val() == 'Where?') {
            $(this).val('');
        }
    });
    $("#org_location").blur(function() {
        if ($(this).val() === '') {
            $(this).val('Where?');
        }
    });

    $("#event_location").click(function() {
        if ($(this).val() == 'Where?') {
            $(this).val('');
        }
    });
    $("#event_location").blur(function() {
        if ($(this).val() === '') {
            $(this).val('Where?');
        }
    });

    $("#query").blur(function() {
        if ($(this).val() === '') {
            $(this).val('Keyword?');
        }
    });
    
    $('#eventQuery').blur(function() {
        if ($(this).val() === '') {
            $(this).val('Keyword?');
        }
    });

    $('.field-with-title[title]')
        .focus(function(){
            var currentElement = $(this);
            if (currentElement.val() == currentElement.attr('title')) {
                currentElement.val('');
            }
        })
        .blur(function(){
            var currentElement = $(this);
            if (currentElement.val() == '') {
                currentElement.val(currentElement.attr('title'));
            }
        })
        .each(function(){
            var currentElement = $(this);
            currentElement.blur();

            currentElement.parents('form:first')
                .submit(function(){
                    if (currentElement.val() == currentElement.attr('title')) {
                        currentElement.val('');
                    }
                });
        });

    $(".home_box select").select_skin();
});
