// function to verify number of days minimum for the holidays........

function checkholidays1(){



var startmonth=document.forms["Res_Form"]["CIM"].value;

var startday=document.forms["Res_Form"]["CID"].value;

var startyear=document.forms["Res_Form"]["CIY"].value;

var endmonth=document.forms["Res_Form"]["COM"].value;

var endday=document.forms["Res_Form"]["COD"].value;

var endyear=document.forms["Res_Form"]["COY"].value;



var thadate=startmonth+"/"+startday+"/"+startyear;

var thaenddate=endmonth+"/"+endday+"/"+endyear;



var DateDiff = {

 

    inDays: function(d1, d2) {

        var t2 = d2.getTime();

        var t1 = d1.getTime();

 

        return parseInt((t2-t1)/(24*3600*1000));

    }

 

   

}

 

var dString = thadate;

 

var d1 = new Date(thadate);

var d2 = new Date(thaenddate);

var thedifference=DateDiff.inDays(d1, d2);



// Diane, this is the section to change the date minimum here!!!!!!!/////////////////////////////

var normalmin=2;   // normal night min



var memorialmin=2;                               ////////////////////// memorial day night minimum

var julymin=2;                                   ///////////////////////////////////////////////////

var labormin=2;                                  ///////////////////////////////////////////////////

var thanksgivingmin=3;                           ///////////////////////////////////////////////////

var christmasmin=2;                              ///////////////////////////////////////////////////

var newyearsmin=2;                               ///////////////////////////////////////////////////

// ********************** first year parameters **************************************************  

var firstyear=2012;

var f_memorialstart=25;                             

var f_memorialend=28; 

var f_laborstart=01;                             

var f_laborend=03; 

var f_thanksgivingstart=21;                             

var f_thanksgivingend=24;

var f_newyearsstart=28;                             

var f_newyearsend=31; 





// *********************** next years parameters *************************************************

var nextyear=2013;

var n_memorialstart=26;                               ////////////////////// memorial day night minimum

var n_memorialend=29; 

var n_laborstart=31;                             

var n_laborend=02; 

var n_thanksgivingstart=26;                             

var n_thanksgivingend=29; 

var n_newyearsstart=29;                             

var n_newyearsend=01; 



/////////////////////////////////////////////////////////////////////////////////////////////////

// start with the current year that you have selected above called firstyear

if(startyear==firstyear){



 if((startmonth==01) && (endmonth<=04)){

 

 // normal 2 night min  //////////////////////////////////////////////////////////////////////////////////

    if((thedifference<normalmin) && (thedifference>=0)){

     var z= parseInt(endday)+1;

     if(z<10){

      var i="0"+z;

      } else {

     var i=z;

     }

   alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

  document.forms["Res_Form"]["COD"].value=i;

    }

	}

 // menorial day  /////////////////////////////////////////////////////////////////////////////////////////

  if((startmonth==05) && (endmonth==05)){

     if((endday>f_memorialstart && endday<f_memorialend) || (startday>f_memorialstart && startday<f_memorialend)){

	    if((thedifference<memorialmin) && (thedifference>0)){

		 var z= parseInt(endday)+1;

          if(z<10){

           var i="0"+z;

            } else {

             var i=z;

              }

               alert("You must stay for "+memorialmin+" nights minimum for Memorial Day. ");

	            document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		     if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+1;

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	

	// june month ////////////////////////////////////////////////////////////////////////////////////////

	 if((startmonth==06) && (endmonth==06)){

	   if((thedifference<normalmin) && (thedifference>=0)){

       var z= parseInt(endday)+1;

        if(z<10){

         var i="0"+z;

         } else {

         var i=z;

        }

      alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

    document.forms["Res_Form"]["COD"].value=i;

    }

	}

	

 // independence day july 4th ////////////////////////////////////////////////////////////////////////////////////

   if((startmonth==07) && (endmonth==07)){

     if((endday>2 && endday<5) || (startday>2 && startday<5)){

	  if((thedifference<julymin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("You must stay for "+julymin+" nights minimum for Independence Day. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		       if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}



 

 // labor day /////////////////////////////////////////////////////////////////////////////////////////////////

 if((startmonth==08) || (endmonth==09)){

      if((endday>f_laborstart && endday<f_laborend) || (startday>=f_laborstart && startday<f_laborend)){

	  if((thedifference<labormin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("You must stay for "+labormin+" nights minimum for Labor Day. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		       if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	// october filler ////////////////////////////////////////////////////////////////////////////////////////////////

	 if((startmonth==10) && (endmonth==10)){

	   if((thedifference<normalmin) && (thedifference>=0)){

       var z= parseInt(endday)+1;

        if(z<10){

         var i="0"+z;

         } else {

         var i=z;

        }

      alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

    document.forms["Res_Form"]["COD"].value=i;

    }

	}

	

 // thanksgiving ///////////////////////////////////////////////////////////////////////////////////////////////////

   if((startmonth==11) && (endmonth==11)){

     if((endday>f_thanksgivingstart && endday<f_thanksgivingend) || (startday>f_thanksgivingstart && startday<f_thanksgivingend)){

	   if((thedifference<thanksgivingmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("A "+thanksgivingmin+" night stay is required for Thanksgiving holiday. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		      if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum stay for this time period. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

 // christmas ////////////////////////////////////////////////////////////////////////////////////////////////////

   if((startmonth==12) && (endmonth==12)){

    if((endday>23 && endday<26) || (startday>23 && startday<26)){

	   if((thedifference<christmasmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("A "+christmasmin+" night stay is required for the Christmas Holidays. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		      if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a  "+normalmin+" night minumum stay for this time period. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

 // new  years ////////////////////////////////////////////////////////////////////////////////////////////////////

  if((startmonth==12) && (endmonth==12)){

     if((endday>f_newyearsstart && endday<f_newyearsend) || (startday>f_newyearsstart && startday<f_newyearsend)){

	   if((thedifference<newyearsmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("A "+newyearsmin+" night stay is required for New Years Holiday. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		     if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a  "+normalmin+" night minumum stay , you have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	} // ***** end the first years validation and start with the nextyears ******************************************

	if(startyear==nextyear){



 if((startmonth==01) && (endmonth<=04)){

 

 // normal 2 night min  //////////////////////////////////////////////////////////////////////////////////

    if((thedifference<normalmin) && (thedifference>=0)){

     var z= parseInt(endday)+1;

     if(z<10){

      var i="0"+z;

      } else {

     var i=z;

     }

   alert("There is a "+normalmin+" night minimum, you have selected: "+thedifference+" night");

  document.forms["Res_Form"]["COD"].value=i;

    }

	}

 // menorial day  /////////////////////////////////////////////////////////////////////////////////////////

  if((startmonth==05) && (endmonth==05)){

         if((endday>n_memorialstart && endday<n_memorialend) || (startday>n_memorialstart && startday<n_memorialend)){

	    if((thedifference<memorialmin) && (thedifference>0)){

         var z= parseInt(endday)+1;

          if(z<10){

           var i="0"+z;

            } else {

             var i=z;

              }

               alert("There is a "+memorialmin+" night stay minimum for Memorial Day. ");

	            document.forms["Res_Form"]["COD"].value=i;

	        }

		       } else {

		     if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+1;

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night stay minimum, you have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	

	// june month ////////////////////////////////////////////////////////////////////////////////////////

	 if((startmonth==06) && (endmonth==06)){

	   if((thedifference<normalmin) && (thedifference>=0)){

       var z= parseInt(endday)+1;

        if(z<10){

         var i="0"+z;

         } else {

         var i=z;

        }

      alert("There is a "+normalmin+" night stay minimum, you have selected: "+thedifference+" night");

    document.forms["Res_Form"]["COD"].value=i;

    }

	}

	

 // independence day july 4th /////////////////////////////////////////////////////////////////////////////

   if((startmonth==07) && (endmonth==07)){

     if((endday>2 && endday<5) || (startday>2 && startday<5)){

	  if((thedifference<julymin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("There is a "+julymin+" night minimum stay for Independence Day holiday. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		       if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum stay required. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}



 

 // labor day ////////////////////////////////////////////////////////////////////////////////////////////

 if((startmonth==08) || (endmonth==09)){

       if((endday>n_laborstart && endday<n_laborend) || (startday>=n_laborstart && startday<n_laborend)){

	  if((thedifference<labormin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("There is a "+labormin+" night minimum stay required for Labor Day holiday. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		       if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum stay required. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	// october filler ////////////////////////////////////////////////////////////////////////////////////////////////

	 if((startmonth==10) && (endmonth==10)){

	   if((thedifference<normalmin) && (thedifference>=0)){

       var z= parseInt(endday)+1;

        if(z<10){

         var i="0"+z;

         } else {

         var i=z;

        }

      alert("There is a "+normalmin+" night minimum stay required. You have selected: "+thedifference+" night");

    document.forms["Res_Form"]["COD"].value=i;

    }

	}

	

 // thanksgiving ///////////////////////////////////////////////////////////////////////////////////////////////////

   if((startmonth==11) && (endmonth==11)){

    if((endday>n_thanksgivingstart && endday<n_thanksgivingend) || (startday>n_thanksgivingstart && startday<n_thanksgivingend)){

	   if((thedifference<thanksgivingmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("There is a "+thanksgivingmin+" night minimum stay required for Thanksgiving Day holiday. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		      if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a "+normalmin+" night minimum stay required. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

 // christmas ////////////////////////////////////////////////////////////////////////////////////////////////////

   if((startmonth==12) && (endmonth==12)){

    if((endday>23 && endday<26) || (startday>23 && startday<26)){

	   if((thedifference<christmasmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("There is a "+christmasmin+" night minimim stay required for Christmas Holidays. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		      if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("There is a  "+normalmin+" night minimum stay required.You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

 // new  years /////////////////////////////////////////////////////////////////////////////////////////////////

  if((startmonth==12) && (endmonth==12)){

    if((endday>n_newyearsstart && endday<n_newyearsend) || (startday>n_newyearsstart && startday<n_newyearsend)){

	   if((thedifference<newyearsmin) && (thedifference>0)){

	    var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

            var i="0"+z;

             } else {

              var i=z;

               }

                alert("A "+newyearsmin+" night minimum stay is required for New Years Holidays. ");

	             document.forms["Res_Form"]["COD"].value=i;

	             }

		       } else {

		     if((thedifference<normalmin) && (thedifference>=0)){

             var z= parseInt(endday)+parseInt(thedifference);

           if(z<10){

          var i="0"+z;

         } else {

        var i=z;

        }

      alert("A"+normalmin+" night minimum stay is required. You have selected: "+thedifference+" night");

   

    document.forms["Res_Form"]["COD"].value=i;

    }}}

	} // end the next years validation ////////////////////////////////////////////////////////////////////////////////

}  

                                              


