﻿var days = new Array();
days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";

var mon = new Array();
mon[0] = "Jan";
mon[1] = "Feb";
mon[2] = "Mar";
mon[3] = "Apr";
mon[4] = "May";
mon[5] = "Jun";
mon[6] = "Jul";
mon[7] = "Aug";
mon[8] = "Sep";
mon[9] = "Oct";
mon[10] = "Nov";
mon[11] = "Dec";

function createDropdownDate(b,e,s)
{
	if (s==0)
	{
		now = new Date();
		s = now.getDate();
	}
	for (i=b; i<=e; i++)
	{
		if (i==s)
			document.write('<option value="'+i+'" selected="selected">'+i+'</option>');
		else
			document.write('<option value="'+i+'">'+i+'</option>');
	}
}

function createtheatredates()
{
	f=document.form;
	now = new Date();
	d = now.getDate();
	m = now.getMonth();
	y = now.getFullYear();

	for (i=y; i<=(y+1); i++)
	{
		for (j=1; j<=12; j++)
		{
		    for (x=1;x<=31;x++)
		    {
			if (x<10) x="0"+x;
			if (i==y)
			{
				if ((j-1)>m)
				{
					len = f['showdate'].length++;
					f['showdate'].options[len].text = x+" "+month[j-1]+" "+i;					
					if (j<10) sj="0"+j;
					else sj=j;
					f['showdate'].options[len].value = x+"/"+i+"Z"+sj;
				}
				else if ((j-1)==m)
				{
					if (x>=d)
					{
						len = f['showdate'].length++;
						f['showdate'].options[len].text = x+" "+month[j-1]+" "+i;
						if (j<10) sj="0"+j;
						else sj=j;
						f['showdate'].options[len].value = x+"/"+i+"Z"+sj;
					}
				}
			}
			else
			{
				len = f['showdate'].length++;
				f['showdate'].options[len].text = x+" "+month[j-1]+" "+i;
				if (j<10) sj="0"+j;
				else sj=j;
				f['showdate'].options[len].value = x+"/"+i+"Z"+sj;
			}
			if ((j==3 || j==5 || j==7 || j==9) && x==30) break;
			else if (j==1 && x==29) break;
                  }
	      }
	}
}

function createtheatredates2()
{
	f=document.form3;
	now = new Date();
	d = now.getDate();
	m = now.getMonth();
	y = now.getFullYear();

	for (i=y; i<=(y+1); i++)
	{
		for (j=1; j<=12; j++)
		{
		    for (x=1;x<=31;x++)
		    {
			if (x<10) x="0"+x;
			if (i==y)
			{
				if ((j-1)>m)
				{
					len = f['qdate'].length++;
					f['qdate'].options[len].text = x+" "+month[j-1]+" "+i;					
					if (j<10) sj="0"+j;
					else sj=j;
					f['qdate'].options[len].value = i+"Z"+sj+"#"+x;
				}
				else if ((j-1)==m)
				{
					if (x>=d)
					{
						len = f['qdate'].length++;
						f['qdate'].options[len].text = x+" "+month[j-1]+" "+i;
						if (j<10) sj="0"+j;
						else sj=j;
						f['qdate'].options[len].value = i+"Z"+sj+"#"+x;

					}
				}
			}
			else
			{
				len = f['qdate'].length++;
				f['qdate'].options[len].text = x+" "+month[j-1]+" "+i;
				if (j<10) sj="0"+j;
				else sj=j;
				f['qdate'].options[len].value = i+"Z"+sj+"#"+x;

			}
			if ((j==3 || j==5 || j==7 || j==9) && x==30) break;
			else if (j==1 && x==29) break;
                  }
	      }
	}
}

function setYears(type, sel, abbr)
{
	f=document.form;
	now = new Date();
	m = now.getMonth();
	y = now.getFullYear();

	for (i=y; i<=(y+1); i++)
	{
		for (j=0; j<=11; j++)
		{
			if (i==y)
			{
				if (j>=m)
				{
					len = f[type].length++;
					f[type].options[len].value = j+"|"+i;
					if (abbr==1)
						f[type].options[len].text = mon[j]+" "+i.toString().substring(2);
					else
						f[type].options[len].text = month[j]+" "+i;
				}
			}
			else
			{
				len = f[type].length++;
				f[type].options[len].value = j+"|"+i;
				if (abbr==1)
					f[type].options[len].text = mon[j]+" "+i.toString().substring(2);
				else
					f[type].options[len].text = month[j]+" "+i;
			}
		}
	}
	if (sel!='')
		setDropdown(sel, type);
}

