/**
 * Joseph Hawes
 * Joseph Hawes Web Development
 * http://www.josephhawes.co.uk
 * 24/03/11
 */
$('document').ready(function() {
	var html = $('html');
	//Make site fill browser
	$('div#container').css('min-height', $(window).height());
	//Add background image to <html>
	html.addClass('fade');
	//Align the <html> background image with an element of our choosing
	marker = $('.bg-marker');
	if(marker.length) {
		marker_position = marker.position();
		marker_bottom = marker.height() + marker_position.top;
		//496 is the height of the bg image
		container_bg_position_y = marker_bottom - 496;
		html.css('background-position', 'center ' + container_bg_position_y + 'px');
	}
	
	$('.single-download-click').click(function() { $('.register-box').hide(); $('.register-background').hide(); });
	
	//prefill forms
    if ($('.prefill').length > 0) {
        $('.prefill').each(function () {
            if ($(this).val() == '') $(this).val($(this).attr('data-default'));
            $(this).focus(prefillFocus);
            $(this).blur(prefillBlur);
        });
    }
	//$('.register-background').css('height',$(document).height()+'px');
	
});

function prefillFocus() {
    if ($(this).val() == $(this).attr('data-default')) $(this).val('');
}

function prefillBlur() {
    if ($(this).val() == '') $(this).val($(this).attr('data-default'));
}
