function EMail_id(str)
{
var exp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
if(exp.test(str))
	return true;
else
	return false;
}

function Phone(str)
{
var exp = /^(([A-Z])*([a-z])*([0-9])*(\-)*(\.)*(\+)*(\()*(\))*(\s)*)*$/
if(exp.test(str))
	return true;
else
	return false;
}

function Cardnumber(str)
{
var exp=/^([0-9]+\s*)+$/;
if(exp.test(str))
	return true;
else
	return false;
}

function Accountnumber(str)
{
var exp=/^([1-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9])$/;
if(exp.test(str))
	return true;
else
	return false;
}

function number(str)
{
var exp=/^([0-9]+)+$/;
if(exp.test(str))
	return true;
else
	return false;
}

function zipcode(str)
{
var exp=/^((([0-9])*([A-Z])*([a-z])*(\s)*)*)$/;
if(exp.test(str))
	return true;
else
	return false;
}

function Trim(str)
{
var exp=/^(\s)+|(\s)+$/g;
return(str.replace(exp,""));
}

function min(str,min)
{
	var s=Trim(str);

	if(s.length < min)
		return false;

	return true;
}

function max(str,max)
{
	var s=Trim(str);

	if(s.length > max)
		return false;

	return true;
}

function checklength(str,mn,mx,field)
{
	if(!min(str,mn))
	{
		return false;
	}
	
	if(mx >  0) 
	{
		if(!max(str,mx))
		{
			return false;
		}
	}
	
	return true;
}

function check(str,mn,mx,field)
{
	if(!min(str,mn))
	{
		alert("Please enter alteast " + mn + " characters for " + field);
		return false;
	}
	
	if(mx >  0) 
	{
		if(!max(str,mx))
		{
			alert("Please enter atmost " + mx + " characters for " + field);
			return false;
		}
	}
	
	return true;
}

function radiochecked(radioArray)
{
	
	for(i=0; i<radioArray.length; i++)
	{
		if(radioArray[i].checked)
		{
			return 1;
		}
	}

	return 0;
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


//Function to show the message
function show(div,flag)
{
	if (document.getElementById)
  	{
		var el = document.getElementById(div);
				    
    		if (el)
    		{
			
			if (flag == true) 
			{
			  	el.style.display = '';
			}
			else
			{
				el.style.display = 'none';
			}
    		}
 	  }	
 }

//Function to show the error message
function seterror(div,msg)
{
	  	
	if (document.getElementById)
  	{
		var el = document.getElementById(div);

		    
    		if (el)
    		{
			el.innerHTML = msg;
    		}
 	  }	
 }
