/*
 * Make sure browser handles placeholder or not
 * @source http://www.cssnewbie.com/cross-browser-support-for-html5-placeholder-text-in-forms/
 */
jQuery(function() {
  jQuery.support.placeholder = false;
  test = document.createElement('input');
  if('placeholder' in test) jQuery.support.placeholder = true;
});
/*
 * Clear on focus function will
 * remove initial value from a input
 * on focus. If value is empty on blur
 * initial value will be set back.
 * @author  Simon
 */
jQuery.fn.clearonfocus = function() {
  if(!jQuery.support.placeholder) {
    var tag = jQuery(this);
    var placeholder = tag.attr('placeholder');
    tag.val(placeholder);
  	
  	tag.focus(function(e)
  	{
  		if(tag.val() == placeholder)
  		{
  		  tag.val('');
  		}
  	});
  	tag.blur(function() 
  	  {
  	  if(tag.val() == '')
  	  {
  	    tag.val(placeholder);
  	  }  
  	});
  }
}
