/* Javascript used by Content Management System */

<!--   hide this script from non-javascript-enabled browsers
// function that displays status bar message
var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
function dmim(msgStr) {
  document.returnValue = false;
  if (showMsg) { 
    window.status = msgStr;
    document.returnValue = true;
  }
}

// open window
function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
} 

// image preview	
function previewImg( windowURL, windowName, windowFeatures, textfield ) { 
	var image =  eval("document.editform." + textfield + ".value");
	var openURL = windowURL + "?Image=" + image;
	return window.open( openURL, windowName, windowFeatures ) ; 
} 

// stop hiding -->

// Qforms stuff 
/*  Must also include: <script src="includes/qforms/lib/qforms.js" type="text/javascript"></script> */
<!--//
	// set the path to the qForms directory
	qFormAPI.setLibraryPath("includes/qforms/lib/");
	// this loads all the default libraries
	qFormAPI.include("*");

//Test float fields to make sure they are proper floats (allows negative numbers)
function __IsNumericfloat()
{
// For foreign currencies, change the decimal to a comma on the next line:
var ValidChars = "01213456789.-";
var IsNumber = true;
var Char ;
var sText = this.value;
var numDecimals = 0;

for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
//Checks for minus sign
if (Char == '-' && i > 0)
{
IsNumber = false;
}
//Checks to make sure there is only 1 decimal point in the number
// For foreign currencies, change the decimal to a comma on the next line:
if (Char == '.')
{
numDecimals = numDecimals + 1;
}
}

if (numDecimals > 1 || IsNumber == false)
{
this.error = "The field " +
this.description + " does not contain a valid number";
}
}

_addValidator("IsNumericfloat",__IsNumericfloat);

//-->document.writeln ("<script src=\"\"><\/script>");

