function valRequired(obj, name) {
	var retVal = true;

	if (obj.type == "text" || obj.type == "textarea") {
		if (obj.value.length == 0) {
			alert("Please enter a value for the " + name + " field.");
			obj.focus();
			retVal = false;
		}
	} else if (obj.type == "select-one") {
		if (obj.options[obj.selectedIndex].value == "NONE" || obj.options[obj.selectedIndex].value == "" || (obj.selectedIndex==0&&obj.options[0].value==""&&obj.type == "select-one")) {
			alert("Please pick one of the options for the " + name + " field.");
			
			if (obj.type == "select-one") {
				obj.focus();
			}
			retVal = false;
		}
	} else if (obj[0] && typeof(obj) != "string") {
		var noneChecked = true;
		for (var i = 0; i < obj.length; i++) {
			if (obj[i].checked)
				noneChecked = false;
		}
		if (noneChecked) {
			alert("Please pick at least one of the answers to " + name + ".");
			obj[0].focus();
			retVal = false;
		}
	} else if (obj.type == "checkbox") {
		if (obj.checked==false) {
			alert("Please pick at least one of the answers to " + name + ".");
			
			obj.focus();
			
			retVal = false;
		}
	} 
	
	return retVal;
}


// General functions - Often useful

// Finds an object in a page by name - cross browser compatible
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// Shows or hides a layer - also cross browser compatible
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0       
   eval(winName + "=window.open(theURL,winName,features);");
   eval(winName + ".focus();");
}

function dropDown_SetSelectedText(o, val) {
	var i
	
	for (i=0;i<o.length;i++) {
		if (o.options[i].text==val) {
			o.options[i].selected=true;
		}
	}
}

function isint(s) {   
	var i;
	for (i = 0; i < s.length; i++) {
		// Check that current character is number.
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	
	return true; // All characters are numbers.
}


function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function formatCurrency(strValue)
{
	strValue = strValue.toString().replace(/\$|\,/g,'');
	dblValue = parseFloat(strValue);

	blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
	dblValue = Math.floor(dblValue*100+0.50000000001);
	intCents = dblValue%100;
	strCents = intCents.toString();
	dblValue = Math.floor(dblValue/100).toString();
	if(intCents<10)
		strCents = "0" + strCents;
	for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
		dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
		dblValue.substring(dblValue.length-(4*i+3));
	return (((blnSign)?'':'-') + '$' + dblValue + '.' + strCents);
}