All pastes #488769 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-15 04:52 UTC
rendered paste body
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Azure Isle Home</title>
<style>
#calcnote				{display:none}
#calculateButton		{display:none}
#printButton			{display:none}
#totalDaysRow			{visibility:hidden}
#basicChargeRow			{visibility:hidden}
#totalCostRow			{visibility:hidden}
#scubacost				{display:none}		
#golfcost				{display:none}		
#ridecost				{display:none}
</style>
<script language="JavaScript">

var currentScubaCharge=75;
var currentGolfCharge=60;
var currentRideCharge=25;



    function initializeForm()
	          {
            document.estimate.startyear.value = 2007;
            document.estimate.endyear.value = 2007;
            document.estimate.people.value="0";
            document.estimate.people.focus();
  
	          document.getElementById("calcnote").style.display="inline";
	          document.getElementById("calculateButton").style.display="inline";
	          document.getElementById("printButton").style.display="inline";
	          document.getElementById("totalDaysRow").style.visibility="visible";
	          document.getElementById("basicChargeRow").style.visibility="visible";
	          document.getElementById("totalCostRow").style.visibility="visible";
	          document.getElementById("scubacost").style.display="inline";
	          document.getElementById("golfcost").style.display="inline";
	          document.getElementById("ridecost").style.display="inline";
	          document.estimate.javaScriptEnabled.value="Y";

	          }
 
    function insertYear()
	          {
            
             var Year = new Date();
             var yearVariable = Year.getFullYear();
             document.estimate.startyear.value = yearVariable;
             document.estimate.endyear.value = yearVariable;
   //Making a new date object and getting the current month to see if the startmonth is less than the current 
   //month. If yes than we add one to the four digit year.    
             var d = new Date();
             var currentMonth = d.getMonth();
             if(document.estimate.startmonth.selectedIndex < currentMonth)
            
                {
                  var addYear = Year.getFullYear()+1;
                
                  document.estimate.startyear.value = addYear;
                  document.estimate.endyear.value = addYear;
                }
            
            }
    function checkForNull(fieldValue, fieldName)
	          {
               if(fieldValue=="" ||fieldValue==null)
             	 {alert("\nForm Error!\n\nYou must enter data in the "+fieldName+" field");
	         	   return false;
	             }
	          return true;
	          }
           
  
    function fieldFocus(index) 
	          {
            document.forms[0].elements[index].select();
	          document.forms[0].elements[index].focus();
            }
  
   function validatePeople()
	         {
           var numberOfPeople=document.forms[0].people.value;
	         if(!checkForNull(numberOfPeople,"Number of People"))
	 	          {
		          document.forms[0].people.focus();
		          setTimeout( 'fieldFocus(0)' , 100 );
              return false
	            }
           else if(isNaN(numberOfPeople))
           {
             alert("Input must be a number");
             document.forms[0].people.select();
             document.forms[0].people.focus();
             
            return false;
           } 
   
    else if(numberOfPeople == "0")
       
           {
            alert("The number must be greater than 0");
            document.estimate.people.focus(); 
            document.estimate.people.select();
           return false;
           
           }
            return true;
            
             }

  
  
    function checkMonth()
            {
            document.forms[0].endmonth.selectedIndex= document.forms[0].startmonth.selectedIndex;
            insertYear();
            }
          
    function checkDate()
            {
            document.forms[0].endday.selectedIndex= document.forms[0].startday.selectedIndex;
            insertYear();
            }

           
   function resetScubaCost()
      	   {
	         document.forms[0].scubacost.value=Number(document.forms[0].scubacount.value)*currentScubaCharge;
	         }
  function checkNumeric(testField)
		      {
		       var numField=Number(testField);
		       var result=true;
		       if(isNaN(numField))
		 	        {
			         result=false;
			        }
		       return result;
		       }
        

