﻿$(document).ready(function () {	



    $("input:text, textarea, input:password").each(function () {
        var a = $(this).attr("tooltip");
        if (a) {
            if (this.value == '') this.value = a
        }
    });
    $("input:text, textarea, input:password").focus(function () {
        var a = $(this).attr("tooltip");
        if (a) {
            if (this.value == a) this.value = ''
        }
    });
    $("input:text, textarea, input:password").blur(function () {
        var a = $(this).attr("tooltip");
        if (a) {
            if (this.value == '') this.value = a
        }
    });
    $("form").keypress(function (e) {
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
            $(this).submit();
            return false;
        } else {
            return true;
        }
    });
    $("input:image, input:button, input:submit").click(function () {
        var a = $(this).attr("tooltip");
        $(this.form.elements).each(function () {
            if (this.type == 'text' || this.type == 'textarea' || this.type == 'password') {
                if (this.value == a && a != '') {
                    this.value = ''
                }
            }
        })
    })
})
