if (typeof window.console === 'undefined') {var console = {log: function(e){alert('LOG: '+e);},error: function(e){alert('ERROR: '+e);}}}
(function($) {
	var intTimerRotate = 0;
	var intSpeed = 10000;
	$(document).ready(function() {
		if ($('#image-rotator div:first').length > 0) {
			$('#image-rotator div').hide();
			if ($('#image-rotator div').length > 1) {
				$('#image-rotator div:first').fadeIn(500);
				intTimerRotate = setInterval(rotateBanner, intSpeed);
			} else {
				$('#image-rotator div').show();
			}
		}
		if ($('.contenttab').length > 1) {
			var strHTMLOutput = '<ul>';
			$('.contenttab').each(function() {
				strHTMLOutput += '<li><a href="#'+$(this).attr('id')+'" id="content-'+$(this).attr('id')+'">';
				if ($(this).attr('id') === 'MPH_Technology') {
					strHTMLOutput += 'MPH<sup>&reg;</sup> Technology';
				} else {
					strHTMLOutput += $(this).attr('id').replace('_',' ');
				}
				strHTMLOutput += '</a></li>';
			});
			strHTMLOutput += '<li><a class="noclick eu-icon" href="/documents/products/AristaAH_EU.pdf" target="_blank">CE IFU</a></li>';
			strHTMLOutput += '<li><a class="noclick us-icon" href="/documents/products/AristaAH.pdf" target="_blank">US IFU</a></li>';
			strHTMLOutput += '</ul>';
			$('.contenttabnav').html(strHTMLOutput);
			$('.contenttabnav li a:not(.noclick)').click(function(event) {
				event.preventDefault();
				$('.contenttab').hide();
				$('.contenttabnav li').removeClass('active');
				$(this).closest('li').addClass('active');
				$('#'+$(this).attr('id').replace('content-','')).fadeIn('fast');
			});
			if ((window.location.hash) && ($(window.location.hash).length > 0)) {
				$('.contenttab').not(window.location.hash).hide();
				$(window.location.hash.replace('#','#content-')).closest('li').addClass('active');
			} else {
				$('.contenttab').not(':eq(0)').hide();
				$('.contenttabnav li:first').addClass('active');
			}
		}
	});	
	function rotateBanner() {
		var objTempCurrent = $('#image-rotator div:visible').hide();
		if (objTempCurrent.next('div').length !== 0) {
			objTempCurrent.next('div').fadeIn(500);
		} else {
			$('#image-rotator div:first').fadeIn(500);
		}
	}
	var boollang = false;
	$('#current-language').click(function(e) {
		if (boollang) {
			$('#languagechooser').removeClass('expanded');
			$('#language-list').slideUp(100, function() {
				boollang = false;
			});
		} else {
			$('#languagechooser').addClass('expanded');
			$('#language-list').slideDown(100, function() {
				boollang = true;
			});
		}
	});
})(jQuery);

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