function checkScuba()
        {
		result=true;
		var fieldName="Number of Scuba Divers";
		var currentScubaCharge=75;
		var fieldValue=document.forms[0].scubacount.value;
        if (fieldValue=="" ||fieldValue==null)
			{
             alert("\nForm Error!\n\nYou must enter data in the "+fieldName+" field");
			 document.forms[0].scubacount.focus();
			 result=false;
			}
		else
			{
			 if (checkNumeric(fieldValue))
			 	{
				 if (fieldValue>20)
				 	{
					 alert("\nForm Error!\n\nThe maximum number of people in a scuba party is 20");
			 		 document.forms[0].scubacount.focus();
			 		 document.forms[0].scubacount.select();
			 		 result=false;
					}
				 else
				 	{
					 scubaCost=Number(fieldValue)*currentScubaCharge;
					 document.forms[0].scubacost.value=scubaCost;
					 result=true;
					}
				}
			 else
			    {
				 alert("\nForm Error!\n\nThe number of people in the scuba party field must contain a number");
			 	 document.forms[0].scubacount.focus();
			 	 result=false;
				}
			}
		return result;
		}
    
function checkGolf()
        {
		     result=true;
		     var fieldName="Number of golf players";
		     var currentGolfCharge=60;
		     var fieldValue=document.forms[0].golfcount.value;
         if (fieldValue=="" ||fieldValue==null)
         
			          {
                alert("\nForm Error!\n\nYou must enter data in the "+fieldName+" field");
			          document.forms[0].golfcount.focus();
			          result=false;
               
			           }
		     else
			          {
			 if (checkNumeric(fieldValue))
			         	{
				 if (fieldValue>16)
				 	{
					 alert("\nForm Error!\n\nThe maximum number of people in a golf party is 16");
			 		 document.forms[0].golfcount.focus();
			 		 document.forms[0].golfcount.select();
			 		 result=false;
					}
				 else
				 	{
					 golfCost=Number(fieldValue)*currentGolfCharge;
					 document.forms[0].golfcost.value=golfCost;
					 result=true;
					}
				}
			 else
			    {
				 alert("\nForm Error!\n\nThe number of people in the scuba party field must contain a number");
			 	 document.forms[0].golfcount.focus();
			 	 result=false;
				}
			}
		return result;
		    }
        
function resetGolfCost()
	{

	}
function checkRide()
        {

		}
function resetRideCost()
	{

	}
  
  function numberOfDays()
          {
           var startDateVal = new Date();
              startDateVal.setUTCMonth(document.forms[0].startmonth.selectedIndex + 1);
              startDateVal.setUTCDate(document.forms[0].startday.selectedIndex);
              startDateVal.setUTCFullYear(document.forms[0].startyear.value);
           
          var endDateVal = new Date();
              endDateVal.setUTCMonth(document.forms[0].endmonth.selectedIndex + 1);
              endDateVal.setUTCDate(document.forms[0].endday.selectedIndex);
              endDateVal.setUTCFullYear(document.forms[0].endyear.value);
      
          
          var startMilliSec = startDateVal.getTime();
          var endMilliSec = endDateVal.getTime(); 
          
          var dateDifference = endMilliSec - startMilliSec;
          var days= dateDifference/(1000*60*60*24);
          return days;
          }
 
        
 function calcDays()
	        {
         var   myDay = numberOfDays();
           if ((myDay < 0) || (myDay == 0))
              {
              alert("total days can't be zero or less than zero");
              document.forms[0].startmonth.focus();
              return;
                            
              }
             else
              {
               document.forms[0].totaldays.value= myDay;
              }
      
              
              var monthFee = new Array(12);
                  monthFee[00]=112;
                  monthFee[01]=120;
                  monthFee[02]=150;
                  monthFee[03]=140;
                  monthFee[04]=112;
                  monthFee[05]=118;
                  monthFee[06]=112;
                  monthFee[07]=112;
                  monthFee[8]=100;
                  monthFee[9]=108;
                  monthFee[10]=120;
                  monthFee[11]=140;
                  
               var month = document.estimate.startmonth.selectedIndex;
               var mthFee = monthFee[month];
               //var diffMonth =   monthFee[charge.document.forms[0].endmonth.selectedIndex-1]
               var totalDays = document.forms[0].totaldays.value;
               var totalPeople = document.forms[0].people.value;
               var basicCharge = mthFee * totalPeople * totalDays;
               
               document.forms[0].basiccharge.value = basicCharge;
              //Focuses on the scubacount input field and calls the checkScuba function. 
               document.forms[0].scubacount.focus();
               
        
        
        }
       
