yas = function() {}

yas.init = function() {
    jQuery("a.maillink").lmmail();
};

jQuery.fn.lmmail = function( settings ) {
    settings = jQuery.extend({
        link: true
    }, settings);
    var regex = /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]{2,6})\b/gi;
    return this.each(function() {
        if ( $(this).is('a[@href]') ) {
            // If it's an <a> element, defuscate the href attribute
            $(this).attr('href', $(this).attr('href').replace(regex, '$1@$2'));
            // Make sure that the element's contents is not made into a link
            var is_link = true;
        }
        // Defuscate the element's contents
        $(this).html($(this).html().replace(regex, (settings.link && !is_link ? '<a href="mailto:$1@$2">$1@$2</a>' : '$1@$2')));
  });
};

// Global init
jQuery(document).ready(function() {
    yas.init();
});

function mapKursort() {
    var mapOptions = {
        zoom: 17,
        mapTypeId: google.maps.MapTypeId.HYBRID,
        overviewMapControl: true,
        overviewMapControlOptions: {
            opened: true
        }
    };
    var shop = {
        'title'  : 'Kursort',
        'address': 'Hauptstr. 175, Ermatingen',
        'coords': {
            'lat': 47.6676691,
            'lng': 9.0879523
        }
    };

    // Map
    var map = new google.maps.Map($mapCt.get(0), mapOptions);
    var shopLocation = new google.maps.LatLng(shop.coords.lat, shop.coords.lng);
    map.setCenter(shopLocation);

    // Info Window, Marker
    var infoWindow = new google.maps.InfoWindow({
        content: '<strong>' + shop.title + '</strong><br />' + shop.address
    });
    var marker = new google.maps.Marker({
        position: shopLocation,
        map     : map,
        title   : shop.title
    });
    infoWindow.open(map, marker);
    google.maps.event.addListener(marker, 'click', function() {
      infoWindow.open(map, marker);
    });
};