function setYears2(type, sel, abbr)
{
	f=document.form2;
	now = new Date();
	m = now.getMonth();
	y = now.getFullYear();

	for (i=y; i<=(y+1); i++)
	{
		for (j=0; j<=11; j++)
		{
			if (i==y)
			{
				if (j>=m)
				{
					len = f[type].length++;
					f[type].options[len].value = j+"|"+i;
					if (abbr==1)
						f[type].options[len].text = mon[j]+" "+i.toString().substring(2);
					else
						f[type].options[len].text = month[j]+" "+i;
				}
			}
			else
			{
				len = f[type].length++;
				f[type].options[len].value = j+"|"+i;
				if (abbr==1)
					f[type].options[len].text = mon[j]+" "+i.toString().substring(2);
				else
					f[type].options[len].text = month[j]+" "+i;
			}
		}
	}
	if (sel!='')
		setDropdown2(sel, type);
}

function setSunday(t)
{
	dateset = readCookieDates(t);
	if (dateset==0)
	{
		f = document.form;
		now = new Date();
		today = now.getDay();
		smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
		if (today==0)
			n = 7;
		else
			n = 7 - today;

		now.setTime(now.getTime() + n * 24 * 60 * 60 * 1000);
		f.arrivedate.selectedIndex = now.getDate();
		if (now.getMonth()==0 && smonth==11)
		  smonth=-1;
		f.arrivedate2.selectedIndex = f.arrivedate2.selectedIndex + (now.getMonth() - smonth);
		setEndDate(1);
	}
}

function setSunday2(t)
{
		f = document.form2;
		now = new Date();
		today = now.getDay();
		smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
		if (today==0)
			n = 7;
		else
			n = 7 - today;

		now.setTime(now.getTime() + n * 24 * 60 * 60 * 1000);
		f.arrivedate.selectedIndex = now.getDate();
		if (now.getMonth()==0 && smonth==11)
		  smonth=-1;
		f.arrivedate2.selectedIndex = f.arrivedate2.selectedIndex + (now.getMonth() - smonth);
		setEndDate2(1);
}


