// Confirm Password.
function confirmpass(obj1, obj2, str){
	if(obj1.value != obj2.value){
		obj2.value=""
		selfocobj(obj1, str)
		return false;	
	}
	return true
}

// checks whether string is numeric or not.
function isNumeric(obj,s){
	if(isEmpty(obj.value) | isNaN(obj.value)){
			selfocobj(obj, s)
			return false;
		}
	return true;
}

// checks whether string is Date or not.
function isDate(obj,s){
	if(isEmpty(obj.value)){
		selfocobj(obj, s)
		return false;
	}
	var re_date = /^(\d+)\-(\d+)\-(\d+)$/;
	if (!re_date.exec(obj.value)){
		selfocobj(obj, s)
		return false;
	}
	return true;
}
// checks whether string is Date or not.
function isDateTime(obj,s){
	if(isEmpty(obj.value)){
		selfocobj(obj, s)
		return false;
	}
	var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
	if (!re_date.exec(obj.value)){
		selfocobj(obj, s)
		return false;
	}
	return true;
}

// checks whether string is empty or not
function isRequired(obj, s){
	if(isEmpty(obj.value)){
		selfocobj(obj, s)
		return false;
	}
	return true;
}

//Select and focus on object.
function selfocobj(obj, str){
		alert(str);
		obj.select();
		obj.focus();
}


// Check whether string s is empty.
function isEmpty(s)
{  
	return ((s == null) || (s.length == 0)||s.charAt(0) == ' ')
}

// isEmail (STRING s [, BOOLEAN emptyOK])

function isEmail (obj, s) {   
	var reEmail = /^.+\@.+\..+$/
	if (isEmpty(obj.value) || !reEmail.test(obj.value)) {
	    selfocobj(obj, s)
		return false;
	  }
	return true;
}

