// JavaScript Document
function sizeWin(URL, w, h) {	theWIn = window.open(URL,"PopDialog","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + w + ",height=" + h + ",screenX=25,screenY=25,top=25,left=25");
	if (window.focus) {theWIn.focus();}
}

function bold(id,ynb,clr) {
  if (document.getElementById) {
    if(!(ynb=="" || ynb==null)){document.getElementById(id).style.fontWeight = ynb;}
	if(!(clr=="" || clr==null)){document.getElementById(id).style.color = clr;}
  }
  else if (document.all) {
     if(!(ynb=="" || ynb==null)){document.all[id].style.fontWeight = ynb;}
	if(!(clr=="" || clr==null)){document.getElementById(id).style.color = clr;}
  }
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function formCheckB() {
	
	// ARRAY OF ARGUMENT VALUES
    var textRequired= formCheckB.arguments;

    // THE NUMBER OF ARGUMENTS PASSED TO THIS FUNCTION
    var argc = formCheckB.length;
	//alert(textRequired);
	var radioRequired = new Array();
	var checkRequired = new Array();
	//var textRequired = Array("");
	var textColorFail = "#FFFF99"; // Set text color for when the validaion failed
	var fieldsFailed ="";
	var i=0;
	var formobj=textRequired[0];
	//var formobj="surveyvl";
	//var which = document.surveyvl;
	var failMssg = false;  // If failMsg = false then return true in function	
	//Validate Text Field
	var textCount=0;	
	var sText = '';
	//alert(textRequired.length);
	for (var k = 1; k < textRequired.length; k++){
		var valid = false;
		sText = eval("document."+formobj+"."+textRequired[k]+".value");
		sText = trim(sText);
		if (sText=='') {document.getElementById(textRequired[k]).style.backgroundColor=textColorFail; failMssg = true;}
		//alert(document.getElementById(textRequired[k]).style.backgroundColor);
	
	}
	
	if (failMssg) {
		alert('Please complete the information that is in yellow. Thank you.');
		return false;
	}else{
		return true;
	}
}
