<!--
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;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function sf() {
   document.login.username.focus();
}

function setupOrig() {
   
   //window.screenX = 0;
   //window.screenY = 0;
   //window.resizeTo(screen.width, screen.height);
   window.status = "Welcome to the CBRT System."
   top.defaultStatus = "Welcome to the CBRT System."

   if (document.login) {
      sf();
   }

}

function checkField(field) {
      alert("one");
      if (field.value == null || field.value == "")
      {
         alert("one");
         document.surveyform.firstname.focus();
      }
}

function checkUserSurveyFormFields(f) {

      if (f.firstname.value == null || f.firstname.value == "")
      {
         alert("Please enter your first name");
         f.firstname.focus();
         return false;
      }
      if (f.lastname.value == null || f.lastname.value == "")
      {
         alert("Please enter your last name");
         f.lastname.focus();
         return false;
      }
      if (f.phone.value == null || f.phone.value == "")
      {
         alert("Please enter your phone number");
         f.phone.focus();
         return false;
      }

}

function setFocused(f, obj) {
   obj.focus();
   return false;
}

function checkUserMailingFormFields(f) {
      if (f.firstname.value == null || f.firstname.value == "")
      {
         alert("Please enter your first name");
         f.firstname.focus();
         return false;
      }
      if (f.lastname.value == null || f.lastname.value == "")
      {
         alert("Please enter your last name");
         f.lastname.focus();
         return false;
      }
      if (f.phone.value == null || f.phone.value == "")
      {
         alert("Please enter your phone number");
         f.phone.focus();
         return false;
      }
      if ((f.email.value == null || f.email.value == "") &&
         ((f.addr1.value  == null || f.addr1.value == "") ||
          (f.addr2.value  == null || f.addr2.value == "") ||
          (f.city.value  == null || f.city.value == "") ||
          (f.state.value  == null || f.state.value == "") ||
          (f.zip.value  == null || f.zip.value == "")))
      {
         var msg = "We need a valid email address or mailing address.\n"
             msg += "If you would like receive eLetters please provide your email address.\n"
             msg += "If you would like receive Mail Flyers please provide your email address.\n";

         alert(msg);
         f.email.focus();
         return false;
      }
}

function toggle(targetId) {
   if (document.getElementById) {
      target = document.getElementById(targetId);
      //target.style.display = "";
        if (target.style.display == "none") {
			  /*
			  // This was used to turn off all the other tables
           for (x = 0; x < 2; x++) {
              aaa = document.getElementById(x); 
              aaa.style.display = "none";
           }
			  */
           target.style.display = "";
        } else {
           target.style.display = "none";
        }
    }
}
function toggleView(targetId) {
   if (document.getElementById) {
      target = document.getElementById(targetId);
      //target.style.display = "";
        if (target.style.display == "none") {
           /*
           // This was used to turn off all the other tables in ODEL
           for (x = 0; x < 2; x++) {
              aaa = document.getElementById(x); 
              aaa.style.display = "none";
           }
           */
           target.style.display = "";
        } else {
           target.style.display = "none";
        }
    }
}
function hideHelp(targetId) {
   if (document.getElementById) {
      target = document.getElementById(targetId);
      //target.style.display = "";
      target.style.display = "none";
    }
}

function viewHelp(targetId, context) {
	if (document.getElementById) {
      target = document.getElementById(targetId);
      target.style.display = "";

		var dataFld = document.getElementById('dataField');
		
		if (context == "collection") {
		  dataFld.innerHTML = "The <strong>CBRT</strong> system is built for processing Capital Budget Requests. ";
		  target.scrollIntoView(false);
		  
		} else if (context == "bkstatus") {
		  dataFld.innerHTML = "<strong>CBRT Info</strong> - ";
		  target.scrollIntoView(false);
		  
		} else if (context == "general") {
		  dataFld.innerHTML = "This is the real-time, self-help section. This section is available with useful information throughout the application.";
		  target.scrollIntoView(false);				  
		}

	}
}

function setInnerHtml(targetId, content) {
   if (document.getElementById) {
      target = document.getElementById(targetId);
      //target.style.display = "";
      target.innerHTML = content;
   }
}


function yesHelp(targetId1, targetId2) {
	if (document.getElementById) {
      target1 = document.getElementById(targetId1);
		target1.style.visibility = "visible";

		target2 = document.getElementById(targetId2);
		target2.style.visibility = "visible";
	}
}

function noHelp(targetId1, targetId2) {
	if (document.getElementById) {
      target1 = document.getElementById(targetId1);
		target1.style.visibility = "hidden";

		target2 = document.getElementById(targetId2);
		target2.style.visibility = "hidden";
	}
}


