jQuery(document).ready(function()
					   {
						   writein = false;
						   // adds class to body. usefull for hiding elements
						   $('body').addClass('js-active');
						   // templatepath
						   var tPath = 'fileadmin/template/';
						   var baseHref = $('base').attr('href');
						   var lang = $('html').attr('lang');

						   /*
							* Sets input value empty on focus and refills it with the original value
							* if it is empty on focusout
							*
							**/
						   $('.clear-value').each(function()
												  {
													  var inputVal = $(this).attr('value');
													  var fontColor = $(this).css('color');
													  var fontStyle = $(this).css('font-style');
													  $(this).bind({
																	   focusin: function()
																	   {
																		   if ($(this).attr('value') == inputVal)
																		   {
																			   $(this).attr('value', '').css({
																												 'font-style': 'normal',
																												 'color': '#000'
																											 });
																		   }
																	   },
																	   focusout: function()
																	   {
																		   if ($(this).attr('value') == '')
																		   {
																			   $(this).css({'color': fontColor, 'font-style': fontStyle}).attr('value',
																																			   inputVal);
																		   }
																	   }
																   });
												  });

						   // slide teaser
						   $('.teaser-slide-elements').before('<a href="#" class="teaser-slide-prev"><img src="' + tPath
																	  + 'img/btn_sliderLeft.png" alt="" /></a><a href="#" class="teaser-slide-next"><img src="'
																	  + tPath + 'img/btn_sliderRight.png" alt="" /></a>')
								   .cycle({
											  fx:			'scrollHorz',
											  prev:		'.teaser-slide-prev',
											  next:		'.teaser-slide-next',
											  timeout:	7000
										  });

						   // news accordion
						   $('.news-latest-container').accordion({
																	 event: 'mouseover'
																 });

						   // readoptions
						   $('#link-readoptions').click(function()
														{
															$('#readoptions').slideToggle();
														});
						   $('#link-readpage').click(function()
													 {
														 $('#readspeaker_button1 a').trigger('click');
													 })

						   var contrastClicked = 0;
						   $('#link-contrast').click(function()
													 {
														 contrastClicked++;
														 if (contrastClicked > 1)
														 {
															 $('#css-contrast').detach();
															 contrastClicked = 0;
														 }
														 else
														 {
															 var link = $("<link>");
															 link.attr({
																		   id: 'css-contrast',
																		   type: 'text/css',
																		   rel: 'stylesheet',
																		   href: baseHref + 'fileadmin/template/css/contrast.css'
																	   });
															 $("head").append(link);
														 }
													 });

						   // font size
						   var originalfontSize = $('body').css('font-size');
						   // reset font size
						   $('.font-size-normal').click(function()
														{
															$('body').css('font-size', originalfontSize);
															$('#font-size a.active').removeClass('active');
															$(this).addClass('active');
														});
						   $('.font-size-small').click(function()
													   {
														   var currentFontSize = $('body').css('font-size');
														   var currentFontSizeNum = parseFloat(currentFontSize, 10);
														   var newFontSize = currentFontSizeNum * 0.9;
														   if (newFontSize < 10)
														   {
															   return false;
														   }
														   else
														   {
															   $('body').css('font-size', newFontSize);
															   $('#font-size a.active').removeClass('active');
															   $(this).addClass('active');
														   }
													   });
						   $('.font-size-big').click(function()
													 {
														 var currentFontSize = $('body').css('font-size');
														 var currentFontSizeNum = parseFloat(currentFontSize, 10);
														 var newFontSize = currentFontSizeNum * 1.1;
														 if (newFontSize > 16)
														 {
															 return false;
														 }
														 else
														 {
															 $('body').css('font-size', newFontSize);
															 $('#font-size a.active').removeClass('active');
															 $(this).addClass('active');
														 }
													 });

						   // detect ie 6
						   var ie6 = false;
						   if ($.browser.msie && parseInt($.browser.version) == 6)
						   {
							   ie6 = true;
						   }

						   // mainnavi dropdown
						   var cssHeight = 'min-height';
						   var initialHeight = 0;
						   if (ie6 == true)
						   {
							   cssHeight = 'height';
							   initialHeight = 'auto';
						   }
						   $('.navi-dropdown li:has(div)').hover(
								   function()
								   {
									   var heightInfoBox = $(this).find('div').height() + 10
									   $('.navi-dropdown').width(328).css(cssHeight, heightInfoBox);
								   },
								   function()
								   {
									   $('.navi-dropdown').width(165).css(cssHeight, initialHeight);
								   }
						   );

						   // doc readSpeaker
						   var readSpeakListen = "Anh&ouml;ren";
						   var readSpeakTitle = "";
						   var rsLang = "de_de";
						   if (lang == 'en')
						   {
							   readSpeakListen = "Listen";
							   readSpeakTitle = "&Ouml;ffnen Sie dieses Dokument mit ReadSpeaker docReader";
							   rsLang = "en_us";
						   }

						   $('.pdfdownload, .docdownload, .fertigformular').each(function()
																				 {
																					 var href = $(this).attr('href');
																					 if (href)
																					 {
																						 var readSpeakLink = '<a href="http://docreader.readspeaker.com/docreader/?cid=bqppm&amp;lang='
																													 + rsLang + '&amp;url=' + baseHref
																													 + href
																													 + '" onclick="window.open(this.href); return false;" target="_blank" title="'
																													 + readSpeakTitle
																													 + '" class="link-readspeak"><img src="'
																													 + tPath
																													 + 'img/icon_SpeakerSmall.gif" alt="'
																													 + readSpeakListen + '" /></a>';
																						 //if link points to an external page
																						 if (href.match('http://*') || href.match('https://*'))
																						 {
																							 readSpeakLink = '<a href="http://docreader.readspeaker.com/docreader/?cid=bqppm&amp;lang='
																													 + rsLang + '&amp;url=' + href
																													 + '" onclick="window.open(this.href); return false;" target="_blank" title="'
																													 + readSpeakTitle
																													 + '" class="link-readspeak"><img src="'
																													 + tPath
																													 + 'img/icon_SpeakerSmall.gif" alt="'
																													 + readSpeakListen + '" /></a>';
																						 }
																						 $(this).after(readSpeakLink);
																					 }
																				 });

						   // old functions
						   function openSelectedUrl(field)
						   {
							   el = document.getElementById(field)
							   document.location = el.options[el.selectedIndex].value
						   }

						   function Go(x)
						   {
							   if (x != "")
							   {
								   window.location.href = x;
								   document.forms[0].reset();
								   document.forms[0].elements[0].blur();
							   }
						   }

						   // shadowbox
						   if ($.browser.msie)
						   {
							   setTimeout('Shadowbox.init()', 100);
						   }
						   else
						   {
							   Shadowbox.init();
						   }

						   $('.shadowbox').each(function()
												{
													$(this).attr('rel', 'shadowbox; plugin=iframe; width=875');
													var href = $(this).attr('href');
													//if link points to an external page
													if (href.match('http://*') || href.match('https://*'))
													{
													}
													else
													{
														href = baseHref + href;
													}
													$(this).attr('href', baseHref + tPath + 'php/get_content.php?url=' + href);
												});
						   $('.shadowbox').click(function()
												 {
													 $(".header").text($(this).parents('div.block').find("h1").text());
													 myHeadline = $(this).parents('div.block').find("h1").text();
												 });

						   // folded content
						   if ($('.tx-maritfoldcont-pi1-layout-0').length > 0)
						   {
							   $('.tx-maritfoldcont-pi1-container-second-level, .tx-maritfoldcont-pi1-container-third-level').hide();
							   $('.tx-maritfoldcont-pi1-headline-first-level, .tx-maritfoldcont-pi1-headline-second-level').click(function()
																																  {
																																	  $(this).toggleClass('tx-maritfoldcont-pi1-headline-active').next().slideToggle();
																																  });
							   $('.link-patient-judgment').tooltip({
																	   showURL: false,
																	   bodyHandler: function()
																	   {
																		   return $(this).text();
																	   },
																	   left: -130,
																	   extraClass: "tooltip-small"
																   });
						   }
						   if ($('.tx-maritfoldcont-pi1-layout-1').length > 0)
						   {
							   $('.tx-maritfoldcont-pi1-container-second-level').hide();
							   $('.tx-maritfoldcont-pi1-headline-first-level strong.has-sub').click(function()
																									{
																										$(this).toggleClass('tx-maritfoldcont-pi1-strong-active').parent().next().slideToggle();
																									});
						   }

						   // image maps
						   if ($('.mwimagemap-tooltips').length > 0)
						   {
							   $('.mwimagemap-map area').tooltip({
																	 showURL: false,
																	 bodyHandler: function()
																	 {
																		 var areaId = $(this).attr('id').substr(16);
																		 return $('.mwimagemap-tooltip-' + areaId).html();
																	 },
																	 top: 0,
																	 positionTop: true,
																	 left: 0,
																	 extraClass: "tooltip-big"
																 });
						   }

						   $(window).resize(repositionBubble());
						   $(".bubble .close").click(function(event)
													 {
														 event.preventDefault();
														 $('div.bubble, .bubbleright').hide()
													 });
					   });
function repositionBubble()
{
	if ($('div.bubble').length > 0)
	{
		var position = $("#content-right iframe").position();
		$('div.bubble').css("top", position.top + 60);
		$('div.bubble').css("left", position.left - 630);
		$('.bubbleright').css("position", "absolute");
		$('.bubbleright').css("top", position.top + 60);
		$('.bubbleright').css("left", position.left - 10);
	}
}
function showBubble()
{
	repositionBubble();
	$('div.bubble, .bubbleright').show()
}
function iprint()
{
	frames["sb-player"].focus();
	frames["sb-player"].print();
}

function populateIframe()
{
	if (writein != true)
	{
		delete ifrm;
		var ifrm = document.getElementById('sb-player');
		var ifrmcont = ifrm.contentWindow.document.body.innerHTML;
		ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
		ifrm.document.open();
		ifrm.document.write('<style>.iFrameHeadline{display:none; color:#2266A0; font-family:Arial,Helvetica,sans-serif;}@media print{.iFrameHeadline{display:block;}</style><h3 class="iFrameHeadline">'
									+ myHeadline + '</h3>' + ifrmcont);
		ifrm.document.close();
		writein = true
	}
	iprint();
}
