// JavaScript Document

//Month Array
var month_arr_key = new Array('Jan_2012','Feb_2012','Mar_2012','Apr_2012','Sep_2012','Oct_2012','Nov_2012','Dec_2012');
var month_arr_val = new Array('January 2012','February 2012','March 2012','April 2012','September 2012','October 2012','November 2012','December 2012');

function showMonthCombo(val)
{
	var combo = document.getElementById("monthcombo");
	combo.length = 0;
	
	if(val==99)
	{
		return true;
	}
	
	var monkeyarr = eval(val+'_mon_key');
	var monvalarr = eval(val+'_mon_val');
	
	//alert(monkeyarr);
	
	var option = document.createElement("option");
	option.text = 'Select date of Travel';
	option.value = '99';
	try {
		combo.add(option, null); //Standard
	}catch(error) {
		combo.add(option); // IE only
	}

	for(i=0;i < monkeyarr.length;i++)
	{
		var option = document.createElement("option");
		option.text = monvalarr[i];
		option.value = monkeyarr[i];
		try {
			combo.add(option, null); //Standard
		}catch(error) {
			combo.add(option); // IE only
		}
	}

}

function selectDate(date)
{
	var combo = document.getElementById("monthcombo");
	if(date!='') combo.value = date;
}

function showMonthData(mon)
{
	if(mon=='')
	{
		document.getElementById('monthData').innerHTML = '';
		document.getElementById('monthData_static').style.display = 'block';		
	}
	else
	{
		document.getElementById('monthData_static').style.display = 'none';
		var mondata = eval(mon+'_data');
		var monstr = schdule_top + mondata + schdule_bot;
		document.getElementById('monthData').innerHTML = monstr;
	}
}

function checkQuickForm()
{
	if(document.frm.trainValue.value=='99')
	{
		alert('Please select Journey');
		return false;
	}
	if(document.frm.date.value == '99')
	{
		alert('Please select Departure date');
		return false;
	}
	
	if(document.frm.Adults.value==0)
	{
		alert("Please choose no of Adults");
		document.frm.Adults.focus()
		return false;
	}
	
	return true;
}

function showQuickForm(val)
{
	document.write('<div class="tour_form_back"><div class="form_heading">Book Your Journey</div><form onSubmit="return checkQuickForm()" name="frm" action="booking.php" method="post"><table width="200" border="0" cellpadding="4" cellspacing="0" style="margin:10px 0 0 0"><tr><td class="tr_name">Journey:</td><td colspan="2"><div><select name="desti" id="desticombo" class="tr_select select" onChange="showMonthCombo(this.value)"><option value="99">Select</option><option value="PI">Princely India</option><option value="RI">Royal India</option><option value="CI">Clasical India</option><option value="RS">Royal Sojourn</option></select></div></td></tr><tr><td class="tr_name">Date:</td><td  colspan="2"><div><select name="date_month" id="monthcombo" class="tr_select select"><option value="99">Select</option></select></div></td></tr><tr><td colspan="3" align="right"><input name="submit" type="image" src="images/getquote.png" /></td></tr></table></form></div>');
	if (typeof val != "undefined") {
    	document.getElementById('desticombo').value = val;
		showMonthCombo(val);
  	}
}

function departForm(des, mon)
{
	document.hiddendepartfrm.desti.value=des;
	document.hiddendepartfrm.date_month.value=mon;
	document.hiddendepartfrm.submit();
}

function setMonthData()
{
	combo = document.getElementById('monselecter');
	for(i=0; i<month_arr_key.length; i++) { 
	   setCombo(combo, month_arr_val[i], month_arr_key[i]);
	}
}

function setCombo(combo, txt, val)
{
	var option = document.createElement("option");
	option.text = txt;
	option.value = val;
	try {
		combo.add(option, null); //Standard
	}catch(error) {
		combo.add(option); // IE only
	}
}


