// JavaScript Document

// initialize the jquery code
	 $(document).ready(function(){
    
    //close all the content divs on page load
		$('.mover').hide();
		$('.hidefields').hide();
		
			// toggle in and out
				$('div.fadeInOut').click(function(){
                var $this = $(this);
                if( $this.is('.zu')) {
                        $this.next('.mover').slideToggle("slow");
                        $this.removeClass('zu');
                        $this.addClass('auf');
                }
                else if ($this.is('.auf'))  {
                        $this.next('.mover').slideToggle("slow");
                        $this.removeClass('auf');
                        $this.addClass('zu');
                }
                return false;
        });
			
			//schliessen
			$('div.unten').click(function() {
				$(this).parent('.mover').slideToggle('slow');
				$(this).parent('.mover').prev('div.fadeInOut').addClass('zu');
				$(this).parent('.mover').prev('div.fadeInOut').removeClass('auf');
			});
			
			
			//bildunterschrift
			$('.mover').children('p').children('span.tiny').wrap('<div style=\'width:450px\'></div>');
			
			
			// Fachinformation
			// replace arimidex® with link
			$('span.produkt_Fachinfo').each(function() {
   			var $this = $(this);
   			var t = $this.html();
   			$this.html(
					   t.replace('Arimidex®', '\<a class="arimidex" onclick=\"vHWin=window.open(\'arimidex_pflichttext.html#c339\',\'FEopenLink\',\'width=600,height=740\');vHWin.focus();return false;\" target=\"FEopenLink\" href=\"arimidex_pflichttext.html#c339\">Arimidex®\<\/a\>')
					   .replace('Faslodex®', '\<a class="faslodex" onclick=\"vHWin=window.open(\'faslodex_pflichttext.html#c340\',\'FEopenLink\',\'width=600,height=740\');vHWin.focus();return false;\" target=\"FEopenLink\" href=\"faslodex_pflichttext.html#c340\">Faslodex®\<\/a\>')
					   .replace('Nolvadex®', '\<a class="nolvadex" onclick=\"vHWin=window.open(\'nolvadex_pflichttext.html#c341\',\'FEopenLink\',\'width=600,height=740\');vHWin.focus();return false;\" target=\"FEopenLink\" href=\"nolvadex_pflichttext.html#c341\">Nolvadex®\<\/a\>')
					   .replace('Zoladex®', '\<a class="zoladex" onclick=\"vHWin=window.open(\'zoladex_pflichtext.html#c342\',\'FEopenLink\',\'width=600,height=740\');vHWin.focus();return false;\" target=\"FEopenLink\" href=\"/zoladex_pflichtext.html#c342\">Zoladex®\<\/a\>')
					   );
   			}); 
			
				 //newsletter anmeldung
			$('#cb_fachkreise').click(function() {
				var $sClass = $(this).val(); 
				var $check = $('#' + $(this).attr('id') + '_status').text(); 
				
				
        		if($check == 'true') { 
					$('input[@type=checkbox].' + $sClass).attr('checked', 'checked'); 
					//$('#' + $(this).attr('id') + '_status').text('false'); 
					$('.hidefields').toggle();
				} else { 
					$('input[@type=checkbox].' + $sClass).removeAttr('checked'); 
					//$('#' + $(this).attr('id') + '_status').text('true'); 
					$('.hidefields').toggle();
				} 
			});
			
			
			//cookie // Popup Layer
		var doctitle = document.title;
		if (!$.cookie(doctitle)) {
			setTimeout("$('div.popuplayer').css('visibility','visible');"    ,5000   );
			//$('div.popuplayer').css('visibility','visible') ;
			$.cookie(doctitle, 'popup_once', { expires: 1 }); 
		} else {
			$('div.popuplayer').css('visibility','hidden') ;
		}
		
		
		// gleiche markup, gleiche höhe
		// initialize the jquery code
	
		$('.equalizer').equalHeights();
		
	
		
});