$(document).ready(function (){
	$("#send_mail").click(function (){
		if (chkmail()){
			$("#resultsend").html("&nbsp;&nbsp;<img src='images/roll_blue.gif' height='20px' width='20px'/>");
			function send(text){
				//var s = text.replace(/[^0-9]/g,'');
				if (text==1){
					$("#ressend").html(m24);
					
				}else if (text==2){
					$("#ressend").html(m26);
				}else{
					$("#ressend").html(m9+"<font color=green> "+text+" </font>,"+m10+"<a href='login.php'>"+m25+"</a><br>"+m18+" <a href='javascript:;' onclick='remail()'>"+m19+"</a>");
				}
			}
			$.get("set_mail_to_ms.php?"+Math.random(),{getpwd:$("#mail").val() },send);
		}
	});	
	$("#sub_code").click(function (){
		if (chkcode()){ 
			$("#resultcode").html("&nbsp;&nbsp;<img src='images/roll_blue.gif' height='20px' width='20px'/>");
			function send(text){
				if (text==1){
					$("#rescode").html(m14);
				}else if (text==2){
					$("#rescode").html(m15);
				}else{
					$("#rescode").html(m11+"<font color=green> "+text+" </font>,"+m12+" <a href='javascript:;' onclick='window.open(\"./paswdmody.php\",\"_blank\",\"\")'>"+m13+"</a>");
				}
			}
			$.get("get_pwd.php?"+Math.random(),{code:$("#chkcode").val()},send);
		}
	});	
});
function chkmail(){
	var str = $("#mail").val().replace(/[\\\/\:\?\*\<\>\|\"\=\' ]/g,'');
	$("#mail").val(str);
	if(str.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig)){
		$("#mail").css({background:"white"});
		return true;
	}else{
		$("#mail").css({background:"pink"});
		alert(m3);
		$("#mail").focus();return false;
	}
}
function chkcode(){
	var str = $("#chkcode").val().replace(/[^0-9]/g,'');
	$("#chkcode").val(str);
	if(str.length==6){
		$("#chkcode").css({background:"white"});
		return true;
	}else{
		$("#chkcode").css({background:"pink"});
		alert(m4);
		$("#chkcode").focus();return false;
	}	
}
function remail(){
	//$("#ressend").html("<div style='float:left'>"+m21+" <input name='mail' id='mail' type='text' size='20' /> <input type='button' name='send_mail' id='send_mail' value='"+m20+"' /></div><div id='resultsend'></div>");	
	window.location.reload();
}

