// from http://shadowbox-js.com/forum.html#nabble-td3004085
function moveCloseLink() {
	cb=document.getElementById( 'sb-nav-close' ); 
	tb=document.getElementById( 'sb-title' ); 
	if( tb ) 
		tb.appendChild(cb); 
	}

// initialize shadowbox
Shadowbox.init({
	// skip the automatic setup, we do it manually below
//	skipSetup:				true,
	onOpen:					moveCloseLink,
	overlayOpacity:	0.7,
//	overlayColor:			"#1b251a",
	animSequence:	"wh"
	});

window.onload = function() {
	// skip setting up the links on Safari Mobile (else the iphone redirect won't work)
	if (!(navigator.userAgent.match(/iPhone/i)) && !(navigator.userAgent.match(/iPod/i))) {
		// set up all anchor elements with a "pano" class to work with Shadowbox
		// (requires a CSS-enabled version of Shadowbox
		Shadowbox.setup("a.pano", {
			width:							1280,
			height:						720
			});
		};
	};

// general shadowbox open fn
function openShadowbox(content,player,title,width,height) {
	Shadowbox.open({
		content:		content,
		player:			player,
		title:			title,
		width:			width,
		height:			height
		});
	};


// shadowbox fn to open google map
function openShadowboxGmap(lat,long,zoom,title,width,height) {
	// alert(window.location.host);
	// alert("latitude: "+lat+"\nlongitude: "+long+"\nzoom: "+zoom+"\ntitle: "+title+"\nwidth: "+width+"\nheight: "+height);
	if (GBrowserIsCompatible()) {
		Shadowbox.open({
			player:		"html",
			content:	"",
			title:		title,
			width:		width,
			height:		height,
			options: {
				onFinish: function(item) {
					var body = document.getElementById(Shadowbox.playerId);
					var map = new GMap2(body);
					map.setCenter(new GLatLng(lat,long),zoom);
					map.setMapType(G_HYBRID_MAP);
					var marker = new GMarker(new GLatLng(lat,long));map.addOverlay(marker);
					map.setUIToDefault();
					}
				}
			});
		};
	};