function setEndDate(n)
{
	f = document.form;
	now = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	now.setYear(syear);
	now.setDate(1);
	now.setMonth(smonth);
	now.setDate(f.arrivedate.selectedIndex);

	checkdate = checkDate(now.getTime());

	now.setTime(now.getTime() + n * 24 * 60 * 60 * 1000);
	f.departdate.selectedIndex = now.getDate();
	if (now.getMonth() < smonth)
		f.departdate2.selectedIndex = f.arrivedate2.selectedIndex + ((now.getMonth() + 12) - smonth);
	else
		f.departdate2.selectedIndex = f.arrivedate2.selectedIndex + (now.getMonth() - smonth);

	setDayName('arrive',f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	setDayName('depart',f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);
}

function setEndDate2(n)
{
	f = document.form2;
	now = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	now.setYear(syear);
	now.setDate(1);
	now.setMonth(smonth);
	now.setDate(f.arrivedate.selectedIndex);

	checkdate = checkDate(now.getTime());

	now.setTime(now.getTime() + n * 24 * 60 * 60 * 1000);
	f.departdate.selectedIndex = now.getDate();
	if (now.getMonth() < smonth)
		f.departdate2.selectedIndex = f.arrivedate2.selectedIndex + ((now.getMonth() + 12) - smonth);
	else
		f.departdate2.selectedIndex = f.arrivedate2.selectedIndex + (now.getMonth() - smonth);

	setDayName2('arrive',f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	setDayName2('depart',f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);
}


function checkDate(d)
{
	thisdate = new Date();
	thisdate = new Date(thisdate.getYear(),thisdate.getMonth(),thisdate.getDate());
	checkdate = d - thisdate.getTime();
	return checkdate;
}

function setDropdown(date,field)
{
	f = document.form;
	for (i=0; i < f[field].options.length; i++)
	{
		check = f[field].options[i].value;
		if (date == check)
		{
			f.elements[field].selectedIndex = i;
			break;
		}
	}
}

function setDropdown2(date,field)
{
	f = document.form2;
	for (i=0; i < f[field].options.length; i++)
	{
		check = f[field].options[i].value;
		if (date == check)
		{
			f.elements[field].selectedIndex = i;
			break;
		}
	}
}


function validDate(d,m)
{
	valid = 0;
	cmonth = getMonthValue(m);
	cyear = getYearValue(m);

	if (cyear % 4 != 0)
	{
		if ((cmonth == 1)&&(d > 28))
			valid = 1;
		if (((cmonth == 3)||(cmonth == 5)||(cmonth == 8)||(cmonth == 10))&&(d > 30))
			valid = 1;
	}
	if (cyear % 4 == 0)
	{
		if ((cmonth == 1)&&(d > 29))
			valid = 1;
		if (((cmonth == 3)||(cmonth == 5)||(cmonth == 8)||(cmonth == 10))&&(d > 30))
			valid = 1;
	}
	return valid;
}

function getMonthValue(m)
{
	pos = m.indexOf("|");
	month = m.substring(0,pos);
	return month;
}

function getYearValue(y)
{
	pos = y.indexOf("|");
	year = y.substring(pos+1);
	return year;
}

function getTimeValue(d,m)
{
	now = new Date();
        now.setFullYear(2007);
        now.setMonth(0);
        now.setDate(1);
	month = getMonthValue(m);
	year = getYearValue(m);
	now.setFullYear(year);
	now.setMonth(month);
	now.setDate(d);
	return now.getTime();
}

function getDayName(d,m)
{
	now = new Date();
        now.setFullYear(2007);
        now.setMonth(0);
        now.setDate(1);
	year = getYearValue(m);
	month = getMonthValue(m);
	now.setFullYear(year);
	now.setMonth(month);
	now.setDate(d);
	return now.getDay();
}

function setNights()
{
	f = document.form;
	f.nights.length = 20;

	stime = getTimeValue(f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	etime = getTimeValue(f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);

	setDayName('arrive',f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	setDayName('depart',f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);

	dtime = (etime - stime) / (24 * 60 * 60 * 1000);

	if (dtime > 20)
	{
		for (i=21; i<=dtime; i++)
		{
			len = f.nights.length++;
			f.nights.options[len].value = i;
			f.nights.options[len].text = i;
		}
	}

	f.nights.selectedIndex = Math.ceil(dtime - 1);
	//f.nights.selectedIndex = dtime;
}

function setNights2()
{
	f = document.form2;
	f.nights.length = 20;

	stime = getTimeValue(f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	etime = getTimeValue(f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);

	setDayName2('arrive',f.arrivedate.selectedIndex,f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	setDayName2('depart',f.departdate.selectedIndex,f.departdate2.options[f.departdate2.selectedIndex].value);

	dtime = (etime - stime) / (24 * 60 * 60 * 1000);

	if (dtime > 20)
	{
		for (i=21; i<=dtime; i++)
		{
			len = f.nights.length++;
			f.nights.options[len].value = i;
			f.nights.options[len].text = i;
		}
	}

	f.nights.selectedIndex = Math.ceil(dtime - 1);
	//f.nights.selectedIndex = dtime;
}

function setDayName(t,d,m)
{
	f = document.form;
	f[t+'day'].value = days[getDayName(d,m)];
}

function setDayName2(t,d,m)
{
	f = document.form2;
	f[t+'day'].value = days[getDayName(d,m)];
}

function checkArrivalDate()
{
	f = document.form;
	//now = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	//now.setYear(syear);
	//now.setMonth(smonth);
	//now.setDate(f.arrivedate.selectedIndex);
	now = new Date(syear,smonth,f.arrivedate.selectedIndex);

	checkdate = checkDate(now.getTime());
	
	return checkdate;
}

function checkArrivalDate2()
{
	f = document.form2;
	//now = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	//now.setYear(syear);
	//now.setMonth(smonth);
	//now.setDate(f.arrivedate.selectedIndex);
	now = new Date(syear,smonth,f.arrivedate.selectedIndex);

	checkdate = checkDate(now.getTime());
	
	return checkdate;
}

function compareDates()
{
	f = document.form;
	//arr = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	//arr.setYear(syear);
	//arr.setMonth(smonth);
	//arr.setDate(f.arrivedate.selectedIndex);
	//arr.setFullYear(syear,smonth,f.arrivedate.selectedIndex);
	arr = new Date(syear,smonth,f.arrivedate.selectedIndex);

	//dep = new Date();
	emonth = getMonthValue(f.departdate2.options[f.departdate2.selectedIndex].value);
	eyear = getYearValue(f.departdate2.options[f.departdate2.selectedIndex].value);
	//dep.setYear(eyear);
	//dep.setMonth(emonth);
	//dep.setDate(f.departdate.selectedIndex);
	dep = new Date(eyear,emonth,f.departdate.selectedIndex);

	checkdate = checkDate(now.getTime());

	if (dep.getTime()<=arr.getTime())
		check = 1;
	else
		check = 0;

	return check;
}

function compareDates2()
{
	f = document.form2;
	//arr = new Date();
	smonth = getMonthValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	syear = getYearValue(f.arrivedate2.options[f.arrivedate2.selectedIndex].value);
	//arr.setYear(syear);
	//arr.setMonth(smonth);
	//arr.setDate(f.arrivedate.selectedIndex);
	//arr.setFullYear(syear,smonth,f.arrivedate.selectedIndex);
	arr = new Date(syear,smonth,f.arrivedate.selectedIndex);

	//dep = new Date();
	emonth = getMonthValue(f.departdate2.options[f.departdate2.selectedIndex].value);
	eyear = getYearValue(f.departdate2.options[f.departdate2.selectedIndex].value);
	//dep.setYear(eyear);
	//dep.setMonth(emonth);
	//dep.setDate(f.departdate.selectedIndex);
	dep = new Date(eyear,emonth,f.departdate.selectedIndex);

	checkdate = checkDate(now.getTime());

	if (dep.getTime()<=arr.getTime())
		check = 1;
	else
		check = 0;

	return check;
}


function readCookieDates(t)
{
	f = document.form;
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	dateset = 0;

	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimString(broken_cookie[i]);
		if (broken_cookie[i]=='dateset=yes')
			dateset = 1;
	}
	if (dateset==1)
	{
		for (k=0; k<m; k++)
		{
			if (broken_cookie[k].substring(0,3)=='sd=')
				f.arrivedate.selectedIndex = broken_cookie[k].substring(3);
			if (broken_cookie[k].substring(0,3)=='sm=')
				f.arrivedate2.selectedIndex = broken_cookie[k].substring(3);
			if (broken_cookie[k].substring(0,7)=='nights=')
			{
				f.nights.selectedIndex = parseInt(broken_cookie[k].substring(7));
				setEndDate(f.nights.options[f.nights.selectedIndex].value);
			}
			if (broken_cookie[k].substring(0,6)=='rooms=')
			{
				f.rooms.selectedIndex = broken_cookie[k].substring(6);
				showRooms(f.rooms.options[f.rooms.selectedIndex].value, t);
			}

			if (broken_cookie[k].substring(0,11)=='room1value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype1.options.length && !found)
				{
					if (f.roomtype1.options[i].value==roomtypename)
					{
						f.roomtype1.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room2value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype2.options.length && !found)
				{
					if (f.roomtype2.options[i].value==roomtypename)
					{
						f.roomtype2.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room3value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype3.options.length && !found)
				{
					if (f.roomtype3.options[i].value==roomtypename)
					{
						f.roomtype3.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room4value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype4.options.length && !found)
				{
					if (f.roomtype4.options[i].value==roomtypename)
					{
						f.roomtype4.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room5value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype5.options.length && !found)
				{
					if (f.roomtype5.options[i].value==roomtypename)
					{
						f.roomtype5.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,8)=='kidsage=')
			{
				f.kidsage.value = broken_cookie[k].substring(8);
			}
		}
	}
	return dateset;
}



function readCookieDates2(t)
{
	f = document.form2;
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	dateset = 0;

	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimString(broken_cookie[i]);
		if (broken_cookie[i]=='dateset=yes')
			dateset = 1;
	}
	if (dateset==1)
	{
		for (k=0; k<m; k++)
		{
			if (broken_cookie[k].substring(0,3)=='sd=')
				f.arrivedate.selectedIndex = broken_cookie[k].substring(3);
			if (broken_cookie[k].substring(0,3)=='sm=')
				f.arrivedate2.selectedIndex = broken_cookie[k].substring(3);
			if (broken_cookie[k].substring(0,7)=='nights=')
			{
				f.nights.selectedIndex = parseInt(broken_cookie[k].substring(7));
				setEndDate(f.nights.options[f.nights.selectedIndex].value);
			}
			if (broken_cookie[k].substring(0,6)=='rooms=')
			{
				f.rooms.selectedIndex = broken_cookie[k].substring(6);
				showRooms(f.rooms.options[f.rooms.selectedIndex].value, t);
			}

			if (broken_cookie[k].substring(0,11)=='room1value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype1.options.length && !found)
				{
					if (f.roomtype1.options[i].value==roomtypename)
					{
						f.roomtype1.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room2value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype2.options.length && !found)
				{
					if (f.roomtype2.options[i].value==roomtypename)
					{
						f.roomtype2.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room3value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype3.options.length && !found)
				{
					if (f.roomtype3.options[i].value==roomtypename)
					{
						f.roomtype3.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room4value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype4.options.length && !found)
				{
					if (f.roomtype4.options[i].value==roomtypename)
					{
						f.roomtype4.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,11)=='room5value=')
			{
				roomtypename = broken_cookie[k].substring(11);
				found=false;
				i=0;
				while (i<f.roomtype5.options.length && !found)
				{
					if (f.roomtype5.options[i].value==roomtypename)
					{
						f.roomtype5.selectedIndex=i;
						found=true;
					}
					else i++;
				}
			}
			if (broken_cookie[k].substring(0,8)=='kidsage=')
			{
				f.kidsage.value = broken_cookie[k].substring(8);
			}
		}
	}
	return dateset;
}




function trimString(str)
{
	return str.replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ");
}

function setShowdate()
{
	f = document.form;
	url = document.URL;
	if (url.indexOf('?')>-1)
	{
	   if (url.indexOf('performance=M')>-1) f.performance.selectedIndex=0;
	   else f.performance.selectedIndex=1;
	   loaddates();

	   pos=url.indexOf('ntickets=');
	   if (pos>-1)
	   {
		   pos2=url.indexOf('&',pos+1);
		   ntickets=url.substring(pos+'ntickets='.length,pos2);
		   ntickets=ntickets-1;
		   f.ntickets.selectedIndex=ntickets;
	   }

	   pos=url.indexOf('showdate=');
	   if (pos>-1)
	   {
		   showdate=url.substring(pos+'showdate='.length);		
		   showdate=showdate.replace('%2F','/');
		   found=false;
		   i=0;
		   while (!found && i<f.showdate.length)
		   {
			if (f.showdate.options[i].value==showdate && f.showdate.options[i].text!='') 
			{
				found=true;			
				f.showdate.selectedIndex=i;
			}
			else i++;
		   }
	   }
	}	
}

function setTheatredate()
{
		f = document.form;
		now = new Date();
		showdate = f.showdate.options[f.showdate.selectedIndex].value;
		showmonth=showdate.substring(8);
		showmonth=showmonth-1;

		showday=showdate.substring(0,2);
		f.arrivedate.selectedIndex = showday;

		showmonth=showmonth-now.getMonth();
		if (showmonth<0) showmonth=0;

		f.arrivedate2.selectedIndex = showmonth;
		f.nights.selectedIndex = 0;
		setEndDate(1);
}

function populateshowinfo()
{
		f = document.form;

if (f.showid.options[f.showid.selectedIndex].value=='1667') f.theatre.value='132|`39 Steps` at Criterion Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2542') f.theatre.value='191|`A Flea In Her Ear` at Old Vic Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2548') f.theatre.value='185|`An Ideal Husband` at Vaudeville Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2623') f.theatre.value='148|`Anna Nicole` at Royal Opera House';
if (f.showid.options[f.showid.selectedIndex].value=='2652') f.theatre.value='149|`Apassionata` at The O2 Arena';
if (f.showid.options[f.showid.selectedIndex].value=='2642') f.theatre.value='183|`Barbershopera Apocalypse No!` at Trafalgar Studio Two';
if (f.showid.options[f.showid.selectedIndex].value=='2626') f.theatre.value='149|`Batman-Live` at The O2 Arena';
if (f.showid.options[f.showid.selectedIndex].value=='2648') f.theatre.value='110|`Betty Blue Eyes` at Novello Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1330') f.theatre.value='172|`Billy Elliot` at Victoria Palace';
if (f.showid.options[f.showid.selectedIndex].value=='2496') f.theatre.value='134|`Birdsong` at Comedy';
if (f.showid.options[f.showid.selectedIndex].value=='2527') f.theatre.value='120|`Blithe Spirit` at Apollo Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1024') f.theatre.value='126|`Blood Brothers` at Phoenix Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2543') f.theatre.value='191|`Cause Celebre` at Old Vic Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1003') f.theatre.value='114|`Chicago` at Cambridge Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2604') f.theatre.value='125|`Clybourne Park` at Wyndham`s Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2497') f.theatre.value='128|`Deathtrap` at Noel Coward Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2622') f.theatre.value='148|`Die Zauberflote` at Royal Opera House';
if (f.showid.options[f.showid.selectedIndex].value=='1597') f.theatre.value='112|`Dirty Dancing` at Aldwych Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2614') f.theatre.value='612|`Disney On Ice-Liverpool` at Echo Arena';
if (f.showid.options[f.showid.selectedIndex].value=='2612') f.theatre.value='147|`Disney On Ice-Wembley Arena` at Wembley Arena';
if (f.showid.options[f.showid.selectedIndex].value=='2250') f.theatre.value='175|`Dreamboats and Petticoats` at Playhouse Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2602') f.theatre.value='182|`End Of The Rainbow` at Trafalgar Studios';
if (f.showid.options[f.showid.selectedIndex].value=='2411') f.theatre.value='127|`Flashdance` at Shaftesbury Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2695') f.theatre.value='155|`Frankenstein` at Olivier Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2464') f.theatre.value='116|`Ghost Stories` at Duke of York`s';
if (f.showid.options[f.showid.selectedIndex].value=='2586') f.theatre.value='131|`Ghost The Musical` at Piccadilly Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2312') f.theatre.value='148|`Giselle` at Royal Opera House';
if (f.showid.options[f.showid.selectedIndex].value=='1093') f.theatre.value='131|`Grease` at Piccadilly Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2658') f.theatre.value='154|`Greenland` at Lyttleton';
if (f.showid.options[f.showid.selectedIndex].value=='2621') f.theatre.value='148|`Il barbiere di Siviglia` at Royal Opera House';
if (f.showid.options[f.showid.selectedIndex].value=='2645') f.theatre.value='185|`In A Forest Dark And Deep` at Vaudeville Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1768') f.theatre.value='156|`Jersey Boys` at Prince Edward Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2600') f.theatre.value='498|`La Soiree` at South Bank Big Top';
if (f.showid.options[f.showid.selectedIndex].value=='2696') f.theatre.value='117|`Lance Horne - First Things Last` at Garrick Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2199') f.theatre.value='119|`Legally Blonde` at Savoy Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1002') f.theatre.value='162|`Les Miserables` at Queen`s Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2302') f.theatre.value='111|`Love Never Dies` at Adelphi Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2549') f.theatre.value='115|`Love Story` at Duchess Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1027') f.theatre.value='166|`Mamma Mia!` at Prince of Wales Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2650') f.theatre.value='128|`Million Dollar Quartet` at Noel Coward Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1031') f.theatre.value='118|`Mousetrap` at St Martins Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2700') f.theatre.value='125|`Much Ado About Nothing` at Wyndham`s Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2641') f.theatre.value='120|`My Trip Down The Pink Carpet` at Apollo Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1018') f.theatre.value='161|`Phantom of the Opera` at Her Majesty`s Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1972') f.theatre.value='164|`Priscilla Queen of the Desert` at Palace Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2659') f.theatre.value='154|`Rocket To The Moon` at Lyttleton';
if (f.showid.options[f.showid.selectedIndex].value=='2656') f.theatre.value='149|`Romeo and Juliet - O2 Arena` at The O2 Arena';
if (f.showid.options[f.showid.selectedIndex].value=='2655') f.theatre.value='154|`Season`s Greetings` at Lyttleton';
if (f.showid.options[f.showid.selectedIndex].value=='2697') f.theatre.value='184|`Shoes` at Peacock Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2541') f.theatre.value='123|`Shrek The Musical` at Theatre Royal Drury Lane';
if (f.showid.options[f.showid.selectedIndex].value=='1706') f.theatre.value='113|`Stomp` at The Ambassadors Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1788') f.theatre.value='148|`Swan Lake` at Royal Opera House';
if (f.showid.options[f.showid.selectedIndex].value=='2629') f.theatre.value='134|`The Children`s Hour` at Comedy';
if (f.showid.options[f.showid.selectedIndex].value=='2515') f.theatre.value='120|`The Country Girl` at Apollo Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2643') f.theatre.value='183|`The Fitzrovia Radio Hour` at Trafalgar Studio Two';
if (f.showid.options[f.showid.selectedIndex].value=='2565') f.theatre.value='117|`The Gruffalo` at Garrick Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2698') f.theatre.value='117|`The Hurly Burly Show` at Garrick Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1001') f.theatre.value='199|`The Lion King` at Lyceum Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2601') f.theatre.value='133|`The Rivals` at Haymarket Theatre Royal';
if (f.showid.options[f.showid.selectedIndex].value=='1887') f.theatre.value='165|`The Wizard Of Oz` at London Palladium';
if (f.showid.options[f.showid.selectedIndex].value=='1014') f.theatre.value='121|`The Woman in Black` at Fortune Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2102') f.theatre.value='163|`Thriller - Live` at Lyric Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1769') f.theatre.value='129|`War Horse` at New London Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1041') f.theatre.value='139|`We Will Rock You` at Dominion Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='2529') f.theatre.value='117|`When We Are Married` at Garrick Theatre';
if (f.showid.options[f.showid.selectedIndex].value=='1587') f.theatre.value='138|`Wicked` at Apollo Victoria';
if (f.showid.options[f.showid.selectedIndex].value=='2512') f.theatre.value='135|`Yes, Prime Minister` at Gielgud Theatre';


