var window1
////////////////////////////////////////////////////////////////////////
function open_window(URL,WID,HITE){
window1 = window.open(URL,"window1",'toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + WID + ',height=' + HITE);
	}
////////////////////////////////////////////////////////////////////////
function closeWindow() {
	if (window1 && !window1.closed) {
		window1.close()
	}
}
////////////////////////////////////////////////////////////////////////
//function CheckNumber(numThis,Field) {
//	if (isNaN(numThis)) {
//		alert("Please enter only numbers, no #, oz, ct, doz, etc.");
//	}
//}
////////////////////////////////////////////////////////////////////////
function CheckNumber(fieldValue, fieldName) {
	if (isNaN(fieldValue) || fieldValue == "") {
		alert("Please enter only numbers, no #, oz, ct, doz, etc.");
	} else {
		if (fieldValue.indexOf('.') == -1) fieldValue += ".";
			dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
			if (dectext.length > 0) {
				alert ("Oops!  Please enter a whole number, no decimal places.  Please try again.");
		    } 
   	}
}
////////////////////////////////////////////////////////////////////////
function OpenComments (c) {
    window.open(c,
                    'comments',
                    'width=480,height=480,scrollbars=yes,status=yes');
}
////////////////////////////////////////////////////////////////////////
function OpenTrackback (c) {
    window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,status=yes');
}
////////////////////////////////////////////////////////////////////////
function formatStr (v) {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    if (!str) return;
    document.selection.createRange().text = '<' + v + '>' + str + '</' + v + '>';
}
////////////////////////////////////////////////////////////////////////
function insertLink () {
    if (!document.selection) return;
    var str = document.selection.createRange().text;
    if (!str) return;
    var my_link = prompt('Enter URL:', 'http://');
    if (my_link != null)
        document.selection.createRange().text = '<a href="' + my_link + '">' + str + '</a>';
}	
