﻿var mapSubWindow = null;

function openMapSubWindow ( image, name, width, height ) {
	
	var windowWidth  = width  + 50;
	var windowHeight = height + 60;
	
	if ( mapSubWindow ) {
		mapSubWindow.resizeTo( windowWidth, windowHeight );
	} else {
		var features = "width=" + windowWidth + ", height=" + windowHeight + ", menubar=no, location=no, resizable=yes, scrollbars=yes";
		mapSubWindow = window.open( image, "mapSubWindow", features );
	}
	
	mapSubWindow.document.open();
	mapSubWindow.document.write( "<html>" );
	mapSubWindow.document.write( "<head>" );
	mapSubWindow.document.write( "<title>" + name + "</title>" );
	mapSubWindow.document.write( "<style type='text/css'>" );
	mapSubWindow.document.write( "@import '/shared/scripts/shared.css';" );
	mapSubWindow.document.write( "@import './map.css';" );
	mapSubWindow.document.write( "</style>" );
	mapSubWindow.document.write( "</head>" );
	mapSubWindow.document.write( "<body class='subwindow'>" );
	mapSubWindow.document.write( "<div id='map'><img src='" + image + "' alt='[ Map ]' onclick='window.close()' /></div>" );
	mapSubWindow.document.write( "<p id='buttons' class='right'>" );
	mapSubWindow.document.write( "<a class='linkInline' href='#' onclick='window.print()'>Print</a>" );
	mapSubWindow.document.write( "<a class='linkInline' href='#' onclick='window.close()'>Close</a>" );
	mapSubWindow.document.write( "</p>" );
	mapSubWindow.document.write( "</body>" );
	mapSubWindow.document.write( "<html>" );
	mapSubWindow.document.close();
	
	mapSubWindow.focus();
	mapSubWindow.opener = self;
}

