$(document).ready(function()
{
	if(document.referrer.indexOf(window.location.host) < 0)
	{
		$(window).resize(function()
		{
			$('#darkLayer').css({
				height: $(document).height()
			});
			do_lb_position();
		});
		
		create_lb('lb_teaser');
		
		$('.lightbox .teaser_close').live('click', function() 
		{
			$('#lb_teaser').fadeOut(300, function() {

				$('#darkLayer').fadeOut(200);
			});

			return false;
		});
		
		var url = document.location.href;
		$('.teaser_langswitch a').live('click', function()
		{
			do_lb_open(this.href.replace(/www\.gamax\.de/g, window.location.host));
			return false;
		});
		
		$('a.member_open').live('click', function()
		{
			($('.teaser_langswitch a').attr('href').indexOf('en/') < 0) ? document.location.href = 'http://gamax.de/en/servicenavigation/register/': document.location.href = 'http://gamax.de/servicenavigation/registrierung/';
			//(url.substr(url.length-3,url.length) == 'en/') ? document.location.href = 'http://gamax.de/en/servicenavigation/register/': document.location.href = 'http://gamax.de/servicenavigation/registrierung/';
			return false;
		});
				
		$('a.home_open').live('click', function()
		{
			($('.teaser_langswitch a').attr('href').indexOf('en/') < 0) ? document.location.href = 'http://gamax.de/en/home': document.location.href = 'http://gamax.de/home';
			//(url.substr(url.length-3,url.length) == 'en/') ? document.location.href = 'http://gamax.de/en/home': document.location.href = 'http://gamax.de/home';
			return false;
		});
		
		do_lb_open(window.location.protocol + '//' + window.location.host + '/en/popups/gamax-funds-junior/');
	}
});
