$(document).ready(function() {
						   
	$('table.bcFormTable').hide();
	
	// When the homepage business card is clicked on, move it over the main
	// content and activate the form
	$('span.contactLink').click(function(){
		$('div.card').css('position', 'relative');
		$('div.card').css('z-index', 999);
		$('div.bcHolder').css('padding-bottom', '270px');
		$('div.bcHolder').css('background', 'url(../../images/bg-card-expand.png) no-repeat');
		$('table.bcFormTable').show();
		$('span.contactLink').hide();
	});
	
	// Hide the form and move the business card back under the content if
	// the cancel button is pressed
	$('.cancelButton').click(function(){
		$('div.card').css('position', 'static');
		$('div.card').css('z-index', 0);
		$('div.bcHolder').css('padding-bottom', '0px');
		$('div.bcHolder').css('background-image', '');
		$('table.bcFormTable').hide();
		$('span.contactLink').show();
	});
});

// Validate the homepage form
function bcValidate(){
	
	var theMessage = '';
	
	// Check that first name is filled out
	if(document.formBusinessCard.FirstName.value == ''){
		theMessage += 'Please enter your first name';
	}
	
	// Validate the email address
	if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.formBusinessCard.Email.value)){
		if(theMessage == ''){
			theMessage += 'Please enter your email address';
		} else {
			theMessage += ', email address';
		}
	}
	
	// Check that comments is filled out
	if(document.formBusinessCard.Comments.value == ''){
		if(theMessage == ''){
			theMessage += 'Please enter comments';
		} else {
			theMessage += ' and comments';
		}
	}
	
	// Take action after analysis
	if(theMessage == ''){
		return true;
	} else {
		alert(theMessage + ' to submit the form.');
		return false;
	}
}
