	var price = 0;	var deposit = 0;	var balance = 0;	var Room_type;	//Calculate deposit	function calc_dep()	{	deposit = (Math.round(price/5));	balance = price - deposit;	return;	}	function howLong()	{	var Room = myForm.roomChoice.options[myForm.roomChoice.selectedIndex].value;	var Nig_hts = myForm.numNights.options[myForm.numNights.selectedIndex].value;	var view;	var people; 	switch(Room)	{	case"0":	Room_type = "double";	view = "with a view";	people = "two people";	double_with_view();	break;	case"1":	Room_type ="twin";	view = "with a view";	people = "two people";	twin_with_view();	break;	case"2":	Room_type ="twin";	view = "with No view";	people = "two people";	twin_no_view();	break;	case"3":	Room_type ="single";	view = "with a view";	people = "one person";	single_with_view();	break;	case"4":	Room_type ="single";	view = "with No view";	people = "one person";	single_no_view();	break;	default: document.write("Error in program. Please use the contact link.");	break;	}	//Double with View	function double_with_view()	{	if (Nig_hts <= 3)	{	price = 44 * Nig_hts;	calc_dep();	}	if (Nig_hts > 3 && Nig_hts < 14)	{	price = 40 * Nig_hts;	calc_dep();	}	if (Nig_hts >= 14)	{	price = 36 * Nig_hts;	calc_dep();	}	}	//Twinroom with View	function twin_with_view()	{	if (Nig_hts <= 3)	{	price = 44 * Nig_hts;	calc_dep();	}	if (Nig_hts > 3 && Nig_hts < 14)	{	price = 40 * Nig_hts;	calc_dep();	}	if (Nig_hts >= 14)	{	price = 36 * Nig_hts;	calc_dep();	}	}	//Twinroom No view	function twin_no_view()	{	if (Nig_hts <= 3)	{	price = 40 * Nig_hts;	calc_dep();	}	if (Nig_hts > 3 && Nig_hts < 14)	{	price = 36 * Nig_hts;	calc_dep();	}	if (Nig_hts >= 14)	{	price = 32 * Nig_hts;	calc_dep();	}	}	//Twinroom Single With view	function single_with_view()	{	if (Nig_hts <= 3)	{	price = 32 * Nig_hts;	calc_dep();	}	if (Nig_hts > 3 && Nig_hts < 14)	{	price = 30 * Nig_hts;	calc_dep();	}	if (Nig_hts >= 14)	{	price = 28 * Nig_hts;	calc_dep();	}	}	//Twinroom No view Single	function single_no_view()	{	if (Nig_hts <= 3)	{	price = 30 * Nig_hts;	calc_dep();	}	if (Nig_hts > 3 && Nig_hts < 14)	{	price = 28 * Nig_hts;	calc_dep();	}	if (Nig_hts >= 14)	{	price = 26 * Nig_hts;	calc_dep();	}	}	stats='toolbar=no,location=no,directories=no,status=no,menubar=no,'; 	stats += 'scrollbars=yes,resizable=yes';	MsgBox = window.open ("","msgWindow",stats);       MsgBox.document.write("<head><title>TJ Walking Madeira Price Check Calculator<\/title><\/head>");	MsgBox.document.write ("<body><h2><center>Search Results<\/center><\/h2>"); 	MsgBox.document.write ("<center><h4> Bed and Breakfast in a " + Room_type + " room " + view +  " for " + Nig_hts + " nights is " + price + " Euro for " + people + " <br><br>To book go to the booking page and complete the form <br><br> we will require a non-refundable " + deposit + " Euro booking deposit <br><br>leaving a balance of " + balance + " Euro <br><br>full payment of " + price + " Euro is required if less than 6 weeks before date of arrival <br><br>or another way to book<br><br>Skype us at tjwalking1 or send an e-mail to tjwalking@sapo.pt or <br><br>telephone 00 351 291 783268<\/h4>"); MsgBox.document.write ("<center><br><input type='button' value='Close' onClick ='self.close()'>"); MsgBox.document.write ("<\/center>"); }
