var currentImg = 1;
var imageChange = 0;
function swapBigImage()
{
	var photos = [
		{"iURL" : "/images/index/couple_01.jpg"},
		{"iURL" : "/images/index/couple_02.jpg"},
		{"iURL" : "/images/index/couple_03.jpg"}
	];

	currentImg++;

	if(currentImg > photos.length)
		currentImg = 1;

	$(".index_image").fadeOut(function()
	{
		$(".index_image").css({
			"background-image" : "url(/images/index/couple_0" + currentImg + ".jpg)"
			});
		$(".index_image").fadeIn();
	});

	imageChange = setTimeout('swapBigImage()',11500);
}

$(document).ready(function() {
	$(function() {
		$("#menu").lavaLamp( {
			fx: "backout",
			speed: 700,
			click: function(event, menuItem) {
			// return false;
			}
		});
	});

	$('#forgotpasslink').click(function() {
		$('#forgotpassdata').show('fast');
	});

	$('#forgot_close').click(function() {
		$('#forgotpassdata').hide('fast');
	});

	$('#forgot_password').submit(function() {
		if($("#emailaddress").val() == '') {
			alert('Please enter your emailaddress.');
		}
		else {
			var re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
			if (re.test($("#emailaddress").val())==false) {
				alert('You have entered a invalid emailaddress.');
			}
			else {
				return true;
			}
		}
		return false;
	});

	$('#forgot_password2').submit(function() {
		if($("#emailaddress2").val() == '') {
			alert('Please enter your emailaddress.');
		}
		else {
			var re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
			if (re.test($("#emailaddress2").val())==false) {
				alert('You have entered a invalid emailaddress.');
			}
			else {
				return true;
			}
		}
		return false;
	});

	$('.flags img').click(function()
	{
		window.location.replace("/?cc=" + $(this).attr('id'));
		return false;
	});

	$('#new_personal_information').submit(function()
	{
		$('.qs_container').hide('fast');
	});

	$("#account_menu_main").find('a').each(function()
	{
		var hrf = $(this).attr("href");
		$(this).attr("href", "/myaccount.php" + hrf);
	});

	imageChange = setTimeout('swapBigImage()',11500);
});
