$('#specialRequestForm').live('submit',function(){
  var requestData = $('#specialRequestForm').serialize();
  $.ajax({
      url: $(this).attr('action'),
      cache: false,
      async: false,
      type: "POST",
      data: requestData,
      success: function(responseText){
        $('#formContent').slideUp().fadeOut();
        $('#formMessage').append(responseText).slideDown();
        $('#requestContainer').animate({top:'300px',width:'-=150px',left:'+=75px'});
        $('#requestContainer').delay(3000).fadeOut(1000,function(){$(this).remove();});
      }
  });
  return false;
});


function closeRequestContainer(){
    $('#requestContainer').remove();
}

function calculate_packagerate() {
var packageprice='';
for (i = 0; i < document.hamburgreservationform.Vorstellung.length; ++i){
if (document.hamburgreservationform.Vorstellung.options[i].selected == true){




  if (document.hamburgreservationform.Vorstellung.options[i].value == 'vormittags'){
    for (j = 0; j < document.hamburgreservationform.Preiskategorie.length; ++j){
    if (document.hamburgreservationform.Preiskategorie.options[j].selected == true){

    for (k = 0; k < document.hamburgreservationform.Zimmertyp.length; ++k){
    if (document.hamburgreservationform.Zimmertyp.options[k].selected == true){

    for (l = 0; l < document.hamburgreservationform.Personenanzahl.length; ++l){
    if (document.hamburgreservationform.Personenanzahl.options[l].selected == true){


        if (document.hamburgreservationform.Preiskategorie.options[j].value == 'PK1'){
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'M'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='211 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='337 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'L'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='221 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='347 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'XL'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='231 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='357 €';
             }
          }
         }
        if (document.hamburgreservationform.Preiskategorie.options[j].value == 'PK2'){
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'M'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='199 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='313 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'L'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='209 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='323 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'XL'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='219 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='333 €';
             }
          }
         }
    }
    }
    }
    }
    }
    }
  } // vormittags




  if (document.hamburgreservationform.Vorstellung.options[i].value == 'abends'){
    for (j = 0; j < document.hamburgreservationform.Preiskategorie.length; ++j){
    if (document.hamburgreservationform.Preiskategorie.options[j].selected == true){

    for (k = 0; k < document.hamburgreservationform.Zimmertyp.length; ++k){
    if (document.hamburgreservationform.Zimmertyp.options[k].selected == true){

    for (l = 0; l < document.hamburgreservationform.Personenanzahl.length; ++l){
    if (document.hamburgreservationform.Personenanzahl.options[l].selected == true){


        if (document.hamburgreservationform.Preiskategorie.options[j].value == 'PK1'){
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'M'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='199 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='313 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'L'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='209 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='323 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'XL'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='219 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='333 €';
             }
          }
         }
        if (document.hamburgreservationform.Preiskategorie.options[j].value == 'PK2'){
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'M'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='188 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='291 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'L'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='198 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='301 €';
             }
          }
           if (document.hamburgreservationform.Zimmertyp.options[k].value == 'XL'){
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '1'){
              packageprice='208 €';
             }
             if (document.hamburgreservationform.Personenanzahl.options[l].value == '2'){
              packageprice='311 €';
             }
          }
         }
    }
    }
    }
    }
    }
    }
  } // abends
            
            
            
            
      }
  }

document.hamburgreservationform.Packagepreis.value = packageprice;
}

function openRequestContainer(){
  $.ajax({
      url: "/global/inc/requestContainer.php",
      cache: false,
      async: false,
      success: function(responseText){
          $('body').append(responseText);
        
      }
  });
  // alert('test');
}










function dom_init() {
  $("a.fancybox").fancybox();
  
  $("#subForm input:submit").click(function() {
    
    // First, disable the form from submitting
    $('form#subForm').submit(function() { return false; });
    
    // Grab form action
    var formAction = $("form#subForm").attr("action");
    
    // Hacking together id for email field
    // Replace the xxxxx below:
    // If your form action were http://mysiteaddress.createsend.com/t/r/s/abcde/, then you'd enter "abcde" below
    var id = "tklhdt";
    var emailId = id + "-" + id;
    
    // Validate email address with regex
    if (!checkEmail(emailId)) {
      alert("Bitte geben Sie eine E-Mail-Adresse ein.");
      return;
        }
        
        // Serialize form values to be submitted with POST
        var str = $("form#subForm").serialize();
      
      // Add form action to end of serialized data
      // CDATA is used to avoid validation errors
      //<![CDATA[
      var serialized = str + "&action=" + formAction;
      // ]]>
      
      // Submit the form via ajax
      $.ajax({
        url: "/global/inc/newsletterproxy.php",
        type: "POST",
        data: serialized,
        success: function(data){
          // Server-side validation
          if (data.search(/invalid/i) != -1) {
            alert('Die eingegebene E-Mail-Adresse scheint ungültig zu sein.');
          }
          else
          {
            $("#subForm").hide(); // If successfully submitted hides the form
            $("#confirmation").slideDown("slow");  // Shows "Thanks for subscribing" div
            $("#confirmation").tabIndex = -1;
            $("#confirmation").focus(); // For screen reader accessibility
            // Fire off Google Analytics fake pageview
            //var pageTracker = _gat._getTracker("UA-XXXXX-X");
            //pageTracker._trackPageview("/newsletter_signup");
          }
        }
      });
    });
    
  }
                                   
function showAllPictures(){
  $('.imageWallFrameWrapper').show();
  $('.morePicturesLink').hide(); 
}

function checkEmail(email) {
  var pattern = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  var emailVal = $("#eMailAddress").val();
  return pattern.test(emailVal);
}

function changeReservation(){
    $('#changeReservationForm').slideToggle();
}