function checkEmail()
        {
        
    var result=true;
		var fieldValue=document.forms[0].email.value;
        if (fieldValue=="" ||fieldValue==null)
            {
            
            alert("Please enter your email address");
			      document.forms[0].email.focus();
			      result=false;
			      return result;
	          
            }	
		
//Makes sure that there is atleast one @ symbol.
			 emailString=new String(fieldValue);
			 var atPosition=emailString.indexOf("@");
			    if (atPosition==-1)
                 {
                 
			           alert("You must include at least one @ symbol in the email address");
			 	         document.forms[0].email.focus();
				         result=false;
				         return result;
				         }

//Makes sure there are character before the @symbol.         
          if (atPosition<1)
                 {
                 
			           alert("Must have characters before the @ symbol! ");
			 	         document.forms[0].email.focus();
				         result=false;
				         return result;
				         }

//Makes sure there is atleast one character after the @ symbol.
              if (atPosition==emailString.length-1)
                 {
                 
			           alert("Must have characters after the @ symbol! ");
			 	         document.forms[0].email.focus();
				         result=false;
				         return result;
				          }
		     
                  if (atPosition==atPosition)
                 {
                 
			           alert("Sorry, You cannot add more than one @ symbol! ");
			 	         document.forms[0].email.focus();
				         result=false;
				         return result;
				          }
		 return result;
		              }	
    
    
    
//function calculateTotal()
	//      {
	  //     var basicCharge=Number(document.forms[0].basiccharge.value);
        
	    //  }
        
function validateForm()
		    {
		    var validForm=true;
		    validForm = validatePeople() && calcDays() && checkScuba() && checkGolf() && checkRide() && checkEmail();
		    if (validForm)
		       {
			      calculateTotal();
			     }
		    return validForm;
		    }
    
function buildCookie()
	      {
	       var people=document.estimate.people.value;
	       var startingMonth=document.forms[0].startmonth.options[document.forms[0].startmonth.selectedIndex].value;
	       var startingDay=document.forms[0].startday.options[document.forms[0].startday.selectedIndex].value;
	       var startingYear=document.forms[0].startyear.value;
	       var startingDate=startingMonth+" "+startingDay+", "+startingYear; 
	       var endingMonth=document.forms[0].endmonth.options[document.forms[0].endmonth.selectedIndex].value;
	       var endingDay=document.forms[0].endday.options[document.forms[0].endday.selectedIndex].value;
	       var endingYear=document.forms[0].endyear.value;
	       var endingDate=endingMonth+" "+endingDay+", "+endingYear; 
	       var totalDays=document.estimate.totaldays.value;
	       var basicCharge=document.estimate.basiccharge.value;
	       var scubaCount=document.estimate.scubacount.value;
	       var golfCount=document.estimate.golfcount.value;
	       var rideCount=document.estimate.ridecount.value;
	       var scubaCost=document.estimate.scubacost.value;
	       var golfCost=document.estimate.golfcost.value;
	       var rideCost=document.estimate.ridecost.value;
	       var totalCost=document.estimate.totalcost.value;
	       var email=document.estimate.email.value;
	       var formData=people+"/"+startingDate+"/"+endingDate+"/"+totalDays+"/"+basicCharge+"/"+scubaCount+"/"+scubaCost+"/"+golfCount+"/"+golfCost+"/"+rideCount+"/"+rideCost+"/"+totalCost+"/"+email
<!--   create the cookie text here    //-->	
<!--   escape the cookie text here    //-->	
<!--   write the cookie here    //-->	
	       }
  
</script>
</head>
<body text=#000000 link=#0000ff bgColor=#ffffff onLoad="initializeForm();">

<table cellSpacing="0" cellPadding="5" width="100%" border="0" align="center">
  <tbody>
  <tr>

    <td><img height="112" width="94" alt="Island palm" src="palmtree.jpg"></td>
    <td align="center"><img height="86" width="528" alt="Azure Isle Logo" src="azure14.jpg"></td>
    <TD><IMG height="96" width="64" alt="Polly the parrot" src="parroth.jpg"></td>
  </tr>
  </tbody>
