
$(document).ready(function() {

$(".search input").attr({ value: 'Search the website'}).focus(function(){
	if($(this).val()=="Search the website"){
		$(this).val("");
	}
}).blur(function(){
	if($(this).val()==""){
		$(this) .val("Search the website");
	}
});

function makeBgImg() {
	var newBG = $(this).find('.moduleBody img:first').attr('src');
	$(this).find('.moduleBody img:first').hide();
	$(this).css({'background':'url("'+newBG+'") top left no-repeat'});
}

$('.slideshow .module').each(makeBgImg);

//menu stuff and effects
$('nav a').removeAttr("title")	;
$('nav #HouseMenuNav').append('<li id="loginOut"></li>');
$('.user').appendTo("#loginOut")
$('nav > ul > li ul').parent('li').addClass('haschild');
$('nav > ul > li ').append('<span class="left"></span><span class="bg"></span><span class="right"></span>')
$('.haschild').hover(function(){
	$(this).children('ul').show();
	//console.log('test');
}, function() {
	$(this).children('ul').hide();
});


//tab system on homepage
function makeTabButtons(i) {
	tabText = $(this).children(".module").children('.moduleTitle').text();
	$('.tabButtons').append('<a href="#" class="tab'+i+'">'+tabText+'</a>');
	$(this).addClass('tab tab'+i).hide();
}
function clickTabButtons () {
	var tabNumber = $(this).attr('class');
	$(this).addClass('active').siblings('a').removeClass('active');
	$('.tabContent .'+tabNumber).show().siblings('.DnnModule').hide();
	return false;
}
$('.tabs').prepend('<div class="tabButtons"></div>');//<h2>The benefits for...</h2>
$('.tabs .DnnModule').wrapAll('<div class="tabContent"></div>').each(makeTabButtons);
$('.tabButtons a').click(clickTabButtons)
$('.tab0').addClass('active').show();


var h = $("#bottom").innerHeight();

if ( h < 80 ){
	$("#bottom").hide()
};




});
