jQuery.noConflict();
jQuery(document).ready(function($) {
	if($('#HeaderSearchBox input[name=tx_indexedsearch\\[sword\\]]').length) {
		$('#HeaderSearchBox input[name=tx_indexedsearch\\[sword\\]]').autocomplete({
			source: '/index.php?eID=dwautocomplete',
			minLength: 2
		}).focus(function() {
			if($(this).val() == 'Suche') {
				$(this).val('');
			}
		});
	}
	if($('#socialshare').length) {
		$('#socialshare').socialSharePrivacy({
			'services': {
				'facebook': {
					'status': 'on',
					'app_id': '210626775666338',
					'txt_info' : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen.',
					'dummy_img': 'fileadmin/templates/gfx/socialshareprivacy/dummy_facebook.png',
					'perma_option': 'off'
				},
				'twitter': {
					'status': 'off',
					'perma_option': 'off'
				},
				'gplus': {
					'status': 'on',
					'dummy_img': 'fileadmin/templates/gfx/socialshareprivacy/dummy_gplus.png',
					'txt_info' : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen.',
					'perma_option': 'off'
				}
			},
			'css_path': 'fileadmin/templates/css/socialshareprivacy.css'
		});
	}
	if($('#headerImageContainer').length) {
		$('#hSlider').dwSlider();
	};
});

var waitForFinalEvent = (function () {
  var timers = {};
  return function (callback, ms, uniqueId) {
    if (!uniqueId) {
      uniqueId = "Don't call this twice without a uniqueId";
    }
    if (timers[uniqueId]) {
      clearTimeout (timers[uniqueId]);
    }
    timers[uniqueId] = setTimeout(callback, ms);
  };
})();
