$(document).ready(function(){
	
	// Country list for header	
	$("#header .metanav").append('<div id="countrylist">' +
							'<ul>' +
								
										'<li><a target="_blank" href="http://www.mucosolvan.at">Austria</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.com.ar">Argentina</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.com.br">Brasil</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.bg">Bulgaria</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.cz">Czech Republic</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.cn">China</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.de">Germany</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.it">Italy</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.com.mx">Mexico</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.pl">Poland</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.pt">null</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.ro">Romania</a></li>' +
										
										'<li><a target="_blank" href="http://www.lasolvan.ru">Russia</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.sk">null</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.com/kr">Korea (South)</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosan.es">Spain</a></li>' +
										
										'<li><a target="_blank" href="http://www.lasolvan.ua">Ukraine</a></li>' +
										
							'</ul>' +
						'</div>');
	$('#countrylist').hide();
	$('.country').click(function(){
		if ($('#countrylist').css('display') == 'none') {
			$('#countrylist').slideDown('normal',function(){
				$('#countrylist').dropShadow({top: 0,left: -1, bottom: 1, right: 1, opacity: 0.3, blur: 2});
			});				
		}
		else 
			$('#countrylist').slideUp().removeShadow();
		return false;
	});
	
	$("#outer_wrapper").append('<div id="overlay"><!--[if lte IE 6.5]><iframe class="IEFix"></iframe><![endif]--></div>');
	$("#outer_wrapper").append('<div id="disclaimer_overlay"><!--[if lte IE 6.5]><iframe class="IEFix"></iframe><![endif]--></div>');
	
	var ol = $("#overlay");
	ol.hide();
	var dol = $("#disclaimer_overlay");
	dol.hide();
	
	var hovered = false;
	
	var disclaimer = '<div id="disclaimer">' +
						'<div class="clearfix">' +
							'<h3>Personal health</h3>' +
							'<a href="#" class="close">Закрыть "окно" X</a>' +
						'</div>' +
						'<p><strong>You should always contact your healthcare professional for questions on personal health matters.</strong></p>' +
						'<p>We are unable to provide advice or information on the use or intended use of prescription products directly to patients. The queries and feedback form on this site should not be used to ask questions of this nature. Adverse drug reactions should be notified to your healthcare professional as soon as possible.</p>' +
						'<p class="copy">Copyright &copy; null Boehringer Ingelheim GmbH, Все права защищены <br/><br/><br/><span style="font-size:10px; color:#064160;">Регистрационные свидетельства МОЗ Украины: UA/3430/01/02 от 22,10,2008, UA/3430/01/01 от 01,08,2005, UA/3430/03/01 от 22,10,2008, UA/3430/02/01 от 22,01,2007<br/><strong>Предупреждение!</strong> Имеются противопоказания к применению и использованию, перед применением необходимо ознакомиться с инструкцией по медицинскому применению и получить консультацию специалиста. Посетители сайта не должны использовать данную информацию в качестве медицинских советов и рекомендаций. Выбор и назначение лекарственных препаратов, а также контроль над их применением может осуществлять только врач, который всегда учитывает индивидуальные особенности пациента.<br/>Boehringer Ingelheim не несёт ответственности за возможные отрицательные последствия, возникшие в результате использования информации с данного сайта.</span></p>' +
						'<a href="#" class="print">Print page</a>' +
					 '</div>';
					 
	var country_disclaimer = '<div id="country_disclaimer" class="clearfix">' +
						'<div class="clearfix">' +
							'<h3>Disclaimer</h3>' +
							'<a href="#" class="close">close window X</a>' +
						'</div>' +
						'<br /><p>Using this link will let you leave a website of Boehringer Ingelheim GmbH. The linked site is not under the control of Boehringer Ingelheim GmbH and Boehringer Ingelheim GmbH shall not be responsible for the contents of any linked site or any link contained in a linked site, or any changes or updates to such sites. Neither is Boehringer Ingelheim GmbH responsible for web casting or any other form of transmission received from any linked site. This link is provided to you only as a convenience, and the inclusion of any link does not imply endorsement by Boehringer Ingelheim GmbH of the site.</p>' +
						'<br /><p><a href="#" id="continue" target="_blank"><strong>Continue</strong></a></p>' +
						'<p class="copy" style="float: none;">Copyright &copy; 2008 Boehringer Ingelheim GmbH, All rights reserved<br />&nbsp;</p>' +
					 '</div>';
	
	$("#outer_wrapper").append(disclaimer);
	$("#outer_wrapper").append(country_disclaimer);
	$('#disclaimer').hide();
	$('#country_disclaimer').hide();
	
	$('a.phd').click(function(){
		dol.fadeIn("normal", function() { dol.css("opacity",0.75);});
		$('#disclaimer').fadeIn('normal');
		return false;
	});	
	
	$('#disclaimer a.close').click(function(){
		$("#disclaimer").hide();
		dol.hide();
		return false;
	});
	$('#disclaimer a.print').click(function(){
		$("#disclaimer").hide();
		dol.hide();
		window.print();
		return false;
	});
	
	$('#countrylist a').each(function(){
		$(this).click(function(){
			dol.fadeIn("normal", function() { dol.css("opacity",0.75);});
			$('#country_disclaimer').fadeIn('normal');
			$('#country_disclaimer a#continue').attr('href',$(this).attr('href'));
			$('#countrylist').hide().removeShadow();
			return false;
		});
	});
	$('#country_disclaimer a.close').click(function(){
		$("#country_disclaimer").hide();
		dol.hide();
		return false;
	});
	$('#country_disclaimer a#continue').click(function(){
		$("#country_disclaimer").hide();
		dol.hide();
	});
	
	if (jQuery.browser.msie) {		
		$(window).resize( function() { resizeIE(); } );
	}
	
	$("#recommend td div").hover(function(){
			$(this).addClass("hover");
		},function(){
			$(this).removeClass("hover");
	});
	$("#recommend td div.h").hover(function(){
			$(this).addClass("hover");
		},function(){
			$(this).removeClass("hover");
	});
			
	$("ul.mainnav").hover(
		function(){		
			//ol.fadeIn("", function() { ol.css("opacity",0.75);});
			ol.show();			
			hovered = true;
		},
		function(){
			ol.hide();
			hovered = false;
		}
	);
	
	$("#mainnav>ul>li").each(function() {
		var li = $(this);
		var mc = $('>div.mc', li);
		var a = $('a.main', li);
		li.hover(
			function(){
				a.addClass('over');
				if(hovered == false){
					mc.fadeIn();
					$("#header .metanav").css('z-index','500');
					$('#countrylist').hide().removeShadow();
				} else {
					mc.show();
					$("#header .metanav").css('z-index','500');
					$('#countrylist').hide().removeShadow();
				}
			},
			function(){
				a.removeClass('over');
				mc.hide();
				$("#header .metanav").css('z-index','1001');
			}
		)
		a.click( function() { return false; } );
	});
	
	$(".prod_overview td").hover(function(){
			$(this).addClass("hover");					
			var oldimg = $(this).children('.illu').children('img').attr("src");			
			var newimg = oldimg.substring (0, oldimg.length-4) + "_hover.jpg";
			$(this).children('.illu').children('.donotprint').attr({ src: newimg });
		},function(){
			$(this).removeClass("hover");
			var oldimg = $(this).children('.illu').children('img').attr("src");			
			var newimg = oldimg.substring (0, oldimg.length-10) + ".jpg";
			$(this).children('.illu').children('.donotprint').attr({ src: newimg });			
	});
	
	$(".faqtabs dl a").click( function() { 
		$(".whitebg").removeShadow();		
		$(this).parent().parent().children('dt').removeClass('active');
		$(this).parent().parent().children('dd').removeClass('active');
		$(this).parent().addClass('active');
		$(this).parent().next().addClass('active');
		$(".whitebg").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});	
	});	
	
	$('#tab>ul li a').click( function() { 
		$(this).blur();
		$('#tab>ul li').removeClass("active");
		$(this).parent().addClass('active');
		$(".whitebg").removeShadow();
		setTimeout('loadShadow()',400);
	});	
	
	/*$('div.metanav a.home').click( function() { 
		$("#outer_wrapper").append('<div id="disclaimer_overlay"><\/div>');
		$("#disclaimer_overlay").html(disclaimer);
		muc_disclaimer = window.open("http://ingwswcms01.eu.boehringer.com/wcms_chc/mucosolvan_com_edit/at/meta/popup_disclaimer.htm", "muc_disclaimer","width=533,height=255,menubar=no,toolbar=no,resizable=yes");
		muc_disclaimer.focus();
	});*/
	
	$('a.flashTeaser').click( function() { 
		muc_disclaimer = window.open("/wcms_chc/mucosolvan_all_prod/ua-ru/teaser/popup_flash.htm", "Animated_illustration","width=650,height=800,menubar=no,toolbar=no,resizable=yes");
		muc_disclaimer.focus();
		return false;
	});
	
	$('a.press').click( function() { 
		biNewsCentre = window.open("http://boehringer-ingelheim.com/corporate/news/index.asp");
		biNewsCentre.focus();
		return false;
	});
	
	$('#header #searchfield').focus( function() { $(this).attr({ value: "" }); } );
	$('#header #searchfield').blur( function() { $(this).attr({ value: "Search" }); } );
	
	setTimeout('loadShadow()',500);
	resizeIE();
	
});

function reloadShadow() {	
	setTimeout('loadShadow()',500);
}
function loadShadow() {	
	$(".btn.zwo").removeShadow();
	$(".btn.eins").removeShadow();
	$(".whitebg").removeShadow();
	$(".bluebg").removeShadow();
	$(".btn.zwo").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});
	$(".btn.eins").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});
	$(".whitebg").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});
	$(".prodbg").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});
	$(".bluebg").dropShadow({left: 2, top: 2, opacity: 0.3, blur: 2});
}
function resizeIE(){
	if (jQuery.browser.msie) {	
		var ol = $("#overlay");
		dWidth = ($(document).width()- 21);
		dHeight = ($(document).height());	
		ol.css("width",dWidth);
		ol.css("height",dHeight);
	}	
}
