jQuery(document).ready(function($){
	// show the form and login the member

	$('.displayform').live('click',function(){
		var id=$(this).attr('id');
		var page=document.location.href;
		$.post(page,
			{
				'ajaxrequest':id
			},
			function (data){
				$('#loginform').html(data);
			}
		);
		$('#loginform').show('slow');
  		return false;
	});// end showcalendar


	$('.memberlogin').live('click',function(){
		var id=$(this).attr('id');
		var page=document.location.href;
		// make the db change to add the lead photo
		$.post(page,
			{
				'ajaxrequest':'displayloginform',
				'username':$('#username').val(),
				'password':$('#password').val()
			},
			function (data){
				if(data=='success'){
					document.location.href='membersonly/index.php';// go to next page if successful
				}
				else{
					alert(data);
				}
			}
		);

	return false;
	});// end .memberlogin

	$('.sendpassword').live('click',function(){
		var id=$(this).attr('id');
		var page=document.location.href;
		// make the db change to add the lead photo
		$.post(page,
			{
				'ajaxrequest':'displaylostpassform',
				'lastname':$('#lastname').val(),
				'email':$('#email').val()
			},
			function (data){
				dsplit=data.split(":");
				alert(dsplit[1]);
				if(dsplit[0]=='success'){
					// show the login form
					$.post(page,{
						'ajaxrequest':'displayloginform:changeform'
					},
						function(data){
						$('#loginform').html(data);
						$('#username').val('');
						$('#password').val('');
					}
					);
				}
			}
		);

	return false;
	});// end .sendpassword

	$('.webemail').live('click',function(){alert('working');
		var id=$(this).attr('id');
		var page=document.location.href;
		// make the db change to add the lead photo
		$.post(page,
			{
				'ajaxrequest':id,
				'lastname':$('#lastname').val(),
				'email':$('#email').val()
			},
			function (data){
				alert(data);
			}
		);

	return false;
	});// end .memberlogin


});

