$(document).ready(function() {
	
	$('#bannerAd').load("/banner_image.php");
	
	$('#addProfile_button').hover(function() {
		$(this).css('background-color', '#e5e5ff');
		$(this).css('color', 'blue');
		$(this).css('cursor', 'pointer');
	}, function() {
		$(this).css('background-color', 'white');
		$(this).css('color', '#4887fe');
	})

	$('#addProfile_button').click(function() {
		$('#profile_box').show();
	});

	$('#optout_button').click(function() {
		if ($(this).val()) {
			$('#profile_box').css('opacity', '0.3');
		} else {
			$('#profile_box').css('opacity', '1');
		}
	});
	
	$('#add_person_form').submit(function() {
		alert($('#optout_button').val());
		failed = 0;
		if (!$('#people_country').val() && !failed) {
			alert("You need to select a country");
			failed = 1;
		}
		if (!$("INPUT[name='user_login']").val() && !failed) {
			alert("You need to enter a username");
			failed = 1;
		}
		if (!$("INPUT[name='user_email']").val() && !failed) {
			alert("You need to enter an email address");
			failed = 1;
		}
		if ((!$("INPUT[name='user_password1']").val() || !$("INPUT[name='user_password2']").val()) && !failed) {
			alert("You need to enter a password");
			failed = 1;
		}
		if (!$("INPUT[name='people_city']").val() && !failed) {
			alert("You need to enter a city");
			failed = 1;
		}
		if (!$("INPUT[name='people_city']").val() && !failed) {
			alert("You need to enter a name");
			failed = 1;
		}
		if (failed) {
			return false;
		}
		
	});

	$('.gallery_folder A').hover(
		function() {
			$(this).children(0).children(0).attr('src', '/images/photos_open.png');
		}, function() {
			$(this).children(0).children(0).attr('src', '/images/photos.png');
		}
	);
});

function change_flash_var(pictures_category) {
	swfu.settings.post_params.pictures_category = pictures_category;
}

function get_folder() {
	alert(pictureForm.orderBy.options[pictureForm.orderBy.selectedIndex].value);
}

