
// These are the links to the maps for each day of the week starting with Sunday
/*var maps = [
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.000447a0667122c36d96c&z=11',
	'http://maps.google.com/maps/ms?hl=en&gl=us&ptab=2&ie=UTF8&oe=UTF8&msa=0&msid=106037571472375893409.000463e92bf3897ff2609',
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.0004471676c9aae168e9b&z=10',
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.00044756f21990b8201c7&ll=47.702831,-122.294312&spn=0.232896,0.473099&z=11',
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.00044763278f971215f80&ll=47.693126,-122.279205&spn=0.46588,0.946198&z=10',
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.000447777e892d11c12b7&z=11',
	'http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=106037571472375893409.000447785561e225d8c43&ll=47.633007,-122.373962&spn=0.466416,0.946198&z=10'					
];*/
var daylinks;
var hideMapText = 'Hide Map';
var showMapText = 'Show Map';
var selectedDayIndex = 0;

function showdaydetail(element, dayIndex){
	if(!daylinks){
		return;
	}
	
	var showMap = IsMapShowing() ? 1 : 0;
	var frame = document.getElementById("daydetailframe");
	frame.src = daylinks[dayIndex] + '?showmap=' + showMap;
	
	for(var i=0; i<7; i++){
		var el = document.getElementById("day"+i);
		if(el.id != element.id){
			el.className='';	
		}
	}
	element.className='selected';
	selectedDayIndex = dayIndex;
}

function refreshdaydetail(){
	var showMap = IsMapShowing() ? 1 : 0;
	var frame = document.getElementById("daydetailframe");
	frame.src = daylinks[selectedDayIndex] + '?showmap=' + showMap;
}

function initmeetings(){
	if(!daylinks) {
		return;
	}
	
	var day = new Date().getDay();
	var el = document.getElementById("day"+day);
	showdaydetail(el, day);
}

function IsMapShowing(){
	return ($('.allmaps').text() == hideMapText);
}
 	
$.ready = function(){
	initmeetings();
	
	// set the highlighted menu item
	var menuid = $('#menuid').attr('value'); 
	if(menuid.length > 0){
		$('#' + menuid).addClass('selmenu');
	}
	// auto-size the meetings iframe
	$('#daydetailframe').load(function(){
		if(!!this.contentWindow){
			this.height = this.contentWindow.document.body.scrollHeight + 10;
		}
	});
	
	
	$('.allmaps').click(function(){
		if(IsMapShowing()){
			// Hide the map
			$(this).text(showMapText);
		}
		else{
			// Show the map
			$(this).text(hideMapText);
		}	
		refreshdaydetail();
});

}






