$(document).ready(function(){
	
	$('a.mail').each( function() {
		this.innerHTML = this.innerHTML.replace(/\(at\)/,'@'); 
		this.href = 'mailto:'+this.innerHTML.replace(/\(at\)/,'@');
	});
	
	$("a.close").click( function(){
		self.close();
		return false;
	});
	
	$("a.print").each( function(){
		var a = $(this);
		$('div.arTabContent').css({display: 'block', height: '390px'});	
		a.click( function() { 
			self.print();
			return false;
		});
	});	
	
	$('a.recommend').each( function() {
		var a = $(this);
		a.click( function() { 
			seite = document.location;
			wohin = "/corporate/home/pop_send2.asp?seite=\'"+seite;
			remote = window.open(wohin, 'TheRemote','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=540,height=470');
			return false;
		});		
	});
	
	$('a.recommend_de').click( function() { 
		seite = document.location;
		wohin = "/corporate/home/pop_send2_de.asp?seite=\'"+seite;
		remote = window.open(wohin, 'TheRemote','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=540,height=470');
		return false;
	});

	$('a.key').each( function() {
		var div = $(this).html()
		div += '<img src="/corporate/images/icon_key.gif" alt="key">'
		$(this).html(div)
		
	});
		
	$('a.togglesites').click( function() { 
		$(this).toggleClass('open');
		$(this).next('span').toggleClass('open');				
	});
			
	$('a.togglediv').click( function() { 
		$(this).toggleClass('open');
		$(this).next('div').toggleClass('open');
	});
	
	$('img').each( function() {
		var alttag = $(this).attr("alt");
		$(this).attr({ title: alttag });	
	});
	
	//$('.domtab > ul li:first').addClass('first');
	
	//$('.domtab').tabs();       
	
	//$(".tabs-selected").dropShadow({left: 3, top: 0, opacity: 0.2, blur: 1});
	
	/*$(".domtabs li a").click( function() { 
		$(".domtab .tabs-selected").removeShadow();
		//shadow redraw direkt in der jquery.tabs.js - line 482
	});*/
	
	//$(".domtab .tabs-selected").redrawShadow();
	
	if ($.browser.msie) {
		$(".drawers li.drawer h3").each(function() {
		var el = $(this);
		el.hover(
			function(){
				el.addClass('hover');
			},
			function(){
				el.removeClass('hover');
			}
		)
	});
	}
	
	PressVerification();
			
});

/* begin =============== explicitconsens (Pressverification) ================ */
function goContent(params) {
	var content =	'<div id="pressdownloadpopup" class="popcontainer">' +
						'<div class="maincontent clearfix">' +
							'<div class="whitebg small">' +
								'<span class="eightteen">Requirements for more information</span>' +
								'<span class="fourteen">Some of the requested information is intended for journalists only.</span>' +
							'</div>' +
							'<div class="confirm">' +
								'<span>Please confirm that you are<br />a member of the media.</span>' +
								'<ul class="buttonlist">' +
									'<li><a href="#" onclick="openppLink(\''+params.href+'\'); return false;"><img src="/corporate/images/news/journalist_yes.gif" alt="Yes" /></a></li>' +
									'<li><a href="#" onclick="denyppAccess(); return false;"><img src="/corporate/images/news/journalist_no.gif" alt="No" /></a></li>' +
								'</ul>' +
							'</div>' +
							'<div class="deny">' +
								'<span class="important" style="width: 240px;"><strong>We are sorry,</strong> you may not<br/> access this content.</span>' +
								'<ul class="buttonlist">' +
									'<li><a href="#" onclick="lightbox.lb_hide(); return false;"><img src="/corporate/images/news/journalist_close.gif" alt="Close" /></a></li>' +
								'</ul>' +
							'</div>' +
						'</div>' +
					'</div>';
	return content;
}
function openppLink(href) {
	lightbox.lb_hide(); 
	document.cookie='journalist-approved=true;path=/corporate/';
	document.location.href = href;
}
function openInSiteLink(href) {
	document.cookie='journalist-approved=true;path=/corporate/';
	window.location.reload();
}
function denyppAccess(href) {
	$('#pressdownloadpopup div.confirm').each(function () { $(this).css("display", "none") });
	$('#pressdownloadpopup div.deny').each(function () { $(this).css("display", "block") });
	Cookie.erase('journalist-approved');
}
function PressVerification() {
	$('a.key').not('a.pressdownload').each(function(e){	
			$(this).click( function() {
				if(Cookie.get('journalist-approved') != 'true'){ 
					lightbox.create({type:'callback', callback : goContent, href : $(this).attr('href')});
				} else {	
					document.location.href = $(this).attr('href');
				}
				return false;
			});
	});
	$('a.pressverification').not('a.pressdownload').each(function(e){	
			$(this).click( function() {
				if(Cookie.get('journalist-approved') != 'true'){ 
					lightbox.create({type:'callback', callback : goContent, href : $(this).attr('href')});
				} else {	
					document.location.href = $(this).attr('href');
				}
				return false;
			});
	});
}
function onloadPressVerification() {
	if(Cookie.get('journalist-approved') != 'true')
	{
		//document.location.href = '/corporate/news/presspack/index.asp';
	}
}
/* end =============== explicitconsens (Pressverification) ================ */

//function zur Wert�bergabe an den MediaPool
function mp_redirect(link){ 
	if(link == "--Select a category---"){		
	} else {		
		window.open("https://mediapool.boehringer-ingelheim.com/index.php?id=16&no_cache=1&tx_mediadb_pi1[mode]=search&tx_mediadb_pi1[SEARCH][activeSearch]=search&tx_mediadb_pi1[SEARCH][swords]="+link,"_blank");
	}
	
}

// SkipFunktion
var sc = 1;
function skip(a,d) {
	if (d && d == "f") {
		if (a) {
			hideElement('skip_'+sc);
			if (sc < a) sc = sc + 1;
			else sc = 1;
			showElement('skip_'+sc);
		}
	} 
	if (d && d == "b") {
		if (a) {
			hideElement('skip_'+sc);
			if (sc < a && sc != 1 || sc == a) sc = sc -1;
			else if (sc == 1) sc = a;
			showElement('skip_'+sc);
		}
	}
}
// Funktion zum Ausblenden von Elementen
function hideElement(id) {
	e = document.getElementById(id);
	if (e) e.style.display = "none";
}
// Funktion zum Einblenden von Elementen
function showElement(id) {
	e = document.getElementById(id);
	if (e) e.style.display = "block";
}
