function isEmpty(inputStr) {
	if ((inputStr == null) || (inputStr=="")) return true
	else return false
}

function isSpace(str) {
	pattern = /^[\s]+$/
        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 isLetters(str) {
	pattern = /^[a-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;
}

function isName(str) {
	pattern = /^[a-zA-Z\s\-\.\']+$/
		if (!str.match(pattern)) 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 isUrl(str) {
     pattern = /^[a-zA-Z\s\:\.\/]+$/
        if (str.match(pattern)) return true
           else return false;
}

//Telephone
function isTelephone(str) {
	pattern =/^[0-9a-zA-Z\s\-\/\,\(\)\+\.\:]+$/
		if (!str.match(pattern)) return false
			else return true;
}

//Fax
function isFax(str) {
	pattern =/^[0-9a-zA-Z\s\-\/\(\)\+\.]+$/
		if (!str.match(pattern)) return false
			else return true;
}

//SMS No
function isSmsNo(str) {
	pattern =/^[0-9\+]+$/
		if (!str.match(pattern)) return false
			else return true;
}

//Zip code, postal code, Organization, Company
	//all cractors allowed

function isCountry(str) {
	pattern =/^[a-zA-Z\s\-\.\']+$/
		if (!str.match(pattern)) return false
			else return true;
}

//city, state, province, region
function isCity(str) {
	pattern = /^[0-9a-zA-Z\s\-\.\']+$/
		if (!str.match(pattern)) 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;
}

//post applied for
function isPostApp(str) {
	pattern = /^[0-9a-zA-Z\s\-\/\.\:\?\!\;\,\"\(\)\']+$/
		if (!str.match(pattern)) return false
			else return true;
}

//Date
function isSortDate(str) {
	pattern = /^[0-9\/\s]+$/
		if (!str.match(pattern)) return false
			else return true;
}

function isUName(str) {
	pattern = /^[a-zA-Z0-9_\s]+$/
		if (!str.match(pattern)) return false
			else return true;
}


function isValidPwd(str) {
	if (str.lastIndexOf(" ") == -1) {
				return true;
	} else {
				return false;
	}
}

function isDecNumber(str, len) {
	//pattern=/^[0-9]+[\.]{0,1}[0-9]{0,2}$/
	pattern=/^[0-9\,]+[\.]{0,1}[0-9]{0,9}$/
	if (((str.indexOf("."))!=-1) && (str.indexOf(".") > 10)){
			return false
		}
	else if (((str.indexOf("."))==-1) && (str.length > 10)) {
	return false;
	}
	else return(str.match(pattern));
}
function isDecNumberB(str, len) {
	//pattern=/^[0-9]+[\.]{0,1}[0-9]{0,2}$/
	pattern=/^[0-9\,]+[\.]{0,1}[0-9]{0,9}$/
	if (((str.indexOf("."))!=-1) && (str.indexOf(".") > 10)){
			return false
		}
	else if (((str.indexOf("."))==-1) && (str.length > 20)) {
	return false;
	}
	else return(str.match(pattern));
}
//===================== 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 =============================

////////////////////////////