jQuery(function($) {
	$("#retrieveForm").submit(checkLoginForm);
	$("#type1").click(typeSelect);
	$("#type2").click(typeSelect);
	 typeSelect();
});
function checkLoginForm(){
    inputMsg.submitButton = 'senter';
	var accResult = checkAccount('accounts',0);
	if(accResult != 1){
		inputMsg.showBox("accounts", 'error', accResult, 'hide');
		$("#accounts").select();
		return false;
	}
	if($("#reType").val()=='1'){
		var mailResult = checkEmail('fgmail',0);
		if(mailResult != 1){
			inputMsg.showBox("fgmail", 'error', mailResult, 'hide');
			$("#fgmail").select();
			return false;
		}
	}
	if($("#reType").val()=='2'){
		var mobileResult = checkMobile('fgmail',0);
		if(mobileResult != 1){
			inputMsg.showBox("fgmail", 'error', mobileResult, 'hide');
			$("#fgmail").select();
			return false;
		}
	}
	inputMsg.submit('senter');
	
	$.ajax({
		type:"POST",
		url:"/ajax/",					
		data:{module:'retrievePwd',action:'retrieve',accounts:$("#accounts").val(),mail:$("#fgmail").val(),mobile:$("#fgmail").val(),type:$("#reType").val(),token:$("#token").val()},
		success:function(data){	
			inputGo(data);
		}
	});
	return false;
}
function typeSelect(){
	var obj = document.getElementById("type1");
	var obj2 = document.getElementById("type2");
	if(obj.checked){
		$("#reType").val('1');
		$("#vname").html("E-mail：");
	}else if(obj2.checked){
		$("#reType").val('2');
		$("#vname").html("手　機：");
	}
}

