// JScript source code
function chkPrice(val)	//FOR AMOUNT(Allow only "," & ".")>>IN USE
	{
		var checkok="1234567890.";
		var checkstr=val;
		len = val.length;
		var validok=true;
		var dot=0;
		if (len==1 && checkstr==".")
			{
				validok=false;
			}
		
		if (parseFloat(checkstr)==0 || parseFloat(checkstr)<.01)
			{
				validok=false;
			}
		for(i=0;i<len;i++)
			{
				var ch_dot=checkstr.charAt(i);
				if (ch_dot=='.')
					{
						dot=dot+1;
					}
			}
		if (dot>1)
			{
				validok=false;
			}
		dot=0;
		for(i=0;i<len;i++)
			{
				var ch=checkstr.charAt(i);
				for (j=0;j<=checkok.length;j++)
					{
						if (ch==checkok.charAt(j))
							{
							    if (ch=='.')
									{
										dot=dot+1;
									}
								break;
							}
						if (j==checkok.length || dot>1)
							{
								validok=false;
								break;
							}
					}
				if(!validok)
					{
						return false;
					}
			}
		return true;
	}
// Used to restrict the single quote & double quote
function s_quote(val)
{
	var lengt=val.length;
	for(i=0;i<lengt;i++){
		if((val.charAt(i)=="'") || (val.charAt(i)=='"'))
		{ return false;}
	}
	return true;
}

// Used to restrict the special Characters
function spe_char(val)
{
	var lengt=val.length;
	for(i=0;i<lengt;i++)
		{
			if((val.charAt(i)=='%') || (val.charAt(i)=='^') || (val.charAt(i)=='|') || (val.charAt(i)=='?') || (val.charAt(i)=='`') || (val.charAt(i)=='~') || (val.charAt(i)=='&'))
				{return false;}
		}
	return true;
}
function email_val(val)
{
	var lengt=val.length;
	for(i=0;i<lengt;i++)
		{
			if(val.charAt(i)=='@')
			{return true;}
		}
	return false;
}
//It should not allow Exponential char 'E'
function expo_e(val)
{
	len=val.length
	for(i=0;i<len;i++){
		if((val.charAt(i)=="E"))
		{ return false;}
	}
	return true;
}
//>> used to hide
function page_loader()
	{
		document.getElementById('header_back').style.display="none";
		document.getElementById('module_back').style.display="none";
		document.getElementById('buttons_back').style.display="none";
		document.getElementById('print_icon').style.display="none";
	}
function src_loader()
	{
		document.getElementById('header').style.display="none";
		document.getElementById('header_back').style.display="none";
		document.getElementById('module_back').style.display="none";
		document.getElementById('buttons_back').style.display="none";
		document.getElementById('print_icon').style.display="none";
	}
//page_loader1 is to hide the header and menu elements
//scurity protection (var:hide_elements)
function page_loader1()
	{
		document.getElementById('header_back').style.display="none";
	}
//
function reset()
	{
		document.eflexidata.reset();
	}
//-Used to Print----------------
function prn()
	{
		window.print();
	}
//-------------
//Used to restrict the spaces as a input
function spaces(val)
	{
  		//if(val==""){
		//return false;}
		if (val!="")
			{
				var len=val.length;
				if (len==1)
					{
						if((val.charAt(0)==' ') || (val.charAt(0)=='.')) 
							{
								return false;
							}
					}
				for(i=0;i<len;i++)
					{
						if ((val.charAt(i)==' ') && (val.charAt(i+1)==' '))
							{
								return false;
							}
					}
			}
			return true;
	}
//-------------------------
//Name validation
function name1(val)
{	//Special Characters not allowed
	if(val==""){
	return false;}
	else
		if(val > ""){
		var len=val.length;
		if (len==1){
			if((val.charAt(0)==' ') || (val.charAt(0)=='.')) 
			{ return false; }
		}
		for(i=0;i<len;i++){
				if((val.charAt(i)==' ') && (val.charAt(i+1)=='.'))
				{  return false; }
				if ((val.charAt(i)==' ') && (val.charAt(i+1)==' ') 
				|| (val.charAt(i)=='.') && (val.charAt(i+1)=='.'))
				{	return false;}
				else if ((val.charAt(i)>='A' && val.charAt(i)<='Z')
					|| (val.charAt(i)>='a' && val.charAt(i)<='z')
					|| (val.charAt(i)==' ') || (val.charAt(i)=='.')){}
				else {return false;}
			}
		}	   
	return true; 
}
//------------
//num1 function checks whether the number is valid integer number
function num1(val)
{	
	len = val.length; 
	if(len==0)
	{
	    return false;
	}
	if (val > ""){  
			j=1;
			for (i=0;i<len;i++)
			{
		       temp=parseInt(val.substring(i,j++));
			   if(temp>=0 && temp<=9)
				{
					validity=0;
				}
				else
				{
					validity=1;
					break;			    
				}	
			}
			if (validity==1)
			{
			    return false;
			}
		}
return true;
}
//--------------------------
//-----Alpha numeric Validation (A to Z) and  (0 to 9)
function alpha_num(val)
{
	if(val==""){
		return false;}
	if(val > ""){
		var len=val.length;
		if (len==1){
			if((val.charAt(0)==' ') || (val.charAt(0)=='.')) 
			{ return false; }
		}
		for(i=0;i<len;i++){
			if((val.charAt(i)==' ') && (val.charAt(i+1)=='.'))
				{  return false; }
			if ((val.charAt(i)==' ') && (val.charAt(i+1)==' ') 
				|| (val.charAt(i)=='.') && (val.charAt(i+1)=='.'))
				{	return false;}
			if ((val.charAt(i)>='A' && val.charAt(i)<='Z')
					|| (val.charAt(i)>='a' && val.charAt(i)<='z')
					|| (val.charAt(i)==' ') || (val.charAt(i)=='.') 
					|| (val.charAt(i)>='0' && val.charAt(i)<='9')){}
			else {return false;}
		}
	}	   
	return true; 
}
//Validation for Phone Value
function phone_chk(val)
{
		len=val.length;
		if (val > ""){  
			j=1;
			for (i=0;i<len;i++)
			{
		       sub_str_val=val.substring(i,j++);
		       temp=parseInt(sub_str_val);
		       if((temp>=0 && temp<=9) || sub_str_val=='(' || sub_str_val==')' || sub_str_val=='-' || sub_str_val=='+' || sub_str_val==' ' || sub_str_val==',')
				{
					validity=0;
				}
				else
				{
					validity=1;
					break;			    
				}	
			}
			if (validity==1)
			{
			    return false;
			}
		}
return true;
}  
//
function re_fresh()
{	
document.eflexidata.reset();
}
function report_action()
	{
		report_path=document.eflexidata.report_path.value;
		document.eflexidata.action=report_path
		document.eflexidata.submit();
	}