if (f.showid.options[f.showid.selectedIndex].value=='1667') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/the39steps.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2542') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3304_3304_fleadecember2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2548') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3208_3208_encoreaih100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2623') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3257_3257_roh.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2652') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3308_3308_encore100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2642') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3277_3277_barbershop.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2626') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3246_3246_batman150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2648') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3313_3313_betty-encore-100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1330') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/billyelliot.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2496') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/birdsong.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2527') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3127_3127_blithespiritaugust.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1024') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/bb20th.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2543') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/causecelebre.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1003') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/chicagooct09.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2604') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3285_3285_cpnov2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2497') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3263_3263_deathtrapnov2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2622') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3256_3256_diezauberflote.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1597') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/ddmarch2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2614') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3261_3261_disney150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2612') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3260_3260_disney150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2250') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/dap_100x150_encore1.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2602') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3225_3225_eotr_encore_100wx150pxh.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2411') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3259_3259_flashdancenovember2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2695') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3312_3312_frankenstein.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2464') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/ghoststoriesjune20102.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2586') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3202_3202_ghost.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2312') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3264_3264_giselleroh.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1093') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3209_3209_greaseoct2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2658') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3310_3310_greenland.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2621') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3255_3255_ilbarbieredisibiglia.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2645') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3279_3279_forest150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1768') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/jerseyboysmay2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2600') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3174_3174_soiree.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2696') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3314_3314_lancehorne.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2199') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3321_3321_legallyblonde.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1002') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3274_3274_lesmisnov2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2302') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3169_3169_images-resources-3163_3163_lndsep2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2549') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3291_3291_lovestorydec2010.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1027') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/mmfeb2010new.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2650') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3286_3286_mdq.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1031') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/mousetrap.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2700') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3326_3326_wyndhamsmuchado150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2641') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3300_3300_encorepc100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1018') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/phantom2009.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1972') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/priscillaposter.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2659') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3309_3309_rockettothemoon.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2656') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3303_3303_randjo2.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2655') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3302_3302_seasons.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2697') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3315_3315_shoes.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2541') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3171_3171_shrek.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1706') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/encorestomp100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1788') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3265_3265_swanlake.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2629') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3311_3311_tch_encore_100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2515') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3125_3125_tcg1.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2643') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3278_3278_fitzroviaradio.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2565') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3129_3129_gruffalo.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2698') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3316_3316_hurlyburly.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1001') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/lk2007.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2601') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3175_3175_rivals.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1887') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/wiz-100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1014') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3301_3301_encorewib100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2102') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/thriller.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1769') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/3241_3241_encorewar100x150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1041') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/wwry150.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2529') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/marriedencore.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='1587') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/apollovictoriawicked.jpg';
if (f.showid.options[f.showid.selectedIndex].value=='2512') f.theatreimage.value='http://theatre.hoteldirect.co.uk/images/RESOURCES/ypmencore.jpg';


}

