
function isValidControl(cntrl, msg)
{
	if(isBlank(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidRadio(cntrl, msg)
{
 for (var x = 0; x < cntrl.length; x++) 
	  if(cntrl[x].checked)
  		return true;
 alert(msg);
 return false;
}

function isBlank(str)
{
	if(str.trim() == "")
		return true;
	else
		return false;
}
String.prototype.trim = function() 
{
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};

function isValidEmail(cntrl, msg)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}
function splitString(cntrl,msg)
{
	alert(cntrl.value);
var fileName=cntrl.value;
var nameArray=fileName.split(".");
if(!nameArray[1]== "gif")
{
	alert(msg);
	cntrl.focus();
	return false;
}
else
{
	return true;
}
}
function isValidZipcode(cntrl,msg)
{
	  var re = /^\d{5}([\-]\d{4})?$/;
	  if(!re.test(cntrl.value))
	  {
		  alert(msg);
		cntrl.focus();
		return false;
	  }
		else
			return true; 
}

function isValidPassword(cntrl, msg)
{
	/*
	var filter  = /^\w{6,}$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
	*/
	if(cntrl.value.length < 6)
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidDate(cntrl, msg)
{
	var filter  = /^\d{1,2}(\/)\d{1,2}\1\d{2,4}$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidTime(cntrl, msg)
{
	var filter  = /^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9] [aApP][mM]){1}$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidDay(cntrl, msg)
{
	var filter  = /^(([1-9])|([12][0-9])|(3[01]))$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidUrl(cntrl, msg)
{
	var filter  = /^http:/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidInt(cntrl, msg)
{
	var filter  = /^\d{1,}$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}

function isValidDouble(cntrl, msg)
{
	var filter  = /^\d{1,}(\.\d{1,})?$/;
	if(!filter.test(cntrl.value))
	{
		alert(msg);
		cntrl.focus();
		return false;
	}
	else
		return true;
}