function checkSurvey(f) {

   if ((f.pna1courtpleas[0].checked != true || f.pna1courtpleas[1].checked != true) &&
       (f.sales1courtpleas[0].checked != true || f.sales1courtpleas[1].checked != true) &&
       (f.serv1courtpleas[0].checked != true || f.serv1courtpleas[1].checked != true)) {
         alert("Please answer the first question (yes/no) before submitting");
         return false;
   }

   if (f.pna1courtpleas[0].checked == true || f.pna1courtpleas[1].checked == true) {
      if (f.pna1timely[0].checked != true || f.pna1timely[1].checked != true) {
         alert("Please answer the second question before continuing.");
         return false;
      } else if (f.pna1know[0].checked != true || f.pna1know[1].checked != true) {
         alert("Please answer the third question before continuing.");
         return false;
      } else if (f.pna1instock[0].checked != true || f.pna1instock[1].checked != true) {
         alert("Please answer the fourth question before continuing.");
         return false;
      } else if (f.pna1selection[0].checked != true || f.pna1selection[1].checked != true) {
         alert("Please answer the fifth question before continuing.");
         return false;
      } 
      //else if (f.pna1heardeal != true || f.pna1heardeal != true) {
        // alert("Please answer the fifth question before continuing.");
        // return false;
      //}
   } else if (f.serv1courtpleas[0].checked == true || f.serv1courtpleas[1].checked == true ) {
      if (f.serv1timely[0].checked != true || f.serv1timely[1].checked != true) {
         alert("Please answer the second question before continuing.");
         return false;
      } else if (f.serv1completed[0].checked != true || f.serv1completed[1].checked != true) {
         alert("Please answer the third question before continuing.");
         return false;
      } else if (f.serv1clean[0].checked != true || f.serv1clean[1].checked != true) {
         alert("Please answer the fourth question before continuing.");
         return false;
      } 
      //else if (f.pna1heardeal != true || f.pna1heardeal != true) {
        // alert("Please answer the fifth question before continuing.");
        // return false;
      //}
   } else if (f.sales1courtpleas[0].checked == true || f.sales1courtpleas[1].checked == true) {
      if (f.sales1timely[0].checked != true || f.sales1timely[1].checked != true) {
         alert("Please answer the second question before continuing.");
         return false;
      } else if (f.sales1know[0].checked != true || f.sales1know[1].checked != true) {
         alert("Please answer the third question before continuing.");
         return false;
      } else if (f.sales1info[0].checked != true || f.sales1info[1].checked != true) {
         alert("Please answer the fourth question before continuing.");
         return false;
      } else if (f.sales1clean[0].checked != true || f.sales1clean[1].checked != true) {
         alert("Please answer the fifth question before continuing.");
         return false;
      } 
   }
}

function openWinA(url) {
	if (url.length > 0) {
		window.open(url, "WinA", "location=1,toolbar=0,menubar=1,status=1,scrollbars=1,resizable=1,width=950,height=550");
//		WinA.moveTo(10,10);
	} 
}

function openWinDownload(url) {
	if (url.length > 0) {
		window.open(url, "WinA", "location=1,toolbar=0,menubar=1,status=1,scrollbars=1,resizable=1,width=1000,height=650");
//		WinA.moveTo(10,10);
	} 
}

function applyAll(form,gidList) {
	for (y = 0; y < document.forms[1].elements.length; y++) {
		if ((document.forms[1].elements[y].type == "checkbox") && (document.forms[1].elements[y].checked == false)) {
			document.forms[1].elements[y].checked = true;
		} else {
			document.forms[1].elements[y].checked = false;
		}
	}
}

function submitForm(formId) {
	var formToSend = document.getElementById("formId");
	formToSend.submit();	
}

function setup() {
	initDate('dtField');
}

function initDate(field) {
   var dayName = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
   var monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
   
   var now = new Date();
   var dtString = dayName[now.getDay()] + ", " + monName[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear();
   document.getElementById(field).innerHTML = dtString;
}

function clearError(field) {
	var fieldValue = document.getElementById(field).value;
   if (fieldValue == "MISSING VALUE - PLEASE ENTER") {
      //alert(fieldValue);
      document.getElementById(field).value = "";
   }
}
function contactFormValidate() {
	var maxLength = 1000;
	var value = document.getElementById("comments").value;
	if (value.length > maxLength) {
      document.getElementById("comments").value = value.substr(0,maxLength);
	}
}
function registerFormValidate() {
   var maxLength = 1000;
   var value = document.getElementById("comments").value;
   if (value.length > maxLength) {
      document.getElementById("comments").value = value.substr(0,maxLength);
   }
}
function displayTimestamp(item) {
   var dateNow = new Date();
   var realMonth = dateNow.getMonth();
   realMonth += 1;
   var realDay = dateNow.getDate();

   var realHours = dateNow.getHours();

   var realMinutes = dateNow.getMinutes();
   realMinutes += 1;
   var realSeconds = dateNow.getSeconds();
   realSeconds += 1;
   
   item.value = dateNow.getFullYear() + "-" + twoDigits(realMonth) + "-" + twoDigits(realDay) + " " + twoDigits(realHours) + ":" + twoDigits(realMinutes) + ":" + twoDigits(realSeconds);
}

function twoDigits(field) {
   var newValue = field;
   //alert("Field length is " + field.toString().length);
   if (field.toString().length < 2) {
      newValue = "0";
      newValue += field;
   }
   return newValue;
}
-->