
var months = new Array();
i = 0;
months[i] = 'January'; i++;
months[i] = 'February'; i++;
months[i] = 'March'; i++;
months[i] = 'April'; i++;
months[i] = 'May'; i++;
months[i] = 'June'; i++;
months[i] = 'July'; i++;
months[i] = 'August'; i++;
months[i] = 'September'; i++;
months[i] = 'October'; i++;
months[i] = 'November'; i++;
months[i] = 'December';

function printMonth(){
	var now = new Date();
	var current = now.getMonth();
	document.write('<select class="f" name="month">');
	for(i=0; i < months.length; i++) {
		txt = '<option value="' + months[i] + '"';
		if (i == current) {
			txt = txt + ' selected';
		}
		txt = txt + '>' + months[i] + '</option>';
		document.write(txt);
	}
	document.write('</select>');
}	

function printDay() {
	var now = new Date();
	var current = now.getDate();
	document.write('<select class="f" name="day">');
	for(i=1; i <= 31; i++) {
		txt = '<option value="' + i + '"';
		if (i == current) {
			txt = txt + ' selected';
		}
		txt = txt + '>' + i + '</option>';
		document.write(txt);
	}
	document.write('</select>');
}

function printYear() {
	var now = new Date();
	var current = now.getFullYear();
	document.write('<select class="f" name="year">');
	for(i=0; i < 6; i++) {
		txt = '<option value="' + (current+i) + '"';
		if (i == 0) {
			txt = txt + ' selected';
		}
		txt = txt + '>' + (current+i) + '</option>';
		document.write(txt);
	}
	document.write('</select>');
}

function frmValid(theForm) {
	// buddy must have a name
	t = theForm.name.value.toLowerCase();
	if( t == "" || t.length < 3 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Name.");
		theForm.name.focus();
		return (false);
	}

	// check e-mail
	t = theForm.email.value;
	if( t == "your@company.com" || t == "" || t.indexOf("@") == -1 || t.indexOf(".") == -1 || t.indexOf(" ")!=-1 || t.length < 6 || t.indexOf("xyz.com") > 0 || t.indexOf("abc.com") > 0 || t.indexOf("jagatniwaspalace.com") > 0 ) {
		alert("Your Email seems to be invalid!");
		theForm.email.focus();
		return (false);
	}

	// staydays
	t = theForm.staydays.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter your period of stay.");
		theForm.staydays.focus();
		return (false);
	}

	// adults
	t = theForm.adult.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter the number of persons.");
		theForm.adult.focus();
		return (false);
	}
	
	// rooms
	t = theForm.rooms.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter the number of rooms.");
		theForm.rooms.focus();
		return (false);
	}
	
	// message
	t = theForm.message.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter your Message.");
		theForm.message.focus();
		return (false);
	}
	
	// all's well ends well
	return true;
}

