// setup browser test
//alert(navigator.appName);
//alert(navigator.appVersion);

var isNav = false;
var isNav4 = false;
var isNav5 = false;
var isIE = false;
var isIE4 = false;
var isIE5 = false;
var isIE55 = false;
var isIE6 = false;
var isWin = false;
var isSun = false;
var isMac = false;

isNav = (navigator.appName.indexOf("Netscape")>=0);
isIE = (navigator.appName.indexOf("Internet Explorer")>=0);
isWin = (navigator.appVersion.indexOf("Windows")>=0);
isSun = (navigator.appVersion.indexOf("SunOS")>=0);
isMac = (navigator.appVersion.indexOf("Mac")>=0);

if (isNav) {
	if (parseFloat(navigator.appVersion)<5) {
		isNav4 = true;
	} else {
		isNav5 = true;
	}
} else if (isIE) {
	if (navigator.appVersion.indexOf("MSIE 4")>0) {
		isIE4 = false;
	} else if (navigator.appVersion.indexOf("MSIE 5.0")>0) {
		isIE5 = true;
	} else if (navigator.appVersion.indexOf("MSIE 5.5")>0) {
		isIE55 = true;
	} else if (navigator.appVersion.indexOf("MSIE 6")>0) {
		isIE6 = true;
	}
}
	

function displaymapper(mappertype) {
var urlstring = "";
var mapperWin;
var windowstring = "";
var pix;
var pixwidth;
var pixheight;
var applaunch = false;
var addNS = 0;

if (navigator.appName=="Netscape") {
	addNS = 4;
}
	
	
		if (isNav4) {
			var msg = "The Map Production Laboratory currently is only supported under Internet Explorer 5.5+.  We apologize for any inconvenience.\n\n";
			alert(msg);
			applaunch = false;
			//return false;
		} else {
		
		
		pix = screen.width
		if (pix <= 750) {
			
			var msg = "Your current screen resolution is "+ screen.width + " x " + screen.height + " pixels.\n\n";
			msg=msg+ "The Map Production Lab currently does not support screen resolutions smaller than 800 x 600 pixels.  Please increase your screen resolution then try entering the Map Lab again.  Our recommended setting is 1024 x 768 pixels.\n\n";
			msg=msg+ "On Windows PCs, you can increase your screen resolution by right-clicking on the Windows background and selecting Properties.  Click on the Settings tab and change the Screen Area value."
			alert(msg);
		
			applaunch = false;
			return false;
	
		} else if (pix <= 850) {
	
			var msg = "Your current screen resolution is "+ screen.width + " x " + screen.height + " pixels.\n\n";
			msg=msg+ "Some graphics and text of the Map Production Lab may not display properly. Our recommended setting is 1024 x 768 pixels.\n\n";
			msg=msg+ "On Windows PCs, you can increase your screen resolution by right-clicking on the Windows background and selecting Properties.  Click on the Settings tab and change the Screen Area value."
			alert(msg);
		
			pixwidth = 775;
			pixheight = 525;
			applaunch = true;
		
		} else {
			
			pixwidth = 850;
			pixheight = 600;
			applaunch = true;
		}
		}
	
		if (applaunch == true) {
			urlstring = "/website/mapprod/"
			if (!mapperWin || mapperWin.closed) {
				windowstring = "width="+pixwidth+",height="+pixheight+",scrollbars=no,resizable=no,status=yes,toolbar=no,location=no,directories=no,menubar=no"
				mapperWin = open(urlstring,"MapperWindow",windowstring);
			} else {
				mapperWin.focus();
			}	
		}
		
	




}





// set name so that the Explorer can interact with the portal
self.name = "ME_Portal";
self.focus();


/* Popup ME */
function pop(URL) {
	window.open(URL, "ME", "resizable,status,width=730,height=520");
}

function popWithPlace(URL) {
	var place = escape(Trim(document.findAPlaceForm.place.value));
	
	if (place != "") {
		pop(URL + "?goTo=findPlace&place=" + place);
	} else {
		alert("You must enter a place to find!");
		document.findAPlaceForm.place.value = ""; // get rid of any white space
		document.findAPlaceForm.place.focus();
	}
}


function onEnterImages(imgname) {
	eval('document.' + imgname + '.src = "images/' + imgname + '-over.gif"');
}

function offEnterImages(imgname) {
	eval('document.' + imgname + '.src = "images/' + imgname + '.gif"');
}




function checkForm() {

	var firstname = document.contactForm.firstname.value;
	var lastname = document.contactForm.lastname.value;
	var email = document.contactForm.email.value;
	var body = document.contactForm.inquiry.value;
	
	//var boxChk = false;
	//for (var i = 0; i < 4; i++) {
	//if (document.contactForm.to[i].checked) {
	//	boxChk = true;
	//	break
	//	}
	//}
	
	
	if (firstname.length < 1) {
		alert("Please enter your name.");
	} else if (lastname.length < 1){
		alert("Please enter your last name.");
	} else if (email.length < 3) {
		alert("Please enter your email.");
	} else if (body.length < 1) {
		alert("Please enter a message.");
	} else {
		//document.contactForm.subject.value = "DataMILcontact from " + fname.toString();
		//document.contactForm.ok.value = "window.location='http://datamil.udel.edu/home.asp?main=messagesent&toc=tocdatamilfaq'";
		//document.contactForm.sentHead.value = '<center><img src="http://datamil.udel.edu/images/Sendingmessage.gif"></center>';
		document.contactForm.submit();
	}

}