$(document).ready(function() {
        initClickHandler();
        initImageButtons();
    });


initClickHandler = function() {

    $('input.clearandpopulate').each(function(l) {
            $(this).bind('focus', function(event) {
                    if ($(this).attr('title') == this.value) {
                        $(this).attr('value','');
                    }

                }).bind('blur', function(event) {
                        if (this.value == '') {
                            $(this).attr('value',$(this).attr('title'));
                    }
                });
        });

    $('form').bind('submit', function(e) {
            $('input.clearandpopulate').each(function(e) {
                    if ($(this).attr('title') !== undefined) {
                        if ($(this).attr('value') == $(this).attr('title')) $(this).attr('value','');
                    }
                });
        });




}



initImageButtons = function() {
    $('input.imagebutton').each(function(k) {
            $(this).bind('mouseover', function(event) {
                    $(this).css('cursor','pointer').css('backgroundPosition','0 -50px');
                }).bind('mouseout', function(e) {
                    $(this).css('cursor','default').css('backgroundPosition','0 0');
                    });

        });
}