/**
 * Snap Form Plugin
 * Upon clicking a box, the default value is greyed to show that the user can start typing. The box is then cleared as they 
 * start typing and the text appears in the usual colour. If the user clears the content of the box, the default value is restored.
 * 
 * Version 1.0
 * Updated 22/06/2010
 *
 * Copyright (c) 2010 Joe Czucha 
 *
 * Usage:
 * eg. $('input#name').snapForm();
 * 
 */

(function(a){
a.fn.snapForm=function(){
var c=this;
var b=a(c).attr("value");
var d=a(c).css("color");
if(b.length){

a(c).click(function(){
//if(a(c).val()==b){ a(c).css("color","#4F4F4F")}});
if(a(c).val()==b)
{
a(c).attr("value","").css({'background-color':'#cccccc','background-image':'none'});
}

});

a(c).keypress(function(){
if(a(c).val()==b){
a(c).val("");
a(c).css("color",d)
}
});

a(c).blur(function(){
if(a(c).val()==b){
a(c).css("color",d)
}
if(a(c).val()==""){
a(c).val(b);
a(c).css("color",d);
a(c).css("background-image","")
}
})
}
}
})

(jQuery);
