///For making reservation page (res-details.cfm)
//Member trying to make reservation but needs to be registered, missing info
function checkAndSubmitMakeReservation1(thisform)
	{
		thisform.action="https://www.marinalife.com/register-secure/index.cfm";
		
		thisform.submit();
		return true;
	}
	
function checkAndSubmitMakeReservation2(thisform)
	{
		var missing = false;
		var filler = "      ";
		var str = "_______________________________________\n\n";
		str += "The information was not submitted because\nof the following error(s):\nPlease correct the error(s) and re-submit.\n";
		str += "_______________________________________\n\n";
		str += "-The following field(s) are required:\n";
	
		/* check dates */
		var today_date = new Date();
		var today_year = today_date.getFullYear();
		var today_month = today_date.getMonth();
		var today_day = today_date.getDate();
		var curr_date = new Date(today_year, today_month, today_day);		
		
		// Do Required Checks
		if (!thisform.arrivalDate.value) 
			{
				str += filler + "Arrival Date\n";
				missing = true;
			}
		else if (errDate(thisform.arrivalDate,'Arrival Date',false,true))
			{
				str += filler + "Arrival Date is Invalid\n";
				missing = true;
			}	
		
		if (!thisform.departDate.value)
			 {
				str += filler + "Depart Date\n";
				missing = true;
			}
		else if (errDate(thisform.departDate,'Depart Date',false,true))
			{
				str += filler + "Departure Date is invalid\n";
				missing = true;
			}	
		
		//arrival cannot be less than current day
		var arr_date = new Date(thisform.arrivalDate.value);
		if (curr_date > arr_date)
			{
				str += filler + "Arrival date cannot be less than today's date.\n";
				missing = true;
			}
	
		if (Date.parse(thisform.arrivalDate.value) > Date.parse(thisform.departDate.value))
			{
				str += filler + "Arrival Date cannot be greater than the Departure Date.\n";
				missing = true
			}	

		if(missing)
			{
				alert(str);
				return false;
			}
		else
			{
				//set process flag to submit page
				//thisform.processMemberFlag.value=1;
				thisform.action="make_reservation_preview.cfm";
				//submitonce(thisform);
				thisform.submit();
			}
		}
//check preview page before submitting
function checkAndSubmitReservationPreview(thisform)
	{
		
		var missing = false;
		var filler = "      ";
		var str = "_______________________________________\n\n";
		str += "The information was not submitted because\nof the following error(s):\nPlease correct the error(s) and re-submit.\n";
		str += "_______________________________________\n\n";
		str += "-The following field(s) are required:\n";
		
		/* check dates */
		var today_date = new Date();
		var today_year = today_date.getFullYear();
		var today_month = today_date.getMonth();
		var today_day = today_date.getDate();
		var curr_date = new Date(today_year, today_month, today_day);		
		
		// Do Required Checks
		if (!thisform.arrivalDate.value) 
			{
				str += filler + "Arrival Date\n";
				missing = true;
			}
		else if (errDate(thisform.arrivalDate,'Arrival Date',false,true))
			{
				str += filler + "Arrival Date is Invalid\n";
				missing = true;
			}	
		
		if (!thisform.departDate.value)
			 {
				str += filler + "Departure Date\n";
				missing = true;
			}
		else if (errDate(thisform.departDate,'Depart Date',false,true))
			{
				str += filler + "Departure Date is invalid\n";
				missing = true;
			}	
		
		//arrival cannot be less than current day
		var arr_date = new Date(thisform.arrivalDate.value);
		if (curr_date > arr_date)
			{
				str += filler + "Arrival date cannot be less than today's date.\n";
				missing = true;
			}
	
		if (Date.parse(thisform.arrivalDate.value) > Date.parse(thisform.departDate.value))
			{
				str += filler + "Arrival Date cannot be greater than the Departure Date.\n";
				missing = true
			}	
			
		if (!thisform.cc_type.value) 
		{
			str += filler + "Credit Card Type\n";
			missing = true;
		}

		if (thisform.cc_type.value) 
			{
				if (thisform.cc_type.value == "V") 
				 	{
		    		    ccType = "VISA";
		   			} 
				else if (thisform.cc_type.value == "M") 
					{
		      			ccType = "MC";
		   			} 
				else if (thisform.cc_type.value == "D") 
					{
		     			ccType = "DISC";
		   			} 
				else if (thisform.cc_type.value == "A")
					{
						ccType = "AMEX";
		 			} 
				else if (thisform.cc_type.value == "DC") 
					{
		     			ccType = "DINERS";
   					}
				else
					{
		     			ccType = "";
   					}
			}

		if (!thisform.cc_account.value) 
			{
				str += filler + "Credit Card Number\n";
				missing = true;
			}
		
		if (!thisform.cc_exp.value) {
			str += filler + "Expiration Date\n";
			missing = true;
		}
		/*
		if (!thisform.expyear.value) 
		{
			str += filler + "Expiration Year\n";
			missing = true;
		}
		*/
		if (thisform.cc_exp.value)
				{
					//set expiration
					var expDate =  new Date(thisform.expmonth.value + "/01/20" + thisform.expyear.value);
					if (today_date > expDate)
						{
							str += filler + "Expiration cannot be less than today's date\n";
							missing = true;
						}
				}
		
		if (!thisform.cc_csv.value) 
			{
				str += filler + "CSC Code\n";
				missing = true;
			}
			
		if (!thisform.cc_name.value) 
			{
				str += filler + "Name on Credit Card\n";
				missing = true;
			}
		
		if (thisform.cc_type.value) 
			{

			if (!isValidCreditCard(ccType,thisform.cc_account.value))
				{
					str += filler + "\n";
					str += "Credit Card Number is not a valid " + ccType + " card.\n";
					str += "Check credit card number and credit card type.\n";
					str += "Make sure you have not entered any dashes, spaces, etc. ONLY numbers.\n";
					missing = true;
				}	
			}	

		if(missing)
			{
				alert(str);
				return false;
			}
		else
			{
				//set process flag to submit page
				//thisform.processMemberFlag.value=1;
				//submitonce(thisform);
				thisform.submit();
				return true;
			}
		} 