$(document).ready(function() {
	
	// Mouseover Effect für Bilder mit Hyperlinks
	$('a img').not('#logo img, .loupe, .home-teaser-img a img').mouseover(function() {
		$(this).stop(true, true).fadeTo(250, 0.8); 
	}).mouseout(function(){
		$(this).stop(true, true).fadeTo(100, 1); 
	});
	
	
	
	// Startseite Teaser
	//$('#home-teaser').cycle('fade');

	$('#home-teaser').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 5000, 
		pager:  '#home-teaser-nav', 
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#"><img src="_img/home-teaser-page-dot.png" height="7" width="7" /></a>'; 
		} 
	});
	
	
	/* ------------------------------------------------------------------------------------------ */
	// Newsletter Anmelde Formular Validate
	
	if($("#newsletter-anmeldung-form").length > 0){
		$("#newsletter-anmeldung-submit").mouseover(function() {
			$(this).addClass('hover');
		}).mouseout(function(){
			$(this).removeClass('hover');
		});
		$("#newsletter-anmeldung-form").validate({
			rules: {
				name: {
					required: true,
					minlength: 2
				},
				vorname: {
					required: false,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				},
				kommentar: {
					required: false
				}
			}
		});
	}
	/*
	if($("#newsletter-anmeldung-form").length > 0){
		$("#newsletter-anmeldung-form").validate({
			rules: {
				name: {
					required: true,
					minlength: 2
				},
				vorname: {
					required: false,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				},
				kommentar: {
					required: false
				}
			},
			messages: {
				name: {
					required: "Geben Sie bitte Ihre Nachname ein.",
					minlength: "Your username must consist of at least 2 characters"
				},
				vorname: {
					required: "Geben Sie bitte Ihre Vorname ein.",
					minlength: "Your username must consist of at least 2 characters"
				},
				email: "Geben Sie bitte eine gültige E-Mail Adresse ein.",
				kommentar: "Please accept our policy"
			}
		});
	}
	*/
	/* ------------------------------------------------------------------------------------------ */
});





// gmap
function initializeGmap(gMapLat,gMapLng,gMapZoom,gMapElementId,gMapImage){
	var latlng = new google.maps.LatLng(gMapLat,gMapLng);
	var myOptions = {
		zoom: gMapZoom,
		center: latlng,
		mapTypeControl: true,
		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT},
		navigationControl: true,
		navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById(gMapElementId), myOptions);
	var image = gMapImage;
	var spotMarker = new google.maps.Marker({
		position: latlng,
		map: map,
		icon: image
	});
}
