
function validate_pass()
{
if(document.getElementById('current_password').value == '')
	{
		alert('Please enter the current password');
		document.getElementById('current_password').focus();
		return false;
	}
	else if(document.getElementById('current_password').value != "")
	{
		if(document.getElementById('current_password').value != document.getElementById('cur_pass').value)
		{
			alert('Sorry.. Your current password is wrong');
			document.getElementById('current_password').focus();
			return false;
		}
	}
	
	if(document.getElementById('new_password').value.trim()== '')
	{
		alert('Please enter new password');
		document.getElementById('new_password').focus();
		return false;
	}
	else if(document.getElementById('new_password').value.trim()!= '')
	{		
		/*var iChars = "";
		
		for (var i = 0; i < document.getElementById('new_password').value.length; i++) 
		{
			if(iChars.indexOf(document.getElementById('new_password').value.charAt(i)) != -1) 
			{
				
				alert('Only alphabets are allowed');
				document.getElementById('new_password').focus();
				return false;
			}
		}*/
		
		strlength = document.getElementById('new_password').value.trim().length;
		if(strlength<6)
		{
		 	alert('Minimum 6 Characters should be entered');
			document.getElementById('new_password').focus();
			return false;
		}
	}
	if(document.getElementById('confirm_password').value.trim()== '')
	{
		alert('Please enter confirm password');
		document.getElementById('confirm_password').focus();
		return false;
	}
	else if(document.getElementById('confirm_password').value.trim()!= '')
	{
		
		var new_username = document.getElementById('new_password').value.trim();
		var confirm_username = document.getElementById('confirm_password').value.trim();
		if(new_username != confirm_username)
		{
			alert('Invalid confirm password');
			document.getElementById('confirm_password').focus();
			return false;
		}
	}
	var  new_password = document.getElementById('new_password').value.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
	document.getElementById('new_password').value = new_password;
	
	var  confirm_password = document.getElementById('confirm_password').value.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
	document.getElementById('confirm_password').value = confirm_password;
	
	var where_to= confirm(" Do you really want to Submit Form?");
		if (where_to== true)
		{
			document.fm.submit();
		}
		else
		{
			return false;		
		}
	
}


function clearField()
{
	window.location.reload();	
}





function foc(ids)
{
	document.getElementById(ids).style.border="2px solid #0099FF";
	
}

function stnon(ids)
{
	document.getElementById(ids).style.border="thin solid #CCCCCC";
}