/*
 * ToggleFormText
 *
 * Author:   Grzegorz Frydrychowicz
 * E-mail:   grzegorz.frydrychowicz@gmail.com
 * Date:     16-11-2007
*/

$(function(){
    $("input:text, textarea, input:password").each(function(){
        if(this.value == '' && this.title != '')
            this.value = this.title;
			$(this).removeClass('hoverColor');
			
    });
    $("input:text, textarea, input:password").focus(function(){
        if(this.value == this.title && this.title != '')
            this.value = '';
			$(this).addClass('hoverColor');
    });
    $("input:text, textarea, input:password").blur(function(){
        if(this.value == '' && this.title != ''){
            this.value = this.title;
			$(this).removeClass('hoverColor');}
    });
    $("input:image, input:button, input:submit").click(function(){
        $(this.form.elements).each(function(){
            if((this.type =='text' || this.type =='textarea' || this.type =='password') && this.title != '' ){
                if(this.value == this.title && this.title != ''){
                    this.value='';
					$(this).addClass('hoverColor');
                }
            }
        });
    });
});