function isspecialspace_empty_email(a,b)
{
	var c=a.replace(/^[\s]+/g,"");
	var iChars = "!#$%^&*()+=-[]\\\';,/{}|\":<>? ";

  for (var i = 0; i < a.length; i++) {
  	if (iChars.indexOf(a.charAt(i)) != -1) {
  	alert ("Your " + b + " has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
  	return true;
  	}
  }
	if ((a=="") || (c=="")) {
		alert("Please fill in " + b);
		return true;
	}

}

function isspecialspace_empty(a,b) {
	var c=a.replace(/^[\s]+/g,"");
	var iChars = ".!@#$%^&*()+=-[]\\\';,/{}|\":<>? ";

  for (var i = 0; i < a.length; i++) {
  	if (iChars.indexOf(a.charAt(i)) != -1) {
  	alert ("Your " + b + " has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
  	return true;
  	}
  }
	if ((a=="") || (c=="")) {
		alert("Please fill in " + b);
		return true;
	}
}

function isspecialempty(a,b) {
	var c=a.replace(/^[\s]+/g,"");
	var iChars = ".!@#$%^&*()+=-[]\\\';,/{}|\":<>?";

  for (var i = 0; i < a.length; i++) {
  	if (iChars.indexOf(a.charAt(i)) != -1) {
  	alert ("Your " + b + " has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return true;
  	}
  }
	if ((a=="") || (c=="")) {
		alert("Please fill in " + b);
		return true;
	}
}

function isnumbers(a,b){
	var iChars = "1234567890";

  for (var i = 0; i < a.length; i++) {
  	if (iChars.indexOf(a.charAt(i)) != -1) {
  	alert ("Your " + b + " has numbers. \nThese are not allowed.\n Please remove them and try again.");
  	return true;
  	}
  }
}

function ischar(a,b){
	var iChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

  for (var i = 0; i < a.length; i++) {
  	if (iChars.indexOf(a.charAt(i)) != -1) {
  	alert ("Your " + b + " has Characters. \nThese are not allowed.\n Please remove them and try again.");
  	return true;
  	}
  }
}

function isempty(a,b) {
	var c=a.replace(/^[\s]+/g,"");

	if ((a=="") || (c=="")) {
		alert("Please fill in " + b);
		return true;
	}
}

function isempty1(a) {
	var c=a.replace(/^[\s]+/g,"");

	if ((a=="") || (c=="")) {
		return true;
	}
}

function isnumeric(tr1,tr2) {
if (tr1.length > 0){
if (isNaN(tr1)) {
alert("pls enter a valid " + tr2);
return false;
}
else
{
return true;
}
}
else
{
return true;
}
}

function emailchk(a,b) {

var email=a;
var findat=email.indexOf("@",0);
if(findat<0)
{
alert("Invalid Email ID");
b.focus();
return(false);
} 
var finddot=email.indexOf(".",findat+2)
if(finddot<0) 
{
alert("Invalid Email ID");
b.focus();
return(false);
}
}

function isLeapYear (Year) { 

	if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) { 
		return (true);
	} else 
	{ return (false) 
	}
}


function checkDate(objName,myValue){

	var mNames = "JanFebMarAprMayJunJulAugSepOctNovDec"
	var mValues = "312831303130313130313031"
	var alertMsg = ""
	var forFocus = "document.form1."+objName+".focus()"
	var wrongDate = true
	var args = checkDate.arguments

	objName = args[0]		
	myValue = args[1]		

	if (myValue.length<10){
		alert("Please enter in full date format \n dd-mm-yyyy!")
		eval(forFocus)
		return false
	}
 
	if ( (myValue.substring(2,3) != "-" ) || (myValue.substring(5,6) != "-") ) {
		alert("Please enter in this format \n dd-mm-yyyy!")
		eval(forFocus)
		return false
	}

	myDD   	= parseInt(myValue.substring(0,2),10)		
	myMM   	= parseInt(myValue.substring(3,5),10)  		
	myYYYY	= parseInt(myValue.substring(6,10),10)		
	
	if (myYYYY < 1000){
		alert("year should be greater than 1000")
		eval(forFocus)
		return false
	}
	
	if ( (isNaN(myDD)) || (isNaN(myMM)) || ( isNaN(myYYYY)) ){
		alert("invalid date entered!")
		eval(forFocus)
		return false
	}

	if ( (myMM > 12) || (myMM <= 0) ){
		alert("wrong month entered")
		eval(forFocus)
		return false
	}

	var lastDate = 0

	if (myMM == 2){
		if (isLeapYear(myYYYY)) {
			lastDate = 29
		}
		else{
			lastDate = 28
		}
	} 
	else {
		lastDate = mValues.substring((myMM-1)*2, (myMM-1)*2+2)
	}

	if ( (myDD > lastDate) || (myDD <=0) ){
		alert("wrong date entered!")
		eval(forFocus)
		return false
	}

	var newValue = ""
	if (myDD<10){
		myDD = "0"+myDD
	}
	if (myMM<10){
		myMM = "0"+myMM
	}

	newValue = myDD+"-"+myMM+"-"+myYYYY
	var forValue = "document.form1."+objName+".value= newValue"
	eval(forValue) 
	return true

}

function chkcall(objName,myValue) {

if (myValue!="") {
return checkDate(objName,myValue);
}
else
{
return true;
}
}
