$(document).ready(function() {
  
   formatInputs();
   setTimeout('formatInputs();',500);
   setTimeout('formatInputs();',1000);
  
});

function formatInputs(){
	$('input').each(function(i) {
		if($(this).attr('type')!='submit' && $(this).attr('type')!='button'){
			iw = $(this).outerWidth();
			pw = $(this).parent().width();
			
			nw = pw-2;
			$(this).css('width',nw+'px');
			
			$(this).focus(function() {
				$(this).addClass('focus');
				//$(this).animateToClass("clicked", 1000);  
			});
			$(this).blur(function() {
 				$(this).removeClass('focus');
			});
		}else{
			$(this).addClass('button');
		}
	});
	$('textarea').each(function(i) {
		iw = $(this).width();
		pw = $(this).parent().width();
			
		nw = pw-3;
		$(this).css('width',nw+'px');
			
		  $(this).focus(function() {
			  $(this).addClass('focus');
		  });
		  $(this).blur(function() {
			  $(this).removeClass('focus');
		  });
	});
}
