// JavaScript Document
function delete_rec()
{
	var confans;
	confans=confirm("Are you sure you want to delete this record?")
	if(confans)
	{    
		return true;
	}
	else
	{
		return false;
	}
}
function KeyDownHandler(btn)    
{         
	if (event.keyCode == 13)           
	{  
	//alert( event.keyCode);         		
	event.returnValue    =    false;            
	event.cancel        =    true;         
	var obj = document.getElementById(btn);        
	obj.click();             
	}     
}

function CheckFileNamePatrika(ObjName)
{
	var strErr;
	strErr=""
	
	mFileName= ObjName
	mFileName = eval(mFileName)
	filename = mFileName.value
		
	totalChars = mFileName.value.length
	indexofdot = filename.lastIndexOf(".",totalChars)
	fileExt = filename.substring(totalChars,indexofdot)
	
	if((fileExt.toUpperCase() != ".ZIP"))
	{ 
		strErr = "* Please upload only .zip files \n"
	}
		
	return strErr
}
function CheckFileNamePatrikaPDF(ObjName)
{
	var strErr;
	strErr=""
	
	mFileName= ObjName
	mFileName = eval(mFileName)
	filename = mFileName.value
		
	totalChars = mFileName.value.length
	indexofdot = filename.lastIndexOf(".",totalChars)
	fileExt = filename.substring(totalChars,indexofdot)
	
	if((fileExt.toUpperCase() != ".PDF"))
	{ 
		strErr = "* Please upload only .pdf files \n"
	}
		
	return strErr
}

function GetAlert(ObjMessage)
{
   alert(ObjMessage);
   history.back();
}


function email_check(vObjName)
{	
	var temp_email=vObjName.value
	var temp_email_split=temp_email.split("@")

	if(temp_email_split.length!=2)
	{
		alert("Email address is incorrect.")
		vObjName.focus()
		return false;
	}
	if(temp_email_split[temp_email_split.length-1].length<=1)
	{
		alert("Email address is incorrect.")
		vObjName.focus()
		return false;
	}
	var temp_split_comma=temp_email_split[temp_email_split.length-1].split(".")
	if(temp_split_comma.length<=1)
	{
		alert("Email address is incorrect.")
		vObjName.focus()
		return false;
	}
	if (temp_split_comma[temp_split_comma.length-1].length<=1)
	{
		alert("Email address is incorrect.")
		vObjName.focus()
		return false;
	}
	else
	{
		if(!isNaN(temp_split_comma[1]))
		{
			alert("Email address is incorrect.")
			vObjName.focus()
			return false;
		}
	}
	return true;
}

function email_check(vObjName,strMess)
{	
	var temp_email=vObjName.value
	var temp_email_split=temp_email.split("@")

	if(temp_email_split.length!=2)
	{
		return strMess;
	}
	if(temp_email_split[temp_email_split.length-1].length<=1)
	{
		return strMess;
	}
	var temp_split_comma=temp_email_split[temp_email_split.length-1].split(".")
	if(temp_split_comma.length<=1)
	{
		return strMess;
	}
	if (temp_split_comma[temp_split_comma.length-1].length<=1)
	{
		return strMess;
	}
	else
	{
		if(!isNaN(temp_split_comma[1]))
		{
			return strMess;
		}
	}
	return '';
}
function email_check_multiple(vObjName,strMess)
{	
	var temp_email=vObjName.value;
	var temp_email_temp=temp_email.split(",");

	for(var i=0;i<temp_email_temp.length;i++)
	{
		var temp_email_split=temp_email_temp[i].split("@")

		if(temp_email_split.length!=2)
		{
			return strMess;
		}
		if(temp_email_split[temp_email_split.length-1].length<=1)
		{
			return strMess;
		}
		var temp_split_comma=temp_email_split[temp_email_split.length-1].split(".")
		if(temp_split_comma.length<=1)
		{
			return strMess;
		}
		if (temp_split_comma[temp_split_comma.length-1].length<=1)
		{
			return strMess;
		}
		else
		{
			if(!isNaN(temp_split_comma[1]))
			{
				return strMess;
				break;
			}
		}
	}
	
	return '';
}