/*
  Auto-Fill function accepts id of input and fills it with the given value.
  Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
  JP 17/03/2009 changed $ references to jQuery
*/
function autoFill(id, v){
	jQuery(id).css({ color: "#999" }).attr({ value: v }).focus(function(){
		if(jQuery(this).val()==v){
			jQuery(this).val("").css({ color: "black" });
		}
	}).blur(function(){
		if(jQuery(this).val()==""){
			jQuery(this).css({ color: "#999" }).val(v);
		}
	});
}


/*
  Set up behaviours
*/
jQuery(document).ready(function(){
  // workaround for Contact Form 7, which does not use provide ids for input fields..
  jQuery('input[name="your-name"]').attr('id','your-name');
  jQuery('input[name="your-email"]').attr('id','your-email');
  jQuery('textarea[name="your-message"]').attr('id','your-message');

  // input prompts
	autoFill("#s", "Search");
  autoFill("#comment", "Any comments? Type your reply here");
  autoFill("#your-name", "Your name");
  autoFill("#your-email", "Your email address");
  autoFill("#your-message", "Type your message here");
});
