function submitFormRT() {
	if (!verify()) { return; }
	document.frmSer.action = "http://hotels.oceancity.com/site_hotel_search.jsp";
	document.frmSer.submit();
}

function verify() {
	var myVar;
	if (!checkDate(document.frmSer.optDay.value, document.frmSer.optMon.value, document.frmSer.optYr.value)) {
		alert("Invalid date!");
		return(false);
	}
	if (!checkReserDate(document.frmSer.optDay.value, document.frmSer.optMon.value, document.frmSer.optYr.value)) {
		alert("Date must be in the future!");
		return(false);
	}
	myVar = document.frmSer.txtNN.value;
	if ((myVar == "") || (myVar <= 0) || (!isDigit(myVar))) {
		alert("Please enter Number of Nights!");
		document.frmSer.txtNN.focus();
		return(false);
	}		
	myVar = document.frmSer.txtNOR.value;
	if ((myVar == "") || (myVar <= 0) || (!isDigit(myVar))) {
		alert("Please enter Number of Rooms!");
		document.frmSer.txtNOR.focus();
		return(false);
	}
	myVar = document.frmSer.txtPer.value;
	if ((myVar == "") || (myVar <= 0) || (!isDigit(myVar))) {
		alert("Please enter Number of People!");
		document.frmSer.txtPer.focus();
		return(false);
	}
	return true;
}

function checkDate(day, month, year) {
	var leapyear;
	if (year % 4 == 0) { leapyear = true; }
	if (!leapyear && month == 2 && day > 28) { return(false); }
	if (leapyear && month == 2 && day > 29) { return(false); }
	if (month == 4 || month == 6 || month == 9 || month == 11) { if (day > 30) { return(false); } }
	return(true);
}

function checkReserDate(day, month, year) {
	var now = new Date();
	var today, todayd, todaym, todayy, reser;
	todayd = now.getDate();
	todaym = now.getMonth()+1;
	todayy = now.getYear();
	if (todaym < 10 && todayd < 10) { today = todayy + "0" + todaym + "0" + todayd; }
	if (todaym < 10 && todayd >= 10) { today = todayy + "0" + todaym + "" + todayd; }
	if (todaym >= 10 && todayd < 10) { today = todayy + "" + todaym + "0" + todayd; }
	if (todaym >= 10 && todayd >= 10) { today = todayy + "" + todaym + todayd; }
	if (month < 10 && day < 10) { reser = year + "0" + month + "0" + day; }
	if (month < 10 && day >= 10) { reser = year + "0" + month + "" + day; }
	if (month >= 10 && day < 10) { reser = year + "" + month + "0" + "" + day; }
	if (month >= 10 && day >= 10) { reser = year + month + day; }
	if (reser < today) { return(false); }
	return(true);
}

function isDigit(str) {
	var numArray = new Array("1","2","3","4","5","6","7","8","9","0");
	var ch;
	for (var i=0; i<str.length; i++ ) {
		var myResult = false;
		ch = str.substring(i,i+1);
		for (var j in numArray) {
			if (ch == numArray[j]) {
				myResult = true;
				break;
			}
			if (j == numArray.length) {
				break;
			}
		}
		if(!myResult) { break; }
	}
	return(myResult);
}

