// Speziellen Selektor für externe Links initialisieren
$.expr[':'].external = function(obj){
    return (!obj.href.match(/^javascript\:/) && (obj.hostname != location.hostname));
};

// Ready
$(document).ready(function(){
		
// Lightbox
// Basiert auf extension
// Anpassungsmöglichkeit greift nur, wenn "typo3temp" in der URL steht (um Links auf Seiten auszuschliessen )

$(".csc-textpic-imagewrap a,.news-single-img a").lightbox({
    fitToScreen: true,
	imageClickClose: false,
	disableNavbarLinks: true,
	fileBottomNavCloseImage: 'fileadmin/templates/velostationen/js/lightbox/images/closelabel.gif',
	strings : {
            prevLinkTitle: '&laquo;',
  			nextLinkTitle: '&raquo;',
  			prevLinkText:  '&laquo;',
  			nextLinkText:  '&raquo;',
  			closeTitle: 'x',
  			image: '',
  			of: ' / '
			}
		}); 
		    
// velostationen-submenu nur einblenden auf hover
$("#velostationen-menu #flyout").hide();  

// benötigt plugin "hoverIntent"
$("#velostationen-menu").hoverIntent(function() {
            $("#velostationen-menu #flyout").animate({height: "toggle", opacity: "toggle"});
        }, function() {
            $("#velostationen-menu #flyout").animate({height: "toggle", opacity: "toggle"});
        });
        

// tooltips für Karte
// plugin "jquery.qtip"

// By suppling no content attribute, the library uses each elements title attribute by default
   $('#content area[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      show: { delay: 50 },
      hide: { delay: 50 },
      position: {
          target: 'mouse',
          corner: {
             target: 'topLeft',
             tooltip: 'bottomLeft'
          }
      },
      style: { 
          'font-size': '0.9em',
          width: 200,
          padding: 10,
          background: '#202867',
          color: '#ffffff',
          textAlign: 'left',
          border: {
             width: 2,
             radius: 2,
             color: '#ffffff'
          },
          tip: 'bottomLeft',
          name: 'dark' // Inherit the rest of the attributes from the preset dark style
      }

   });
   
   // NOTE: You can even omit all options and simply replace the regular title tooltips like so:
   // $('#content a[href]').qtip();


    // external links in Tabelle highlighten
    $('table a:external').addClass('external-link-new-window');
    
});