$(function(){
	$(".navitem").hover(function(){
		$(".submenu",this).slideDown("fast");
	},function(){
		$(".submenu",this).slideUp("fast");
	});
	$("#closebubble").click(function(){
		$("#bubble").css("display","none");
	});
	$("#spots li").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");}).click(function(){
		makebubble($(this).offset(),$(window).scrollTop(),$(this).attr("id").replace("spot_","") * 1);
	});
	$("#bnd").click(function(){
		makebubble($("#spot_" + curbubble.next).offset(),$(window).scrollTop(),curbubble.next);
		return false;
	});
});

var curbubble = null;

var makebubble = function(offset,st,id) {
	curbubble = mncities[id];
	newtop = offset.top + st;
	newtop = (newtop>600) ? newtop - 185 : newtop;
	newleft = offset.left - 5;
	$("#bwv").attr("href",curbubble.video);
	$("#brd").attr("href",curbubble.dispatch);
	$("#btt").html(curbubble.name);
	$("#bubble").offset({left:newleft,top:newtop}).css("display","block");
}

mncities = [
	{ next: 1, name: 'Alexandria', video: 'http://www.youtube.com/watch?v=szDgTiV5Se4', dispatch: 'http://mnlearningtrek.com/AlexandriaDispatch.pdf' },
	{ next: 2, name: 'Itasca State Park', video: 'http://www.youtube.com/watch?v=SYGnzr37qgE', dispatch: 'http://mnlearningtrek.com/ItascaDispatch.pdf' },
	{ next: 3, name: 'International Falls', video: 'http://www.youtube.com/watch?v=SQS164WCyFM', dispatch: 'http://mnlearningtrek.com/InternationalFallsDispatch.pdf' },
	{ next: 4, name: 'Minneapolis', video: 'http://www.youtube.com/watch?v=WerUhqdXJrU', dispatch: 'http://mnlearningtrek.com/MinneapolisDispatch.pdf' },
	{ next: 5, name: 'Duluth', video: 'http://www.youtube.com/watch?v=_a9iMmGDqQ8', dispatch: 'http://mnlearningtrek.com/DuluthDispatch.pdf' },

	{ next: 6, name: 'Ely', video: 'http://www.youtube.com/watch?v=65VbIaFcUYU', dispatch: 'http://mnlearningtrek.com/ElyDispatch.pdf' },
	{ next: 7, name: 'Grand Rapids', video: 'http://www.youtube.com/watch?v=Zx3IP0sBpFQ', dispatch: 'http://mnlearningtrek.com/GrandRapidsDispatch.pdf' },
	{ next: 8, name: 'Brainerd', video: 'http://www.youtube.com/watch?v=cuUMUj1Alg4', dispatch: 'http://mnlearningtrek.com/BrainerdDispatch.pdf' },
	{ next: 9, name: 'Austin', video: 'http://www.youtube.com/watch?v=h_Xrnlvslw4', dispatch: 'http://mnlearningtrek.com/AustinDispatch.pdf' },
	{ next: 10, name: 'Marshall', video: 'http://www.youtube.com/watch?v=wBgCCzBLLf4', dispatch: 'http://mnlearningtrek.com/MarshallDispatch.pdf' },
	{ next: 11, name: 'St. Paul', video: 'http://www.youtube.com/watch?v=MbBKCnBx3_Y', dispatch: 'http://mnlearningtrek.com/StPaulDispatch.pdf' },
	{ next: 0, name: 'Eden Prairie', video: 'http://www.youtube.com/watch?v=ZagrFzz_DME', dispatch: 'http://attractions.uptake.com/minnesota/alexandria/family/179822196.html' }];
