function get_monthstr(month_num){
	var month_num2 = parseInt(month_num,10);
	
	var month_array =  new Array();
	month_array[1] = "January";
	month_array[2] = "February";
	month_array[3] = "March";
	month_array[4] = "April";
	month_array[5] = "May";
	month_array[6] = "June";
	month_array[7] = "July";
	month_array[8] = "August";
	month_array[9] = "September";
	month_array[10] = "October";
	month_array[11] = "November";
	month_array[12] = "December";
	
	return month_array[month_num2];
} // end get_monthstr

function isPosInteger(inputVal){
	var inputNum = Number(inputVal);
	var isNumber = Boolean(inputNum);
	
	if (! isNumber){
		return false;
	}
	else if(inputNum > 0 && parseInt(inputNum) == inputNum){
		return true;
	}
	else{
		return false;
	}

} //end isPosInteger


/*
// internal function used to initial 'focus' method in date_validate class
function getFocusDateField(){
	var datePart = this.date_keys[this.focus_element];
	datePart.focus();
} //end getFocusedDateField()

function myGetDateObj(){
	return this.thedate;
}
*/

// **** Class 'Date_Validate'
function DateValidate(date_value, dspDateTypeStr){
	//var datere = /[0-9]{1,2}\/[0-9]{1,2}\/[1-2][0-9]{3}/;
	var date_value = date_value.replace(/ /g, '');
	//var mA = datere.exec(date_value);
	
	this.error = false;
	this.error_msg = "";
	
	
	/*
	if(! mA || mA.index != 0 || datere.lastIndex != date_value.length){
		this.error = true;
		var nowDate = new Date();
		var nowM = nowDate.getMonth() + 1;
		
		var dateStrEx =  nowM + "/" + nowDate.getDate() + "/" + nowDate.getFullYear();
		 
		
		this.error_msg = "Please enter a proper date format. For example: " + dateStrEx;
		return;
	}
	*/
	var regex = / /g;
	
	
	if (date_value.split("/").length != 3){
		this.error = true;
		var nowDate = new Date();
		var nowM = nowDate.getMonth() + 1;
		
		var dateStrEx =  nowM + "/" + nowDate.getDate() + "/" + nowDate.getFullYear();
		 
		
		this.error_msg = "Please enter a proper date format. For example: " + dateStrEx;
		return;
	} //end if
	
	var month_value = date_value.split("/")[0];
	var day_value = date_value.split("/")[1];
	var year_value = date_value.split("/")[2];
	
	var month_str = get_monthstr(month_value);
	var date_str = month_str + ' ' + day_value + ', ' + year_value;
	
	thedate = new Date(date_str);
	
	
	
	
	
	
	this.thedate = thedate;
	thedate_month = thedate.getMonth() + 1;
		
	
	
	
	//this.focus = getFocusDateField;
	
	
	
	// ****** Date Fields ******
	
	if( !isPosInteger(month_value) || parseInt(month_value) > 12 || month_value == 0 ){
		this.error = true;
		this.error_msg =  "Please enter a positive number from 1 to 12 for the month";
	}
	
	else if( !isPosInteger(day_value) || parseInt(day_value) > 31 || day_value == 0 ){
		this.error = true;
		this.error_msg = "Please enter a positive number from 1 to 31 for the day";
	}
	
	else if( !isPosInteger(year_value) || parseInt(year_value) < 1901 ){
		this.error = true;
		this.error_msg = "Please enter a positive number for a year and greater than at least '1900 AD'";
	}
	else if( ( day_value.replace(regex,'') != '' &&  year_value.replace(regex,'') != '') && parseInt(month_value,10) != thedate_month){
		this.error = true;
		this.error_msg = "Please check the number of days you entered for the month and year entered.\nThere are less days than: " + day_value + " in the month of " + month_str + " for the year " + year_value;
	}
	// ****** END DATE FIELDS *****

	

} //end Date_Validate()



// method "focus" initialized
//Date_Validate.prototype.focus = getFocusDateField;

//Date_Validate.prototype.getDateObj = myGetDateObj;






