function WSMcopydata (theform, thecheckbox, thefromfield, thetofield){
	if ((thecheckbox.checked) && (thefromfield.value != '')) {
	thetofield.value = thefromfield.value
	} else {
	thetofield.value = ''
	}
	return true;
}


function WSMcopydatastring (theform, thecheckbox, thefromstring, thetofield){
	if ((thecheckbox.checked) && (thefromstring != '')) {
	thetofield.value = thefromstring
	}
	if (!(thecheckbox.checked) && (thefromstring != '')) {
	if (thetofield.value.length < thefromstring.length+10) {
	thetofield.value = ''
	}
	}
	return true;
}


function openWindow(url, name, w, h, otherfeatures) {
var popupWin;
if (otherfeatures != "") {
	popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ',' + otherfeatures);
} else {
	popupWin = window.open(url, name, 'left=50,right=50,top=50,resizable=no,scrollbars=no,menubar=no,directories=no,width=' + w + ',height=' + h);
}
	// reference the new window and create a 'creator' object that allows the new window to talk BACK to this document
	popupWin.creatorwindow   = self;
	popupWin.creatordocument = this.document;
}
function openScrollWindow(url, name, w, h, otherfeatures) {
var popupWin;
if (otherfeatures != "") {
	popupWin = window.open(url, name, 'scrollbars=yes,width=' + w + ',height=' + h + ',' + otherfeatures);
} else {
	popupWin = window.open(url, name, 'left=50,right=50,top=50,resizable=no,scrollbars=yes,menubar=no,directories=no,width=' + w + ',height=' + h);
}
	popupWin.creatorwindow   = self;
	popupWin.creatordocument = this.document;
}


// return difference or if fails... 9
function datediff(fromdatestring,todatestring) {
	//var fromdatestring = '1\/5\/2110'; 
	//var todatestring = '1\/7\/2110'; 
	var fromdate = new Date(fromdatestring);
	var todate = new Date(todatestring);
	var thedatediff = todate.getTime() - fromdate.getTime();
	thedatediff = Math.floor(.1 + (thedatediff / (1000*60*60*24)));
	if ((thedatediff > 0) && (thedatediff < 1000)) {
	// GREATER... OK SO RETURN THE DIFFERENCE
	return (thedatediff);
	} else if ((thedatediff < 0) && (thedatediff > -1000)) {
	alert('Warning. You\'ve specified an end date earlier than your start date.');
	return (0);
	} else {
	// FAILED, SO RETURN 0
	return (0);
	}
}


