/*************************************************************  Unroll/Reroll map script    The map should be given id='map'.  Each location anchor should have id='xCoord_yCoord'):   - xCoord is the horizontal coordinate of this point's	 location on the map, specified in pixels;   - yCoord is the vertical coordinate of this point's	 location on the map, also specified in pixels.*************************************************************/var map = null;var map_link = null;var photogroups = null;var previous_onload = window.onload;window.onload = function() {	previous_onload();	// we need the W3C DOM to continue.	if (!document.getElementById || !document.getElementsByTagName)   return;	//adjust_subnav_height();	map = document.getElementById('map');	if (map) {		// IE/mac suffers from an insufferable z-index problem, so no candy for him.		if (typeof window.clientInformation != 'undefined'				&& window.clientInformation.platform.indexOf('Mac' != -1)				&& window.clientInformation.appName == 'Microsoft Internet Explorer') {			if (map.className == 'hidden')  return;		} else {			map_link = document.getElementById('subnavMapLink');			if (map_link) { map_link.href = 'javascript:move_map()'; }		}			map.real_height = map.offsetHeight;		map.current_height = 0;		map.animation_step = map.real_height/15;		position_map_markers();	} else if (document.getElementById('seasongallery')) {		// compensate for IE/Mac's hypercaching...		if (document.getElementById('nextphotolink'))  return;				content_div = document.getElementById('content');		photogroups = document.getElementById('photogroups');		photogroups.groups = photogroups.getElementsByTagName('li');		photogroups.visible = 0;		if (photogroups.groups.length > 1) {			var prev_link = document.createElement('span');			prev_link.id = 'prevphotolink';			prev_link.onclick = function() {  switch_photos_prev();  }			content_div.insertBefore(prev_link, photogroups);			var next_link = document.createElement('span');			next_link.id = 'nextphotolink';			next_link.onclick = function() {  switch_photos_next();  }			content_div.insertBefore(next_link, photogroups);						var page_num = parseInt(document.location.hash.substring(1));			if (page_num > 0  &&  page_num < photogroups.groups.length) {				photogroups.groups[0].className = '';				photogroups.groups[page_num].className = 'visible';				photogroups.visible = page_num;			}		}	}}function switch_photos_next() {	photogroups.groups[photogroups.visible].className = '';	photogroups.visible++;	if (photogroups.visible >= photogroups.groups.length)   photogroups.visible = 0;	document.location.hash = photogroups.visible;	photogroups.groups[photogroups.visible].className = 'visible';}function switch_photos_prev() {	photogroups.groups[photogroups.visible].className = '';	photogroups.visible--;	if (photogroups.visible < 0)   photogroups.visible = photogroups.groups.length-1;	document.location.hash = photogroups.visible;	photogroups.groups[photogroups.visible].className = 'visible';}function adjust_subnav_height() {	var subnav = document.getElementById('subnav');	var heading = subnav.getElementsByTagName('h2')[0];	var heading_offset = get_top_offset(heading);	var desiredHeight = heading_offset - get_top_offset(subnav);	if (desiredHeight >= subnav.offsetHeight) {		subnav.style.height = (desiredHeight-4) + 'px';  // 4px top margin, which is included in offsetHeight		if (document.getElementById('seasongallery')  ||  document.getElementById('seasongallerymenu')) {			var seasons = subnav.getElementsByTagName('li');			for (var i=0; i < seasons.length; i++) {				seasons[i].style.top = (heading_offset - get_top_offset(seasons[i]) - 40) + 'px';			}		}	}}// this function stolen/adapted from ppk:  http://www.quirksmode.org/js/findpos.htmlfunction get_top_offset(obj) {	var curtop = 0;	if (obj.offsetParent) {		curtop = obj.offsetTop;		while (obj = obj.offsetParent) {			curtop += obj.offsetTop;		}	}	return curtop;}function position_map_markers() {	var map_locs = map.getElementsByTagName('a');	var right_align_cutoff = (map.offsetWidth*2)/3;	for (var i=0; i < map_locs.length; i++) {		var position = map_locs[i].id.split('_');		if (position.length == 2) {  // the id is a valid position!			map_locs[i].style.top = (position[1]-12) + 'px';			if (position[0] < right_align_cutoff) {				map_locs[i].style.left = (position[0]-12) + 'px';				map_locs[i].className = 'leftPositioned';			} else {				// right offset of anchor = 700 (width of map) + 12 (anchor width offset) - position[0] (left offset of anchor)				map_locs[i].style.right = (712 - position[0]) + 'px';				map_locs[i].className = 'rightPositioned';			}		}	}}function move_map() {	if (map.className == 'moving')  return;	map.className = 'moving';	map_link.className = 'inactive';	map_link.innerHTML = 'Map is Moving\u2026';	if      (map.current_height == 0)                show_map();	else if (map.current_height == map.real_height)  hide_map();}function show_map() {	map.current_height += map.animation_step;	if (map.current_height > map.real_height - 0.1)   map.current_height = map.real_height;	map.style.height = map.current_height + 'px';	if (map.current_height == map.real_height) {		map.className = 'visible';		map_link.blur();		map_link.className = '';		map_link.innerHTML = 'Put Away Map';	} else {		setTimeout('show_map()', 10);	}}function hide_map() {	map.current_height -= map.animation_step;	if (map.current_height < 0.1)   map.current_height = 0;	map.style.height = map.current_height + 'px';	if (map.current_height == 0) {		map.className = 'hidden';		map_link.blur();		map_link.className = '';		map_link.innerHTML = 'Show Map';	} else {		setTimeout('hide_map()', 10);	}}
