var bag = {
	'events': {
		'onmouseover': function( args ) {
			var div = document.getElementById( 'details-' + args.id );
			if( div ) div.style.display = 'block';
			return true;
		},
		'onmouseout': function( args ) {
			var div = document.getElementById( 'details-' + args.id );
			if( div ) div.style.display = 'none';
			return true;
		},
		'onclick': function( args ) {
			var dest = document.getElementById( 'bag-image' );
			if( dest && args.img && args.src) {
				dest.src = args.src;
				dest.alt = args.img.alt;
				dest.title = args.img.title;
				dest.onclick = function() {
					w=752;
					h=733;
					leftvar=(screen.width - w) / 2;
					topvar=(screen.height - h) / 2;
					someWindow = window.open(args.onclick, "BAGDetails", "toolbar=0,width=" + w + ",height=" + h + ",resizable=1,scrollbars=1,left="+leftvar+",top="+topvar+"");
				 
					};

			}
			return false;
		}
	}
};
 
var initiatives = {
	'events': {
		'onmouseover': function( args ) {
			var div = document.getElementById( 'details-' + args.id );
			if( div ) div.style.display = 'block';
			return true;
		},
		'onmouseout': function( args ) {
			var div = document.getElementById( 'details-' + args.id );
			if( div ) div.style.display = 'none';
			return true;
		},
		'onclick': function( args ) {
			var dest = document.getElementById( 'initiatives-image' );
			if( dest && args.img && args.src ) {
				dest.src = args.src;
				dest.alt = args.img.alt;
				dest.title = args.img.title;
			}
			return false;
		}
	}
};
 
startList = function() {
 
	if (document.all && document.getElementById) {
 
		if (document.getElementById('top-nav')) {
			navRoot = document.getElementById('top-nav').getElementsByTagName("ul");
	        for (i=0; i<navRoot.length; i++) {
			    for (j=0; j<navRoot[i].childNodes.length; j++) {
				    node = navRoot[i].childNodes[j];
				    if (node.nodeName=="LI") {
					    node.onmouseover=function() {
						    this.className+=" over";
					    }
					    node.onmouseout=function() {
						    this.className=this.className.replace(" over", "");
					    }
				    }
			    }
			 }
		}
 
		if (document.getElementById('bottom-nav')) {
			navRoot = document.getElementById('bottom-nav').getElementsByTagName("ul");
	        for (i=0; i<navRoot.length; i++) {
			    for (j=0; j<navRoot[i].childNodes.length; j++) {
				    node = navRoot[i].childNodes[j];
				    if (node.nodeName=="LI") {
					    node.onmouseover=function() {
						    this.className+=" over";
					    }
					    node.onmouseout=function() {
						    this.className=this.className.replace(" over", "");
					    }
				    }
			    }
			 }
		}
 
		if (document.getElementById('object-landing-more-info')) {
			navRoot = document.getElementById('object-landing-more-info').getElementsByTagName("ul");
	        for (i=0; i<navRoot.length; i++) {
			    for (j=0; j<navRoot[i].childNodes.length; j++) {
				    node = navRoot[i].childNodes[j];
				    if (node.nodeName=="LI") {
					    node.onmouseover=function() {
						    this.className+=" over";
					    }
					    node.onmouseout=function() {
						    this.className=this.className.replace(" over", "");
					    }
				    }
			    }
			}
		}

		if (document.getElementById('n-home')) {
			navRoot = document.getElementById('n-home').getElementsByTagName("ul");
	        for (i=0; i<navRoot.length; i++) {
			    for (j=0; j<navRoot[i].childNodes.length; j++) {
				    node = navRoot[i].childNodes[j];
				    if (node.nodeName=="LI") {
					    node.onmouseover=function() {
						    this.className+=" over";
					    }
					    node.onmouseout=function() {
						    this.className=this.className.replace(" over", "");
					    }
				    }
			    }
			}
		}


	}

}


function initialize() {
	if (document.getElementById('map_canvas')) {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById('map_canvas'));
			var nasherLoc = new GLatLng(32.787774, -96.800191);
			var baseIcon = new GIcon(G_DEFAULT_ICON);
			baseIcon.image = '/images/map-icon.png';
			markerOptions = { icon:baseIcon };
			var marker = new GMarker(nasherLoc,markerOptions);
			var infoWindowHtml = '<div id="map-window">';
			infoWindowHtml += '<b>Nasher Sculpture Center</b><br />';
			infoWindowHtml += '2001 Flora St<br />Dallas, TX 75201<br />';
			infoWindowHtml += 'Get directions: <a href="http://www.google.com/maps?source=uds&daddr=2001+Flora+St%2C+Dallas%2C+TX+%282001+Flora+St%29+%4032.787774%2C-96.800191&iwstate1=dir%3Ato" target="_blank">To here</a> - <a href="http://www.google.com/maps?source=uds&saddr=2001+Flora+St%2C+Dallas%2C+TX+%282001+Flora+St%29+%4032.787774%2C-96.800191&iwstate1=dir%3Afrom" target="_blank">From here</a>';
			infoWindowHtml += '</div>';




/*
markerOptions = { icon:baseIcon };
var marker = new GMarker(point, markerOptions);
*/


			map.setCenter(nasherLoc, 17);
			map.setMapType(G_SATELLITE_MAP)
			map.setUIToDefault();
			map.addOverlay(marker);
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(infoWindowHtml);
			});

			marker.openInfoWindowHtml(infoWindowHtml);
		}
	
	}
}

$(function() {
	initialize();
});


$(function() {
	startList();
});

