window.addEvent('domready',doFormLabels);
function doFormLabels(){
	formcontrols = $$('.tiptext');
	if(formcontrols.length > 0){
		formcontrols.each(formLabels);
	}
}
function formLabels(object){
	if(object.formlabelsetup != true){
		object.temptext = object.getProperty('title');
		if(object.getProperty('type') == 'password'){
			if(object.value == ''){
				try{object.setProperty('type','text');}catch(e){}
			}
			object.origpassword = true;
		}
		if(object.value == ""){object.value = object.temptext;}
		if(object.value != object.temptext){
			//form is prefilled with something, remove tiptext class
			object.removeClass('tiptext');
		}
		object.addEvent('focus',function(){
			if(this.value == this.temptext){
				this.value = "";
				this.removeClass('tiptext');
				if(this.origpassword){try{this.setProperty('type','password');}catch(e){}}
			}
		});
		object.addEvent('blur',function(){
			if(this.value == ""){
				this.addClass('tiptext');
				this.value = this.temptext;
				if(this.origpassword){try{this.setProperty('type','text');}catch(e){}}
			}
		});
	}
	object.formlabelsetup = true;
}
