// JavaScript Document
	Menu = {timer : null, current : null};
	Menu.getStyle = function(name){
		if(document.getElementById) return document.getElementById(name).style;
		else if(document.all) return document.all[name].style;
		else if(document.layers) return document.layers[name];
	}
	Menu.show = function(name){
		if(this.timer) clearTimeout(this.timer);
		this.getStyle(name).visibility = "visible";
		this.current = name;
	}
	Menu.hide = function(){
		this.timer = setTimeout("Menu.doHide()",300);
	}
	Menu.doHide = function(){
		if(this.current){
			this.getStyle(this.current).visibility = "hidden";
			this.current = null;
		}
	}

// jquery for opening new windows when user leaves the MI site
$(document).ready(function() {
	$('a[href]:not([href*=american.redcross.org]):not([href^=/]):not([href^=../]):not([href*=measlesinitiative.org])').attr("target","_blank");
});

// logo animation
$(document).ready(function(){	
	$('#logo_ani img').each(function(index) {		
		$('<div id="image' + index + '">').appendTo("#logo_ani");
		
	});
	$('#logo_ani div').addClass('images');
	$('#logo_ani div').each(function(index) {
		$(this)
			.attr({ 'id': 'image' + index })
			.css("background-image","url('" + $("#logo_ani img").eq(index).attr("src") + "')").css("background-repeat","no-repeat")
	});
    var i = 0;
    var fade_time = 1000;
	var pause = 2000;
    $('#image' + i).fadeIn(fade_time,function(){
		i++;
		setTimeout(runIt, pause);
	});
	
    function runIt(){
		if (i < $('#logo_ani div').length) {
			$('#image' + i).fadeIn(fade_time, function(){
				k = i - 1;
				if (i == 1) {
					i++;
					setTimeout(runIt, pause);
				} else {
					$('#image' + k).fadeOut(0, function(){
						i++;
						setTimeout(runIt, pause);
					});
				}
			});
		} else {
			j = i-1;
			$('#image' + j).fadeOut(fade_time, function () {
				i = 1;
				setTimeout(runIt, pause);
			});
		}
    }
	runIt()
});