// JavaScript Document

//Cycle auf der Startseite
//$(document).ready(function() {

//JQuery Hintergrundbild aufziehen
 $(function() {   
	   var theWindow        = $(window),
                            $bg              = $("#bg"),
                            aspectRatio      = $bg.width() / $bg.height();
                                                                
                        function resizeBg() {
                                
                                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                                    $bg
                                        .removeClass()
                                        .addClass('bgheight');
                                } else {
                                    $bg
                                        .removeClass()
                                        .addClass('bgwidth');
                                }
                                                        
                        }
                                                                
                        theWindow.resize(function() {
                                resizeBg();
                        }).trigger("resize");
                
                });
//JQuery Hintergrundbild aufziehen E N D E !

  
//Cycle auf der Startseite  
  $('.slideshow').cycle({
    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    timeout:       5000
  });

$('#s6').cycle({
    fx:     'fade',
    timeout: 5500,
	autostop:      1,     // true to end slideshow after X transitions (where X == slide count) 
    autostopCount: 2,     // number of transitions (optionally used with autostop to define X)
	containerResize: 1,   // resize container to fit largest slide 
});


function chkFormular () {
  if (document.kontaktform.name.value == "") {
    alert("Bitte geben Sie Ihren Namen an!");
    document.kontaktform.name.focus();
    return false;
  }

  if (document.kontaktform.name.value == "none") {
    alert("Bitte geben Sie Ihren Namen an!");
    document.kontaktform.name.focus();
    return false;
  }

  if (document.kontaktform.email.value == "") {
    alert("Bitte geben Sie eine gültige email an!");
    document.kontaktform.email.focus();
    return false;
  }
  
  if (document.kontaktform.email.value.indexOf("@") == -1) {
    alert("Bitte geben Sie eine gültige email an!");
    document.kontaktform.email.focus();
    return false;
  }
  if (document.kontaktform.message.value == "") {
    alert("Bitte geben Sie eine Nachricht ein!");
    document.kontaktform.message.focus();
    return false;
  }
}

// Gallerie laden
$(function() {
    var galleries = $('.ad-gallery').adGallery();
      });

//Impressums Overlay
$("a.overlayhtml").fancybox({
    'width'        : 750,
    'height'      :   600,
    'autoScale'       : false,
    'transitionIn'    : 'fade',
    'transitionOut'    : 'fade',
    'type'        : 'iframe'
  });
  
  // Rechtsklick unterbinden
      $(document).bind("contextmenu",function(e){
        return false;
    });
  
//}); // Document Ready ende

