$(document).ready(function() {
  
  

  // blendet bei text im suchfeld das hintergrundbild aus bzw bei leerem feld wieder ein
  $(".searchbar").keypress(function() {
    $(".searchbar").addClass("searchentry");
  });
  $(".searchbar").blur(function() {
    if ($(this).val() == ""){
      $(".searchbar").removeClass("searchentry"); 
    }    
  });
  
  /* This is basic - uses default settings 
     Fanybox einstellungen */
  $("a#single_image").fancybox();

  $("a#i-login").fancybox({
    'width'             : 390,
    'height'            : 213,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
      });
    
    $("a#i-kontakt").fancybox({
    'width'             : 380,
    'height'            : 530,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
  });
  
  $("a#i-gallery").fancybox({
    'width'             : 700,
    'height'            : 460,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
  });
  
  $("a.i-product1").fancybox({
    'width'             : 580,
    'height'            : 300,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
  });
    $("a.i-product2").fancybox({
    'width'             : 580,
    'height'            : 370,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
  });
      $("a.i-product3").fancybox({
    'width'             : 580,
    'height'            : 535,
    'padding'           : 0,
    'autoScale'         : false,
    'autoDimensions'    : false,
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'type'              : 'iframe'
  });
  
  
 // $.fancybox.center();

  /* Sucheingabe mit Ajax überprüfen */
  var status;$('#suche').submit(function() {
    $("#search_tooltip").remove();
    $.ajax({
      type: "POST",
      url: "/suchauflistung.htm",
      async: false,
      data: ({camesisAjax:'ajUserSearch', suchstring:$('#plz').val()}),
      success: function(data){
        if(data == 1) {
          status = 1;
        }
        else {
          $("#search").append(data);
          var h = $("#search_tooltip").height();
          h = 0 - h + 76;
          $("#search_tooltip").css("top",h);
          $("#search_tooltip").css("display","none");
          $("#search_tooltip").fadeIn(200);
          status = 0;
          setTimeout(function() { 
            $('#search_tooltip').fadeOut('fast'); 
          }, 5000);
        } 
      }
    });
    if(status == 0) {
      return false;
    }
  });
  $("body").click(function() {
    $("#search_tooltip").fadeOut(200);
  });
  
});

function abbruch() {
  parent.$.fancybox.close();
}









































