	
$(document).ready(function() {
						   
	$("div.city").not(":first").hide();	
	$("#storynav a").click(function() { showCity($(this)); return false; });
	$("#mems li").attr("id",function(arr) { return "im"+(arr+1); });
	//video();
	$("#stories").stories();
	setTimeout("carousel(5000)",5000);
	vbPrep(); //Prepare Video Button Interactivity
	//auto-open for Testing Only
	var loc=window.location.toString();
	if (loc.indexOf("?click")!=-1 || loc.indexOf("&click")!=-1) {
		$("#videobutton").click();
	}

});

function vbPrep() {
	$("#videobutton").hover(function() {
		$("#iconOvr").stop().animate({opacity:0},200); },
	function() {
		$("#iconOvr").stop().animate({opacity:1},200);
	});
	
	$("#videobutton").mousedown(function() {
		$("#icon").css("backgroundPosition","0 -90px");
	});
	$("#videobutton").mouseup(function() {
		$("#icon").css("backgroundPosition","0 -45px");
	});
	
	$("#videobutton").click(function() {
		$("#mems").animate({opacity:0},150,function() {
			var videobox=$("<iframe />",{ src: "video/inset.php","scrolling":"no", "frameborder":0, css: { width: 639, height:480 }});
			$(videobox).infobox({
					overlay:"#f0e9e2",
					width:639,
					height:480,
					padding:0,
					onClose: function() { $("#mems").animate({opacity:1},300); }
				});
		});
		return false;
	});
}
									  

// Header Image Carousel
var x=1;
function carousel(z) {
	var y=(x+1>4)? 1 : x+1;
	$("#im"+x).css("zIndex",2);
	$("#im"+y).css("zIndex",1).show();
	$("#im"+x).fadeOut(1000);
	setTimeout("carousel("+z+")",z);
	x=y;
}
