/**
 * lh.js
 * @author Lewis Howles
 *
 * Default Niceties.
 */

var lh = {
	
	/*
	 * Set default text for inputs (title attribute)
	 */
	setInputTexts : function(){
		$("input[type=text], textarea").each(
			function(){
				if($(this).val() === "")
					$(this).val($(this).attr('title'));
			}
		);
	},
	
	/*
	 * Show / hide text from inputs
	 */
	inputText : function(){
	   $("input, textarea").focus(function(event){
		   if($(this).val() === $(this).attr('title'))
			   $(this).val("");
	   }).blur(function(event){
		   if($(this).val() === "")
			   $(this).val($(this).attr('title'));
	   });
	},
	
	/*
	 * Set target blank on external links
	 */
	externalLinks : function(){
		$('a[rel="external"]')
			.attr('target', '_blank')
	}   
}

$(function() {
	lh.setInputTexts();
	lh.inputText();
	lh.externalLinks();
});
