<!--
var mywindow = null;
var curWindow = null;
var extraWindow = null;
var curExtraWindow = null;

// checks if the fields has a value
function emptyField(textObj) {
	if (textObj.value.length==0) return true;
	for(var i=0; i<textObj.value.length; i++)
	{
		var ch=textObj.value.charAt(i);
		if (ch != ' ' && ch != '\t') return false;
	}
	return true;
}

// validates the email field parameter is formobject.value
function validEmail(email) {
	var index;
	
	if (email == "") {
		return true;
	}
	
    var emailReg = /^([\w-\+]+(?:\.[\w-\+]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    var regex = new RegExp(emailReg);
    return regex.test(email);	
}

// opens a window to display an enlarged view of the patient picture
function showPicture(whichImage) {
	var whereToGo = "patience" + whichImage;
	if (mywindow != null && !mywindow.closed) {
		if (whereToGo == curWindow) {
			mywindow.focus();
		} else {
			mywindow.close();
		}
	}
	if (whereToGo != curWindow || mywindow.closed) {
		mywindow = window.open("showimage.asp?img=" + whichImage,"patientPicture","status=1,scrollbars=1,location=0,toolbar=0,menubar=0,resizable=1,width=550,height=500");
	}
	curWindow = whereToGo;
}

// creates countdown boxes to make textarea fields have a maxlenght
function counterTextArea(textField, counterField, limitTextField) {
	if (textField.value.length > limitTextField) {
		textField.value = textField.value.substring(0, limitTextField);
	} else {
		counterField.value = limitTextField - textField.value.length;
	}
}

function displayAllPatients(objForm, curScript) {
	var status;
	if (objForm.patientsall.checked) {
		status = 1;
	} else {
		status = 0;
	}
	document.location.href = curScript + '?showall=' + status;
}

// opens a window to display an enlarged view of the patient picture
function openNewWindow(url, param) {
	if (extraWindow != null && !extraWindow.closed) {
		if (url == curExtraWindow) {
			extraWindow.focus();
		} else {
			extraWindow.close();
		}
	}
	if (url != curExtraWindow || extraWindow.closed) {
		extraWindow = window.open(url,"InfoWindow", param);
	}
	curExtraWindow = url;
}

//-->
