// JavaScript Document
function Watermark(searchBox)
{
	if(searchBox.value == "- Quantity -")
	{
		searchBox.value = "";
		searchBox.style.color = "#333";
	}
	else if(searchBox.value == "")
	{
		searchBox.value = "- Quantity -";
		searchBox.style.color = "#AAA";
	}
}

function ShowMovie(s)
{
	if(page == "Soon" && s == "Now")	
		window.location = "moviedetails.php?id=Now";
	else if(page == "Now" && s == "Soon")
			window.location = "moviedetails.php?id=Soon";
}

function Validate()
{
	if(document.form1.rdate.value == "")
	{
		alert("Please select the date.");
		return false;
	}
	return true;
}

function CinemaChange(s)
{
	document.form1.Movie.options[0].text = "Loading...";
	jQuery.post("getMovies.php",{ cinemaid:s.value } ,function(data)
	{
		document.getElementById('Movietd').innerHTML = data;
	});
}

function MovieChange(s)
{
	document.form1.rdate.options[0].text = "Loading...";
	jQuery.post("getDates.php",{ filmid:s.value, cinemaid: document.form1.Cinema.value } ,function(data)
	{
		document.getElementById('Datetd').innerHTML = data;
	});
}

function getPriceDetails(cinema, film, cinemaid, filmid, screenno, showtime)
{
	document.getElementById('Pricing').style.display = "block";
	document.getElementById('cine').innerHTML = cinema;
	document.getElementById('scre').innerHTML = screenno;
	document.getElementById('mov').innerHTML = film;
	document.getElementById('stime').innerHTML = showtime;
	//document.form2.cat.options[0].text = "Loading...";
	/*jQuery.post("getprice.php",{ cinemaid:cinemaid,filmid:filmid,showno:screenno,showtime:showtime } ,function(data)
	{
		alert(data);
	});*/
}

function catchange(s)
{
	if(s.value == "Excutive")
	{
		document.getElementById('max').innerHTML = "(Available seats - 30)";
	}
	else
	{
		document.getElementById('max').innerHTML = "";
	}
}

function count(s,r)
{
	var ob = document.getElementById('total');
	if(s.value == "")
	{
		ob.innerHTML = "OMR. 0.00";
		return;
	}
	var x = parseInt(s.value);
	if(x <= 30)
	{
		if(document.form2.cat.value == "Adult")
		{
			ob.innerHTML = "OMR. " + ((x * 3.00) + (x * r/1000));
		}
		else if(document.form2.cat.value == "Child")
		{
			ob.innerHTML = "OMR. " + ((x * 3.00) + (x * r/1000));
		}
		else
		{
			ob.innerHTML = "OMR. " + (x * 0.00);
		}
	}
	else
	{
		alert("Given value exceeding maximum available seats.");	
	}
}