/**
 * lh.js
 * @author Lewis Howles
 *
 * Default Niceties.
 */

var lh = {

	/*
	 * Set default text for inputs (title attribute)
	 */
	setInputTexts : function(){
	   $("input[type=text], textarea").each(
		   function(){
			   $(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="popup"]')
			.attr('target', '_blank')
	}

}

$(function() {	
	if ($('h1').text() == "Search Results") {
		getValues();
	}
	
	lh.setInputTexts();
	lh.inputText();
	lh.externalLinks();
	
	if ($('h1').text() == "Search Results") {
		getValues();
	}

	 // colorbox
	 
	 var links = $("a[rel='colorbox']")
	 if (links.length) {
			links.colorbox({transition:"fade"});
	 }
	
	$('form.contact').highlight('fieldset');
	
			$('ul#fader').innerfade({
				speed: 2000,
				timeout: 5000,
				type: 'sequence',
				containerheight: '229px'
			});
});
