function emptyErrorMessage (error_area){
		if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
error.innerHTML = "&nbsp";
	}

function isEmpty(elem_name,helperMsg,error_area)
{
		var currentLocation = document.location.href;
		currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));

		if (error_area==null)
		{
			error_area = 'error';					  
		}
		var error = document.getElementById(error_area);
		var elem = document.getElementById(elem_name);
		if(elem.value.length == 0)
		{
				if(helperMsg != 'no_error')
				{
					document.location = currentLocation+'#'+error_area+'_anchor';
					error.innerHTML = helperMsg;
				}
				elem.focus();
				return false;
		}
		return true;
}
function isChecked(elem_name,helperMsg,error_area)
{
	var currentLocation = document.location.href;
	currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));
	if (error_area==null) 
	{
		error_area = 'error';					  
	}
	var error = document.getElementById(error_area);
	var elem = document.getElementById(elem_name);
	if(elem.checked == false)
	{
		alert(helperMsg);
		elem.focus();
		return false;
	}
	return true;
}

function isIdentical(elem_name, elem_name2, helperMsg,error_area)
{
	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
var elem2 = document.getElementById(elem_name2);
	if(elem.value !== elem2.value){
		error.innerHTML = helperMsg;
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function isNumeric(elem_name, helperMsg,error_area){
	var numericExpression = /^[0-9]+$/;
	var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));
	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	if((elem.value.match(numericExpression))|| (elem.value=="")){
		return true;
	}else{
document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}
}

function isAlphabet(elem_name, helperMsg,error_area){
	var alphaExp = /^[a-zA-Z]+$/;
	var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));
	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	if(elem.value.match(alphaExp)){
		return true;
	}else{
document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem_name, helperMsg,error_area){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem_name, min, max, helperMsg,error_area){
	var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));


	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	
	var uInput = elem.value;
	if((uInput.length >= min && uInput.length <= max) || (elem.value=="")){
		return true;
	}else{
		document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}
}

function madeSelection(elem_name, helperMsg, error_area){

var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));
if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	if(elem.selectedIndex == 0){
document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}else{
		return true;
	}
}

function emailValidator(elem_name, helperMsg,error_area){
		var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (error_area==null) {
error_area = 'error';					  
	}
var error = document.getElementById(error_area);
var elem = document.getElementById(elem_name);
	if((elem.value.match(emailExp)) || (elem.value == "")){
		return true;
	}else{
		document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		elem.focus();
		return false;
	}
}
function checkRadioElements(form_name, radioname, helperMsg, error_area)
{

var currentLocation = document.location.href;
currentLocation = currentLocation.substring(0, currentLocation.indexOf("#"));	

	if (error_area==null)
	{
		error_area = 'error';					  
	}
	
	var error = document.getElementById(error_area);
	radioElements = eval("document."+form_name+"."+radioname);

	for(var i=0;i<radioElements.length; i++)
	{
		if(radioElements[i].checked == true)
		{		
			isChecked = true;
			break;
		}
		else {
		isChecked = false;
		}
	}
	if (!isChecked) {

		document.location = currentLocation+'#'+error_area+'_anchor';
		error.innerHTML = helperMsg;
		
	return false;
	}
	else {return true;}
}


function resetForm(form_name) {
var formElements = eval('document.'+form_name);
	for(i=0; i<formElements.elements.length; i++)
	{
		if (formElements.elements[i].tagName == 'INPUT') {
			if (formElements.elements[i].type == 'text') {
			formElements.elements[i].value = "";
			}	
		}

	}

}
