// JavaScript Document
function login()
{
	//alert("Hello");
	if(document.frmlogin.txtuname.value=="")
	{
		$("#contentArea").html("Please enter user name.");
		document.frmlogin.txtuname.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	if(document.frmlogin.txtpass.value=="")
	{
		$("#contentArea").html("Please enter password.");
		document.frmlogin.txtpass.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
		document.frmlogin.action="loginpro.php";
		document.frmlogin.submit();
	//var myname=document.frmlogin.txtuname.value;
//	var mypass=document.frmlogin.txtpass.value;
//	//alert(myname);
//	$.ajax({
//	url :"loginpro.php?name="+myname+"&mypass="+mypass,
//	success : function (data) 
//	{
//				if(data)
//				{
//					$("#contentArea").html(data);
//					document.frmlogin.txtuname.value="";
//					document.frmlogin.txtpass.value="";
//					document.frmlogin.txtuname.focus();
//				}
//				else
//				{
//					var b = document.getElementById("contentArea"); 
//					b.innerHTML = ""; 
//					//$("#contentArea").innerHTML = ""; 
//					document.frmlogin.action="virtuallist.php";
//					document.frmlogin.submit();
//				}
//				
//	}
//	});
	
}

function changelogin()
{
	//alert("Hello");
	if(document.frmlogin.txtuname.value=="")
	{
		$("#contentArea").html("Please enter user name");
		document.frmlogin.txtuname.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	if(document.frmlogin.txtpass.value=="")
	{
		$("#contentArea").html("Please enter current password");
		document.frmlogin.txtpass.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	if(document.frmlogin.txtpass1.value=="")
	{
		$("#contentArea").html("Please enter new password");
		document.frmlogin.txtpass1.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	
	if(document.frmlogin.txtpass1.value.length<6)
	{
		$("#contentArea").html("Lenght of password must be greater than six.");
		document.frmlogin.txtpass1.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	
	if(document.frmlogin.txtpass2.value=="")
	{
		$("#contentArea").html("Please enter new password again");
		document.frmlogin.txtpass2.focus();
		return(false);	
	}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	if(document.frmlogin.txtpass1.value!=document.frmlogin.txtpass2.value)
		{
			$("#contentArea").html("Please confirm your new password");
			document.frmlogin.txtpass1.focus();
			return(false);	
		}
	else
		{
			var b = document.getElementById("contentArea"); 
			b.innerHTML = ""; 
		}
	
	
	var myname=document.frmlogin.txtuname.value;
	var curpass=document.frmlogin.txtpass.value;
	var newpass=document.frmlogin.txtpass1.value;
	//alert("Hello");
			$.ajax({
			url :"changepasspro.php?actname="+myname+"&curpass="+curpass+"&newpass="+newpass,
	success : function (data) 
	{
				if(data)
				{
					$("#contentArea").html(data);
					document.frmlogin.txtuname.value="";
					document.frmlogin.txtuname.focus();
				}
				else
				{
					var b = document.getElementById("contentArea"); 
					b.innerHTML = ""; 
					//$("#contentArea").innerHTML = ""; 
					//document.frmlogin.action="virtuallist.php";
					//document.frmlogin.submit();
				}
				
	}
	});
	
}
