function isEmpty(inputStr) {
//general purpose function to check if an input value has been enterd 
//at all
	if ((inputStr == null) || (inputStr=="")) return true
	else return false
}

function isSpace(str) {
	pattern = /^[\s]+$/
        if (str.match(pattern)) return true
           else return false;
}
function isUrl(str) {
     pattern = /^[a-zA-Z\s\:\.\/]+$/
        if (str.match(pattern)) return true
           else return false;
}

function isName(str) {

	npattern = /^[a-zA-Z\s\-\.\']+$/
	if (!str.match(npattern)) return false
	else return true;
}

function isCompany(str) {
	npattern = /^[a-zA-Z\s\-\.\&\(\)\']+$/
	if (!str.match(npattern)) return false
	else return true;
}

function isEmail(str) {
     pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/
        if (str.match(pattern)) return true
           else return false;
}

function isNumber(str) {
	pattern= /^[0-9]+$/
	if (!str.match(pattern)) return false
	else return true;
}

function isValidTime(str) {
	if ( str > 12 ) return false
	else return true;
}

function isValidPwd(str) {
	if (str.lastIndexOf(" ") == -1) {
				return true;
	} else {
				return false;
	}
}

function isCity(str) {
	cpattern = /^[0-9a-zA-Z\s\-\.\']+$/
	if (!str.match(cpattern)) return false
	else return true;
}

function isZip(str) {
	cpattern = /^[a-zA-Z0-9\-\s]+$/
	if (!str.match(cpattern)) return false
	else return true;
}

function isTelephone(str) {
	cpattern =/^[0-9a-zA-Z\s\-\/\,\(\)\+\.\:]+$/
	if (!str.match(cpattern)) return false
	else return true;
}

function isCountry(str) {
	cpattern =/^[a-zA-Z\s\-\.\']+$/
	if (!str.match(cpattern)) return false
	else return true;
}

//Designation, Position, occupation
function isDesignation(str) {
	pattern = /^[0-9a-zA-Z\s\-\/\.\,\"\(\)\']+$/
		if (!str.match(pattern)) return false
			else return true;
}

//Registration
function isRegistration(str) {
	pattern = /^[0-9a-zA-Z\s\-\/]+$/
		if (!str.match(pattern)) return false
			else return true;
}

//Registration
function isMileage(str) {
	pattern = /^[0-9a-zA-Z\s\,]+$/
		if (!str.match(pattern)) return false
			else return true;
}

//numbers and letters
function isAlphaNu(str) {
	pattern = /^[a-zA-Z0-9\s]+$/
		if (!str.match(pattern)) return false
			else return true;
}
//===================== Start of Date validation =============================
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
currDate = new Date();
var d = currDate.getDate();
var m = currDate.getMonth()+1;
var y = currDate.getFullYear();
monthNames = new Array();
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

monthMax= new Array(31,31,29,31,30,31,30,31,31,30,31,30,31);

function findMonthIndex(str) {
if (str=="January") return 1
else if (str=="February") return 2
else if (str=="March") return 3
else if (str=="April") return 4
else if (str=="May") return 5
else if (str=="June") return 6
else if (str=="July") return 7
else if (str=="August") return 8
else if (str=="September") return 9
else if (str=="October") return 10
else if (str=="November") return 11
else if (str=="December") return 12
else return m;

}

// date validation part
function inRange (inputStr, lo, hi) {
	var num = parseInt(inputStr, 10)
	if (num<lo || num>hi) {
		return false
	}
	return true
}

function inRangeSameMonth (inputStr, lo, hi) {
	var num = parseInt(inputStr, 10)
	if (num>lo || num>hi) {
		return false
	}
	return true
}
//===================== End of Date validation =============================

////////////////////////////