</table>
<table cellSpacing="0" cellPadding="3" width="100%" bgColor="#337bcc" border="0">
  <tbody>
  <tr>
    <td align="center">

      <a href="index.htm"><font face="Arial, Helvetica, sans-serif" color="#ffff00">Home</font></a></td>
    <td align="center">
      <a href="lodging.htm"><font face="Arial, Helvetica, sans-serif" color="#ffff00">Accommodations</font></a></td>
    <td align="center">
      <a href="activity.htm"><font face="Arial, Helvetica, sans-serif" color="#ffff00">Activities</font></a></td>
    <td align="center">
      <a href="addedatt.htm"><font face="Arial, Helvetica, sans-serif" color="#ffff00">Added Attractions</font></a></td>

    <td align="center">
      <a href="info.htm"><font face="Arial, Helvetica, sans-serif" color="#ffff00">Information</font></a></td>
  </tr>
  </tbody>
</table>
<div align="center">
<p><br><font face="Arial, Helvetica, sans-serif" color="#337bcc" size="+2">Azure 
Isle Cost Estimator and Vacation Planner</font></p></div>
<p>Use the form below to view resort cost information and estimate the cost of 
the total package. Our vacation plans are all inclusive, including lodging, 
meals, snacks, beverages, and all the standard resort activities. Prices vary 
depending on the time of year, with summer being the most economical. Prices are 
per person, with additional costs for various packages, such as a golf outing. 
Children 6 years and younger are free. You may submit this form and we will 
verify the prices and availability for the given dates. </p>
<p id="calcnote"><font color="#ff0000">Important</font>: You must click the Calculate button if 
you make any changes.</p>

<hr>

