$(function(){
	var registerFormOptions = {
		autoOpen : false ,
		modal : true , 
		show : true ,
		hide: true ,
		width: 500,
		minWidth: 500,
		minHeight: 200,
		maxWidth: 600,
		maxHeight: 500
	};
	var noticeOptions = {
		autoOpen : false ,
		modal : true , 
		show : true ,
		hide: true ,
		width: 300,
		minWidth: 300,
		minHeight: 100,
		maxWidth: 600,
		maxHeight: 500
	};
	$("#registerForm").dialog(registerFormOptions);
	$("#notice").dialog(noticeOptions);
	$("#registerLink a").click(prepareForRegister);
	$("#registerForm a").click(ajaxRegister);

});

function prepareForRegister(){
	$("#registerForm").dialog("open");
	return false;
}

function ajaxRegister(){
	$.ajax({
	   type: "POST",
	   url: "register.php",
	   data: $("#register").serializeArray(),
	   success: noticeUser		   
	   });
	return false;
}

function noticeUser(data, status){
	$("#notice").html(data);
	$("#registerForm").dialog("close");
	$("#notice").dialog("open");
}

