//opens a new window
function NewWindow(url, windowName, w, h, scroll) {
   var windowLeft = (screen.width - w) / 2;
   var windowTop = (screen.height - h) / 2;
   
   var windowProps = 'height=' + h + ',width=' + w + ',top=' + windowTop + ',left=' + windowLeft + ',scrollbars=' + scroll + ',resizable';
   
   window.open(url, windowName, windowProps);
}


//function creates the querystring mapquest is expecting
function makeQueryString(x){
	var str = "http://www.mapquest.com/directions/main.adp?2a=" + x['2a'].value + "&2c=" + x['2c'].value + "&2s=" + x['2s'].value + "&2z=" + x['2z'].value + "&go=1&do=nw&un=m&c1=EN&ct=NA&1a=" + x['1a'].value + "&1c=" + x['1c'].value + "&1s=" + x['1s'].value + "&1z=" + x['1z'].value;

	NewWindow(str, "direx", 570, 400, "yes")
	return false;
}


//check values in contact form
function checkContactForm(frm){
	if (frm.from.value == ""){
		alert("Please enter your name.");
		return false;
	}else if(frm.email.value == ""){
		alert("Please enter your email address.");
		return false;
	}else if(!frm.subject[0].checked && !frm.subject[1].checked && !frm.subject[2].checked && !frm.subject[3].checked && !frm.subject[4].checked){
		alert("Please select the subject of this email.");
		return false;
	}else if(frm.body.value == ""){
		alert("Please enter the body of your message.");
		return false;
	}else{
		return true;
	}
}