		
	$(function(){
	
		// setup homepage slider
		$("#masthead").slides({
			preload: true,
			preloadImage: true,
			container: 'slides_container',
			generateNextPrev: true,
			next: 'next',
			prev: 'previous',
			pagination: true,
			generatePagination: true,
			paginationClass: 'masthead-pagination',
			fadeSpeed: 350,
			slideSpeed: 350,
			start: 1,
			effect: 'slide, fade',
			crossfade: true,
			randomize: false,
			play: 8000,
			pause: 2500,
			hoverPause: true,
			autoHeight: false,
			autoHeightSpeed: 350,
			bigTarget: false		
		});			
		

		if ($("#masthead a.previous").length >= 1) {		
			// position the previous arrow just before the first .masthead-pagination link		
			$("#masthead a.previous").position({
				of: $( ".masthead-pagination li a" ),
				my: "right center",
				at: "left center",				
				offset: '-7 -1',
				collision: 'none'
			});
			
			// position the previous arrow just before the first .masthead-pagination link		
			$("#masthead a.more").position({
				of: $( "#masthead p" ),
				my: "right center",
				at: "right center",				
				offset: '0 0',
				collision: 'none'
			});
		};		
		
		
		if ($("#map").length >= 1 ) {
			/* --- dialog scripts --- */
			var num = 1;
			$("#map_dialogs .dialog").each(function() {
				var dlg = $('#map_dialog'+num).dialog({
					bgiframe: true,
					autoOpen: false,
					width: 640, // [+padding:0 30px in styles.css]
					height: 380,
					resizable: false,
					modal: true,
					dialogClass: 'dialog_'+num,
					draggable: true,
					open: function(){closedialog = 1;},
					focus: function(){closedialog = 0;},
					close: function(){$(document).unbind('click');}
				});
				$('#map li.l'+num+' a').hover(function() {
					$(this).css({'z-index': "9999999"});				
				}, function() {
					$(this).removeAttr('style');
				});
				$('#map li.l'+num+' a').click(function() {
					dlg.dialog("open");
					return false;
				});
				num = num + 1;
			});
		}	
				
	});
