// menu image swap routine starts

if (document.images) {
  var imgOn = Array();
  imgOn[1] = newImage('images/menu-home-on.gif');
  imgOn[2] = newImage('images/menu-location-on.gif');
  imgOn[3] = newImage('images/menu-rooms-on.gif');
  imgOn[4] = newImage('images/menu-facilities-on.gif');
  imgOn[5] = newImage('images/menu-gallery-on.gif');
  imgOn[6] = newImage('images/menu-tariff-on.gif');
  imgOn[7] = newImage('images/menu-res-on.gif');
  imgOn[8] = newImage('images/menu-contact-on.gif');
  imgOn[9] = newImage('images/menu-host-on.gif');
  imgOn[10] = newImage('images/menu-attraction-on.gif');
  imgOn[11] = newImage('images/menu-selfcatering-on.gif');
  
  var imgOff = Array();
  imgOff[1] = newImage('images/menu-home.gif');
  imgOff[2] = newImage('images/menu-location.gif');
  imgOff[3] = newImage('images/menu-rooms.gif');
  imgOff[4] = newImage('images/menu-facilities.gif');
  imgOff[5] = newImage('images/menu-gallery.gif');
  imgOff[6] = newImage('images/menu-tariff.gif');
  imgOff[7] = newImage('images/menu-res.gif');
  imgOff[8] = newImage('images/menu-contact.gif');
  imgOff[9] = newImage('images/menu-host.gif');
  imgOff[10] = newImage('images/menu-attraction.gif');
  imgOff[11] = newImage('images/menu-selfcatering.gif');
    
}

function newImage(arg) {
	if (document.images) {
		r = new Image();r.src = arg;return r;
	}
}


function butOn(arg) {
  o = document.getElementById('b' + arg);o.src = imgOn[arg].src;
}


function butOff(arg) {
  o = document.getElementById('b' + arg);o.src = imgOff[arg].src;
}

// image swap routines ends




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.realname.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.realname.focus();
		return (false);
	}
	
	// buddy must have a address
	t = theForm.address.value.toLowerCase();
	if( t == "" || t.length < 3 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Address.");
		theForm.address.focus();
		return (false);
	}
	
	// buddy must have a country
	t = theForm.country.value.toLowerCase();
	if( t == "" || t.length < 3 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Country Name.");
		theForm.country.focus();
		return (false);
	}
	
	// buddy must have a phone no.
	t = theForm.country_code.value.toLowerCase();
	if( t == "" || t.length < 1 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Country Code.");
		theForm.country_code.focus();
		return (false);
	}
	
	// buddy must have a phone no.
	t = theForm.area_code.value.toLowerCase();
	if( t == "" || t.length < 1 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Area Code.");
		theForm.area_code.focus();
		return (false);
	}
	
	// buddy must have a phone no.
	t = theForm.telephone.value.toLowerCase();
	if( t == "" || t.length < 3 || t.indexOf("abc") >= 0 || t.indexOf("xyz") >= 0 || t.indexOf("fuck") >= 0 ){
		alert("Please enter your Phone No.");
		theForm.telephone.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);
	}
	
	
	// room type
	t = theForm.room_type.value.toLowerCase();
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please Select your Room Type.");
		theForm.room_type.focus();
		return (false);
	}
	
	// No of Rooms
	t = theForm.no_of_rooms.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter the number of Rooms.");
		theForm.no_of_rooms.focus();
		return (false);
	}

	t = theForm.period_of_stay.value;
	if( t == "" || parseFloat(t) <= 0 ){
		alert("Please enter the number of days you intend to stay with us.");
		theForm.period_of_stay.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;
}
