/**
*	Site-specific configuration settings for Highslide JS
*/
hs.graphicsDir = '/js/highslide/graphics/';
hs.showCredits = false;
hs.outlineType = 'custom';
hs.dimmingOpacity = 0.75;
hs.dimmingDuration = 100;
hs.align = 'center';
hs.marginBottom = 110;
hs.allowMultipleInstances = false;
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Schließen"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});



// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'gallery',
	interval: 3000,
	repeat: true,
	useControls: true,
	fixedControls: false,
	overlayOptions: {
		opacity: '0.90',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '-62',
		relativeTo: 'viewport',
		hideOnMouseOut: false
	},
	thumbstrip: {
		mode: 'horizontal',
		position: 'bottom center',
		relativeTo: 'viewport'
	}

});

// German language strings
hs.lang = {
	cssDirection: 'ltr',
	loadingText: 'Lade...',
	loadingTitle: 'Klick zum Abbrechen',
	focusTitle: 'Klick um nach vorn zu bringen',
	fullExpandTitle: 'Zur Originalgröße erweitern',
	creditsText: 'Powered by <i>Highslide JS</i>',
	creditsTitle: 'Gehe zur Highslide JS Homepage',
	previousText: 'Voriges',
	nextText: 'Nächstes',
	moveText: 'Verschieben',
	closeText: 'Schließen',
	closeTitle: 'Schließen (Esc)',
	resizeTitle: 'Größe wiederherstellen',
	playText: 'Abspielen',
	playTitle: 'Slideshow abspielen (Leertaste)',
	pauseText: 'Pause',
	pauseTitle: 'Pausiere Slideshow (Leertaste)',
	previousTitle: 'Voriges (Pfeiltaste links)',
	nextTitle: 'Nächstes (Pfeiltaste rechts)',
	moveTitle: 'Verschieben',
	fullExpandText: 'Vollbild',
	number: 'Bild %1 von %2',
	restoreTitle: 'Klick um das Bild zu schließen, klick und ziehe um zu verschieben. Benutze Pfeiltasten für vor und zurück.'
};

// gallery config object
var gallery = {
	slideshowGroup: 'gallery',
	transitions: ['expand', 'crossfade']
};

hs.Expander.prototype.onInit = function() {
	hs.marginBottom = (this.slideshowGroup == 'gallery') ? 110 : 10;
}

function submitToHighslide(form) {
/* alert('d'+$(id)); */
  // identify the submit button to start the animation from

  var anchor;
  for (var i = 0; i < form.elements.length; i++) {
  	if (form.elements[i].type == 'button') {
		  anchor = form.elements[i];
		  break;
	  }
	}

	// open an expander and submit our form when the iframe is ready
	hs.overrides.push('onAfterExpand');
	hs.htmlExpand(anchor, {
		objectType: 'iframe',
		src: 'about:blank',
		width: 625,
		height: 380,
		objectHeight: 355,
		onAfterExpand: function(expander) {
			form.target = expander.iframe.name;
			form.submit();
		}
	});

	// return false to delay the sumbit until the iframe is ready
	return false;
}

$().ready(function($){
  $('.index-content,.main-index-content').each(function() {
    if (!$(this).hasClass('no-link') && $('a').attr('href').search('ajax_overlay') == -1) {
      if ($('a', $(this)).attr('href')) {
        if ($('#fb').length < 1) {
          $('img,h2', this).css('cursor', 'pointer');
          $('img,h2', this).bind('click', function() {
/*           window.open($('a', $(this).parent()).attr('href')); */
/*           else window.location.href = $('a', $(this).parent()).attr('href'); */
            window.location.href = $('a', $(this).parent()).attr('href');
          });
        }
      }
    }
  });
});
