try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


function changeImage() {
	var targetObject = $(".header_img img:visible + img");
	targetObject = targetObject.size() > 0 ? targetObject : $(".header_img img:first");
	var otherObjects = $(".header_img img:visible");
	targetObject.css({
		zIndex: 100
	}).fadeIn(1000, function() {
		targetObject.css({zIndex: 50});
		otherObjects.css({zIndex: 50});
		otherObjects.hide();
	});
}

jQuery(document).ready(function(){
	$(".rundschreiben").accordion({
		active: false,
		animated: 'slide',
		autoHeight: false,
		clearStyle: false,
		collapsible: true,
		event: "",
		fillSpace: false,
		header: ".acchead",
		icons: {
			header: "ui-icon-triangle-1-e",
			headerSelected: "ui-icon-triangle-1-s"
		},
		navigation: false,
		navigationFilter: function(){
			return this.href.toLowerCase() == location.href.toLowerCase();
		}
	})
	$(".rundschreiben .drei a").click(function() {
		$(".rundschreiben").accordion( 'activate' , $(this).parent().parent());
		$(this).parent().parent().blur();
		return false;
	})

	$(".accordion").accordion({
		active: ".box_head.active",
		animated: 'slide',
		autoHeight: false,
		clearStyle: false,
		collapsible: false,
		event: "mouseenter",
		fillSpace: false,
		header: ".box_head",
		icons: {
			header: "ui-icon-triangle-1-e",
			headerSelected: "ui-icon-triangle-1-s"
		},
		navigation: false,
		navigationFilter: function(){
			return this.href.toLowerCase() == location.href.toLowerCase();
		}
	})

	$(".partner_details > div").css({display: "none"});
	$(".partner_liste a.image.bubble").mouseenter(function(){
		$(".vita_blase").stop(true,true).hide();
		var id = this.href.match(/#(.+)$/)[0];
		var bubble = $(id);
		var height = bubble.height();
		var position = $(this).parent().position();
		bubble.css({
			position: "absolute",
			top: position.top - height + 10,
			left: position.left + 18
		});
		bubble.fadeIn("fast");
		bubble.effect('scrollview', {}, 1000);
	}).mouseleave(function(){
		var bubble = $(this.href.match(/#(.+)$/)[0]);
		bubble.fadeOut("fast");
	}).click(function(){
		return false;
	});

	$(".karriere_tabs").tabs({
		ajaxOptions: null,
		cache: false,
		cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
		collapsible: false,
		disabled: [],
		event: 'mouseenter',
		idPrefix: 'ui-tabs-',
		panelTemplate: '<div></div>',
		spinner: '<em>Loading&#8230;</em>',
		tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
	})
	if ($(".header_img img").size() > 1) {
		setInterval('changeImage()', 5000);
	}

	$(".accordion .box_head").focus(function() {
		this.blur();
	})

	$(".accordion .box_head, .box_foto, .box_top_ausgezeichnet").click(function() {
		var link = null;
		try {
			link = $("a:first",this).get(0).href;
		}
		catch (e) {}
		var target = $("a:first",this).attr("target")
		if (link) {
			if (target) {
				window.open(link);
			}
			else {
				window.location.href = link;
			}
			return false;
		}
	}).css({
		'cursor': 'pointer'
	});

	$("div.scroller").scrollable({
			size: 4,
			vertical: false,
			speed: 400,
			keyboard: true,
			keyboardSteps: null,
			disabledClass: 'disabled',
			hoverClass: null,
			clickable: true,
			activeClass: 'active',
			easing: 'swing',
			loop: false,
			items: '.bilder div',
			item: null,
			prev: null,
			next: null,
			prevPage: '.zurueck',
			nextPage: '.weiter',
			api: false
		}).navigator({
			navi: '.scrollnavi',
			naviItem: null,
			activeClass: 'active',
			indexed: false,
			api: false,
			idPrefix: null
		}).mousewheel({
			api: false,
			speed: 50
		});
		$("div.scrollnavi").css({
			left: '50%',
			marginLeft: -$("div.scrollnavi").width() / 2
		})
		$(".scroller_details > div").css({display: "none"});
		$(".scroller a.image.bubble").mouseenter(function(){
			$(".scroller_blase").stop(true,true).hide();
			var id = this.href.match(/#(.+)$/)[0];
			var bubble = $(id);
			var height = bubble.height();
			var position = $(this).parent().position();
			var parentposition = $(this).parent().parent().position();
			bubble.css({
				position: "absolute",
				top: position.top - height + 10,
				left: position.left + parentposition.left
			});
			bubble.fadeIn("fast");
			bubble.effect('scrollview', {}, 1000);
		}).mouseleave(function(){
			var bubble = $(this.href.match(/#(.+)$/)[0]);
			bubble.fadeOut("fast");
		}).click(function(){
			return false;
		});

	$("a[target=popup]").fancybox({
		padding				:	10,
		margin				:	20,
		opacity				:	false,
		modal				:	false,
		cyclic				:	false,
		scrolling			:	'auto',	// 'auto', 'yes' or 'no'

		width				:	560,
		height				:	340,

		autoScale			:	true,
		autoDimensions		:	true,
		centerOnScroll		:	false,

		ajax				:	{},
		swf					:	{ wmode: 'transparent' },

		hideOnOverlayClick	:	true,
		hideOnContentClick	:	false,

		overlayShow			:	true,
		overlayOpacity		:	0.5,
		overlayColor		:	'#000',

		titleShow			:	true,
		titlePosition		:	'inside',	// 'outside', 'inside' or 'over'
		titleFormat			:	null,

		transitionIn		:	'fade',	// 'elastic', 'fade' or 'none'
		transitionOut		:	'fade',	// 'elastic', 'fade' or 'none'

		speedIn				:	300,
		speedOut			:	300,

		changeSpeed			:	300,
		changeFade			:	'fast',

		easingIn			:	'swing',
		easingOut			:	'swing',

		showCloseButton		:	true,
		showNavArrows		:	true,
		enableEscapeButton	:	true,

		onStart				:	null,
		onCancel			:	null,
		onComplete			:	null,
		onCleanup			:	null,
		onClosed			:	null
	});


});