<form name="estimate" onreset="" onsubmit="validateForm();" action="mailto:estimate@azureisle.com" method="post" encType="multipart/form-data">
<p align="center"><FONT face="Arial, Helvetica, sans-serif" color="#337bcc" size="+2">Cost Estimator</font> 
<table cellSpacing="0" cellPadding="2" border="0">
  <tbody>
  <tr>
    <td>Number of people</td>
    <td>&nbsp; </td>
    <td><INPUT maxLength="2" size="3" value="0" name="people" onChange="validatePeople();"> </td>

    <td align="left" width="60">
          <input name="javaScriptEnabled" type="hidden" value="N"></td>
  </tr>
  <tr>
    <td>Starting Date (Month, Day, 4 digit Year)</td>
    <td>&nbsp; </td>
    <td><select size="1" name="startmonth" onChange="checkMonth();">
		  <option value="January" selected>January</option>

		  <option value="February">February</option>
		  <option value="March">March</option>
		  <option value="April">April</option>
      <option value="May">May</option>
		  <option value="June">June</option>
		  <option value="July">July</option>

		  <option value="August">August</option>
		  <option value="September">September</option>
		  <option value="October">October</option>
		  <option value="November">November</option>
          <option value="December">December</option>
		</select>

		
		<select size="1" name="startday"  onChange="checkDate();"> 
		  <option value="1" selected>1</option> 
		  <option value="2">2</option> 
		  <option value="3">3</option> 
		  <option value="4">4</option> 
      <option value="5">5</option> 
		  <option value="6">6</option> 
		  <option value="7">7</option> 
		  <option value="8">8</option> 
		  <option value="9">9</option> 
      <option value="10">10</option> 
		  <option value="11">11</option> 
		  <option value="12">12</option> 
		  <option value="13">13</option> 
		  <option value="14">14</option> 
		  <option value="15">15</option> 
		  <option value="16">16</option> 
		  <option value="17">17</option> 
		  <option value="18">18</option> 
		  <option value="19">19</option> 
		  <option value="20">20</option> 
		  <option value="21">21</option> 
		  <option value="22">22</option> 
		  <option value="23">23</option> 
		  <option value="24">24</option> 
		  <option value="25">25</option> 
		  <option value="26">26</option> 
		  <option value="27">27</option> 
		  <option value="28">28</option> 
		  <option value="29">29</option> 
		  <option value="30">30</option> 
		  <option value="31">31</option>

		</select> , 
		<input maxLength="4" size="5" name="startyear" onFocus="insertYear();"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Ending Date (Month, Day, 4 digit Year)</td>
    <td>&nbsp; </td>

    <td><select size="1" name="endmonth">
		  <option value="January" selected>January</option>
		  <option value="February">February</option> 
		  <option value="March">March</option> 
		  <option value="April">April</option> 
          <option value="May">May</option> 
		  <option value="June">June</option> 
		  <option value="July">July</option> 
		  <option value="August">August</option> 
		  <option value="September">September</option> 
		  <option value="October">October</option> 
		  <option value="November">November</option> 
          <option value="December">December</option>

		</select> 
	    <select size="1" name="endday"> 
		  <option value="1" selected>1</option> 
		  <option value="2">2</option> 
		  <option value="3">3</option> 
		  <option value="4">4</option> 
          <option value="5">5</option> 
		  <option value="6">6</option> 
		  <option value="7">7</option> 
		  <option value="8">8</option> 
		  <option value="9">9</option> 
      <option value="10">10</option> 
		  <option value="11">11</option> 
		  <option value="12">12</option> 
		  <option value="13">13</option> 
		  <option value="14">14</option> 
		  <option value="15">15</option> 
		  <option value="16">16</option> 
		  <option value="17">17</option> 
		  <option value="18">18</option> 
		  <option value="19">19</option> 
		  <option value="20">20</option> 
		  <option value="21">21</option> 
		  <option value="22">22</option> 
		  <option value="23">23</option> 
		  <option value="24">24</option> 
		  <option value="25">25</option> 
		  <option value="26">26</option> 
		  <option value="27">27</option> 
		  <option value="28">28</option> 
		  <option value="29">29</option> 
		  <option value="30">30</option> 
		  <option value="31">31</option>

		</select> , 

	<input maxLength="4" size="5" name="endyear" onFocus="insertYear();" onBlur="calcDays();" onChange="calcDays();"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr id="totalDaysRow">
    <td>Total Days (enter ending year to calculate)</td>
    <td>&nbsp;</TD>
    <td><input maxLength="3" size="4" name="totaldays" id="totaldays" onFocus="calcDays();" onChange="calcDays();"> </td>

    <td>&nbsp;</TD>
  </tr>
  <tr id="basicChargeRow">
    <td colSpan="2">Basic charge, including all meals (calculated) </td>
    <td><input maxLength="10" size="10" name="basiccharge" id="basiccharge" onFocus="validatePeople()" onChange="validatePeople();"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr>

    <td colSpan="3" align="left">
      <font face="Arial, Helvetica, sans-serif" color="#337bcc">Additional Activities</font></TD>
        <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Scuba Adventure - Enter the number of people</td>
    <td><input name="scubacount" size="3" value="0" onfocus="this.select();" maxLength="2" onchange="checkScuba();"> </td>

    <td><input  name="scubacost" id="scubacost" maxLength="10" size="10" value="0" onchange="resetScubaCost();"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Golf, 18 holes- Enter the number of people</td>
    <td><input name="golfcount" maxLength="2" size="3" value="0"> </td>
    <td><input name="golfcost" id="golfcost" maxLength="10" size="10" value="0"> </td>

    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Back Country Horseback Riding</td>
    <td><input name="ridecount" maxLength="2" size="3" value="0"> </td>
    <td><input name="ridecost" id="ridecost" maxLength="10" size="10" value="0"> </td>
    <td>&nbsp;</td>

  </tr>
  <tr id="totalCostRow">
    <td>Total cost (calculated) </td>
    <td>&nbsp;</TD>
    <td><input name="totalcost" maxLength="10" size="10" id="totalcost"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr>

    <td>Email Address</td>
    <td>&nbsp;</td>
    <td><input name="email" maxLength="40" size="40"> </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colSpan="3" align="center">
      <br>

	  <input type="button" value="Calculate" name="Calculate" id="calculateButton" onClick="validateForm();">
	  <input type="reset" value="Reset" name="Reset"> 
	  <input type="button" value="Print" name="Print" id="printButton" onClick="validateForm();">
	  <input type="submit" value="Submit" name="Submit">
	</td>
    <td>&nbsp;</td>
  </tr>
  </tbody>
</table>
</form>

</body>
</html>