function openExportOpts(theType){
	if (theType == "image") {
		Win1 = window.open("ExportImage.htm","FormWindow","left="+((screen.width/2)-170)+",top="+((screen.height/2)-170)+",width=400,height=300,scrollbars=no,status=yes,resizable=no");
	}else{
		Win1 = window.open("ExportPrint.htm","FormWindow","left="+((screen.width/2)-170)+",top="+((screen.height/2)-170)+",width=590,height=370,scrollbars=no,resizable=no");
	}
	addWin(Win1);
}
var imsLayoutUrl = imsURL;
var layoutScale = 0;
var inchesPerMapUnit = 39.37;
var textFrame = null;
var layoutType = "";
var	layUser = "";
var layUserRole = "";
var	layTitle = "Mackay Print Map";
var layFileN = "";
var layLegend ="";

function printLayout() {
	var windowHeight = 250;
	var windowWidth = 450;
	var windowTop = ( screen.height - windowHeight ) / 2;
	var windowLeft = ( screen.width - windowWidth ) / 2;
    hideLayer("measureBox");
    var printForm = "layoutPrintform.htm";
	printWindow = windows.add(printForm,"PrintFormWindow","width=" + windowWidth + ",height=" + windowHeight + ",top=" + windowTop + ",left" + windowLeft + ",scrollbars=no,resizable=no");
	printWindow.focus();
}

// Sets and sends variables for the Export to Image functionality
function getLayout(theType, width, height, dpi) {
		isGet_Layout = true;
		layHeight = height;
		layWidth = width;
		layDPI = dpi;
		imageType = theType;
		writeXMLASP(101);
}

function getLayoutPrint(layoutT, layoutScale, layoutLegend, layoutTitle, fileNo, User, userRole) {
	isGet_Layout = true;
	imageType = "jpg";
	layDPI = 300;
	layUser = User;
	layUserRole = userRole;
	layTitle = layoutTitle;
	layFileN = fileNo;
	layoutType = layoutT;
	layLegend=layoutLegend;
	switch (layoutType){
		case "A4P":
			layHeight = 805;
			layWidth = 645;
			break;
		case "A4L":
			layHeight = 500;
			layWidth = 895;
			break;
		case "A3P":
			layHeight = 1250;
			layWidth = 950;
			break;
		case "A3L":
			layHeight = 800;
			layWidth = 1400;
			break;
	}
	if (layoutScale > 0) {
		tLeft = left;
		tRight = right;
		tBottom = bottom;
		tTop = top;
		var iScaledWidth = layWidth/96 * layoutScale / inchesPerMapUnit
		var iScaledHeight = layHeight/96 * layoutScale / inchesPerMapUnit
		var xCenter = (parseFloat(right) + parseFloat(left)) / 2
		var yCenter = (parseFloat(top) + parseFloat(bottom)) / 2
		left = xCenter - iScaledWidth/2
		right = xCenter + iScaledWidth/2
		bottom = yCenter - iScaledHeight/2
		top = yCenter + iScaledHeight/2
	}
	writeXMLASP(103);
}

function layoutTypeIsImage(theType) {
    if (theType=="ai" || theType=="emf" || theType=="eps" || theType=="pdf" || theType=="svg")
        return false;
    else
        return true;
}
