
      function isDate (d,m,y) {        
        var myDate = new Date();
        
        myDate.setFullYear( y,m,d );

        if ( myDate.getMonth() != m ) {
          return false;
        } else {
          return true;
        }
      }
      

      function CheckEmailAddress( form ){
        if ( form.email.value != '' ){
          re = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}/;
          if (!re.test(form.email.value)){
            alert('Email address you filled out can not exist!');
            return false;
          } else {
            return true;
          }
        } else {
          alert('Email address must be filled out!');
          return false;
        }
      }

      function ValidateEmailAddress( email ){
        if ( email.value != '' ){
          re = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}/;
          if (!re.test(email.value)){
            return false;
          } else {
            return true;
          }
        } else {
          return false;
        }
      }

      function CheckForm(form){
        if (form.name.value != ""){
          return true;
        }
        window.alert('Field "name" must be filled out!');
        return false;
      }

      function DeleteConfirm(){
        return window.confirm('Are you sure you want to delete this menu item?');
      }

      function DeleteDataConfirm(){
        return window.confirm('Are you sure you want to delete this database item?');
      }

      function DeleteRefConfirm(){
        return window.confirm('Are you sure you want to delete this reference?');
      }

      function ConfirmDeleteTestimonil(){
        return window.confirm('Are you sure you want to delete this testimonial?');
      }

      function CheckAccomodationForm( form ){
        if ( form.first_name.value == '' ){
          alert('First name must be filled out!');
          return false;
        }
        if ( form.last_name.value == '' ){
          alert('Last name must be filled out!');
          return false;
        }
        if ( !ValidateEmailAddress( form.email )){
          alert('The email address can not exist!');
          return false;
        }
        if ( form.country.value == '' ){
          alert('Country of origin must be filled out!');
          return false;
        }
        if (!isDate(form.arrival_day.value,form.arrival_month.value,form.arrival_year.value)){
          alert('The arrival date can not exists!');
          return false;
        }
        if (!isDate(form.departue_day.value,form.departue_month.value,form.departue_year.value)){
          alert('The departue date can not exists!');
          return false;
        }
        if ( (form.departue_year.value < form.arrival_year.value)
           ||(form.departue_year.value == form.arrival_year.value && form.departue_month.value < form.arrival_month.value)
           ||(form.departue_month.value == form.arrival_month.value && form.departue_day.value < form.arrival_day.value) ){
          alert('Wrong arrival and departue dates - arrival date is later than departue date!');
          return false;
        }
        return confirm('Are you sure you want to send your accomodation email request?');
      }

      function CheckCarRentalForm( form ){
        if ( form.first_name.value == '' ){
          alert('First name must be filled out!');
          return false;
        }
        if ( form.last_name.value == '' ){
          alert('Last name must be filled out!');
          return false;
        }
        if ( !ValidateEmailAddress( form.email )){
          alert('The email address can not exist!');
          return false;
        }
        if ( form.country.value == '' ){
          alert('Country of origin must be filled out!');
          return false;
        }
        if (!isDate(form.pick_up_day.value,form.pick_up_month.value,form.pick_up_year.value)){
          alert('The pick up date can not exists!');
          return false;
        }
        if (!isDate(form.drop_off_day.value,form.drop_off_month.value,form.drop_off_year.value)){
          alert('The drop off date can not exists!');
          return false;
        }
        if ( (form.drop_off_year.value < form.pick_up_year.value)
           ||(form.drop_off_year.value == form.pick_up_year.value && form.drop_off_month.value < form.pick_up_month.value)
           ||(form.drop_off_month.value == form.pick_up_month.value && form.drop_off_day.value < form.pick_up_day.value) ){
          alert('Wrong pick up and drop off dates - pick up date is later than drop off date!');
          return false;
        }
        return confirm('Are you sure you want to send your car rental email request?');
      }

      function CheckTakeAGuidedTourForm( form ){
        if ( form.first_name.value == '' ){
          alert('First name must be filled out!');
          return false;
        }
        if ( form.last_name.value == '' ){
          alert('Last name must be filled out!');
          return false;
        }
        if ( !ValidateEmailAddress( form.email )){
          alert('The email address can not exist!');
          return false;
        }
        if ( form.country.value == '' ){
          alert('Country of origin must be filled out!');
          return false;
        }
        if (!isDate(form.day.value,form.month.value,form.year.value)){
          alert('The date can not exists!');
          return false;
        }
        return confirm('Are you sure you want to send your guided tour email request?');
      }

      function CheckOutdoorActivityForm( form ){
        if ( form.first_name.value == '' ){
          alert('First name must be filled out!');
          return false;
        }
        if ( form.last_name.value == '' ){
          alert('Last name must be filled out!');
          return false;
        }
        if ( !ValidateEmailAddress( form.email )){
          alert('The email address can not exist!');
          return false;
        }
        if ( form.country.value == '' ){
          alert('Country of origin must be filled out!');
          return false;
        }
        if (!isDate(form.day.value,form.month.value,form.year.value)){
          alert('The date can not exists!');
          return false;
        }
        return confirm('Are you sure you want to send your outdoor activity email request?');
      }

      function CheckTellAFriendForm( form ){
        if ( !ValidateEmailAddress(form.email_from) ){
          alert('Your email address can not exist!');
          return false;
        }
        if ( !ValidateEmailAddress(form.email) ){
          alert('E-mail address of your friend can not exist!');
          return false;
        }
        return true;
      }

      function CheckContactEmailForm( form ){
        if ( !ValidateEmailAddress(form.your_email) ){
          alert('Your email address can not exist!');
          return false;
        }
        if ( form.question.value == '' ){
          alert('You have not filled out any question!');
          return false
        }
        return true;
      }

      function AddLinkClick( form ){
        link_text = prompt('Add link','here you can write text of link');
        link = prompt('Add link','here you can write link including http:// header');
        if (link != '' && link != null && link_text != '' && link_text != null){
          form.text.value = form.text.value + '<a href="' + link +'" target="_blank" class="refitem">' + link_text + '</a>';
        }
        return true;
      }


