$(document).ready(function(){
	
	// Country list for header	
	$("#header .metanav").append('<div id="countrylist">' +
							'<ul>' +
								
										'<li><a target="_blank" href="http://www.mucosolvan.com">International(.COM)</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.at">Áustria</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">Bulgária</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.cz">República Tcheca</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.cn">China</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.de">Alemanha</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">Polônia </a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.pt">Portugal </a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.ro">Romênia</a></li>' +
										
										'<li><a target="_blank" href="http://www.lasolvan.ru">Russia</a></li>' +
										
										'<li><a target="_blank" href="http://www.mucosolvan.sk">Slovakia</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">Espanha</a></li>' +
										
										'<li><a target="_blank" href="http://www.lasolvan.ua">Ucrânia</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">Fechar janela 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 do Brasil Quim. e Farm. Ltda.,  Todos os direitos reservados. <br/><br/><br/> <span style="font-size:11px;"><b>Indicações: Mucosolvan</b> serve para facilitar a expectoração (soltar a secreção dos pulmões) quando houver acúmulo e dificuldade no transporte de catarro (secreção) em doenças broncopulmonares (brônquios e pulmões) agudas e crônicas. Xarope adulto: MS - 1.0367.0073.015-6 - Xarope pediátrico: MS - 1.0367.0073.014-8 - Gotas: MS - 1.0367.0073.018-0 - Mucosolvan 24HRS: MS - 1.0367.0073.023-7<br/><br/></span><span style="font-size:11px;"><b>SE PERSISTIREM OS SINTOMAS, O MÉDICO DEVERÁ SER CONSULTADO. </b><br/><br/><p align="center" style="text-align: center;font-size:10px;color:#000000;background:#ffffff;border-width:1px;border-style:solid;  border-color:#000000;  padding:1.0em;margin-right:50px;margin-left:50px;"><b>NÃO USE ESTE MEDICAMENTO EM CRIANÇAS MENORES DE 2 ANOS DE IDADE.</b></p></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/br/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);
	}	
}
