//**************************
// check change password form
//**************************
function check_changePassword_form()
{
	var oldpassword=document.form1.old_password;
	var newpassword=document.form1.new_password;
	var conpassword=document.form1.confirm_new_password;
	if(oldpassword.value == '')
	{
		alert('Old password field can not be empty');
		oldpassword.focus();
		return false;
	}
	if(newpassword.value == '')
	{
		alert('New password field can not be empty');
		newpassword.focus();
		return false;
	}
     if(conpassword.value == '')
	{
		alert('Confirm password field can not be empty');
		conpassword.focus();
		return false;
	}
	if(newpassword.value!=conpassword.value){
	
		alert('New password and Confirm password can not match');
		conpassword.focus();
		return false;
	}
	return true;
}
//--------------------------------
function validateUpdateprofile()
{
		var email=document.form1.email;
		if(email.value == '')
		{
			alert('Email can not be empty');
			email.focus();
			return false;
		}
        
		if(email.value != '')
		{
			if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value))
			{
			alert('Email is not valid.');
			email.focus();
			return false;
			}
		}
}
//----------------------------------------------------
function checkNewsEmpty()
{
  if(document.newsform.new_title.value == ''){
   alert('Please enter News Title');
   return false;
  }
   if(document.newsform.startdate.value == '' || document.newsform.startdate.value == 'YYYY-MM-DD'){
   alert('Please enter news Issue date');
   return false;
   }
   if(document.newsform.enddate.value == '' || document.newsform.enddate.value == 'YYYY-MM-DD'){
   alert('Please enter news expiry date');
   return false;
  }
}
//-------------Upload user csv validation-----------
function CheckUploadfiles()
{
	//alert('krishna');
var fup = document.getElementById('uploadcsv');
var file = fup.value;
var ext = file.substring(file.lastIndexOf('.') + 1);
if(ext == "csv")
{
return true;
} 
else
{
alert("Upload csv file only");
fup.focus();
return false;
}
}
//--------------------------------------------------
function block_news(lid,status,msgtxt)
{
	var arrmsg =msgtxt.split("#");	
	if(status=='1')
	{
		var msg=arrmsg['0'];
	}else if(status=='0')
	{
		var msg=arrmsg['1'];
	}
	if(confirm(msg)){
	window.location.href="add_news.php?newsid="+lid+"&status="+status;
	}
}