// Input Lensing
// Include this javascript in your <head> and on load, any input with class lens will use lensing

$(function(){
        bindLenses(".lens");
});

function bindLenses( context ){
	if( context.length > 0 ){
		$( context ).blur(function(){lens(this);}).focus(function(){lens(this);});
	}
}

function lens(obj) {
    obj.value = obj.value == obj.defaultValue ? prep(obj) : obj.value == "" ? reset(obj) : obj.value;
}

function prep(obj) {
    $(obj).removeClass("def");
    return "";
}

function reset(obj) {
    $(obj).addClass("def");
    return obj.defaultValue;
}