/* Copyright (c) 2010 Soaring Penguin, LLC (http://www.soaring-penguin.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version 1.0
 */
jQuery(
	function($){
		
		//Fills in the Inputs helper label text
		$("label").each(function(){
			
			if($(this).attr("for") != "")
			{
				var inputName = $(this).attr("for");
				
				$('input[name="'+inputName+'"]').val($(this).text());	
			}
									 
		});	
		
		$('input:text').focus(function(){
			//If the text matchs that from its label clear it out
			var labelName = 'label#'+$(this).attr("name");
			var textVal = $(labelName).text();
			if($(this).val() == textVal)
			{
					$(this).val("");
			}
		});
		
		$('input:text').blur(function(){
			var labelName = 'label#'+$(this).attr("name");
			var textVal = $(labelName).text();
				if($(this).val() == "")
			{
					$(this).val(textVal);
			}
		});
			
	}
);
