var NN = "";
var apptformwin = null;

function convertSpaces(str) {
var out = "", flag = 0;
for (i = 0; i < str.length; i++) {
if (str.charAt(i) != " ") {
out += str.charAt(i);
flag = 0;
}
else {
if(flag == 0) {
out += "%20";
flag = 1;
      }
   }
}
return out;
}

function openApptForm(NN) {
	
	if (apptformwin == null || apptformwin.closed) {
	
		formURL = "http://www.einstein.edu/ssi/appointment.html?ref=appt";
		gotoURL = formURL + NN;	
newURL = convertSpaces(gotoURL);

		if (navigator.appVersion.substring(0,1) < 4) {
			apptwinObj = window.open(newURL, 'apptwin', 'height=500,width=450,directories=0,menubar=0,resizable=1,scrollbars=1,status=1,location=0,toolbar=1');
			} else {
			apptwinObj = window.open(newURL, 'apptwin', 'height=500,width=450,directories=0,menubar=0,resizable=1,scrollbars=1,status=1,location=0,toolbar=0');
			}

	apptformwin = apptwinObj;
	} else {
		apptformwin.focus();
	}
}
