$(document).ready(function()
{
	
	$( "#Forgotten-Link" ).click(function(){
		$('#Forgotten').css('display','block');
	});
	
	$( "#Accessibility-Form" ).dialog({
		autoOpen: false,
		height: 200,
		width: 335,
		modal: true
	});

	$( "#Accessibility" )
		.click(function() {
			$( "#Accessibility-Form" ).dialog( "open" );
	});
	
	$( "#edit-profile-form" ).dialog({
		autoOpen: false,
		height: 400,
		width: 335,
		modal: true
	});

	$( "#Profile" )
		.click(function() {
			$( "#edit-profile-form" ).dialog( "open" );
	});
	
	$("#edit-profile-form2").validate({
	  rules: {
			Name: {
				required: true
			},
			EmailAddress: {
				required: true,
				email: true,
				remote: "http://www.whitbytowncouncil.co.uk/validate.php?key=ProfileEmail"
			},
			Password: {
				required: true,
				remote: "http://www.whitbytowncouncil.co.uk/validate.php?key=ProfilePassword"
			},
			NewPassword: {
				minlength: 6
			},
			confirm_NewPassword: {
				minlength: 6,
				equalTo: '#NewPassword'
			}
		},
		messages: { 
			EmailAddress: { 
				required: "Please enter a valid email address", 
				minlength: "Please enter a valid email address", 
				remote: jQuery.format("Email address is already in use &#8593;")
			},Password: { 
				required: "Please enter your password", 
				remote: jQuery.format("Please enter your correct password &#8593;") 
			} 
		}
	});

});

function showBlogs(pID){
	$('#'+pID).toggle();
}

function showDocuments(pID){
	$('#'+pID).toggle();
	$('.'+pID).toggle();
}

function updateProfile(){
	$.post("updateprofile.php", $("#edit-profile-form2").serialize(),function(data){
		alert(data);
	});
	$( "#edit-profile-form" ).dialog( "close" );
}

function fontsize(pSize){
	var fontSize = pSize;
	alert(fontSize);
	window.location.reload();
}

function sendPassword(){
	$.post("/reminder.php", $("#Forgotten").serialize(),function(data){
		alert(data);
	});
}
