$(document).ready(function(){
	
	$('.display_container img').hide().eq(0).show();
	
	$(window).bind("load",function(){
		$('.display_container').cycle({
			speed: 500,
			timeout: 6000
		});
		
		$('.thumb_container').mouseover(function(){
			selectindex=$('.thumb_container').index(this);
			$('.display_container').stop().cycle(selectindex);
		});
		
	});
	
	$('.txtxbox').eq(0).focus(function(){
		$(this).val("");								   
	});
	
	$('.txtxbox2').focus(function(){
		$(this).val("");								   
	});
	
	$('#baf_form').submit(function(){
		emailval=$('.txtxbox').eq(0).val();
		if(CheckEmail(emailval))
		{
			$.post("media/php/baf.php",{emailadd: emailval},function(data){
				$('#returninfo').text(data);				  
			});
		}
		else
		{
			$('#returninfo').text("Please enter a valid email address");
		}
		return false;
	});
});

function CheckEmail(inputemail) {
	AtPos = inputemail.indexOf("@");
	StopPos = inputemail.lastIndexOf(".");

	if (AtPos == -1 || StopPos == -1)
	{
		return false;
	}
	else
	{
		return true;	
	}

}