function Openwin(URL){
	WebMd = window.open(URL, "WebMdWindow")
	WebMdWindow.focus()
	}

function reportsArchive(x) {
		document.archive.reportnum.value = x;
		document.archive.submit();
	}

function login(){
        document.getElementById("LoginView1$Login1$UserName").value="Demo User";
        document.getElementById("LoginView1$Login1$Password").value="DemoPass$";
        var btn = document.getElementById("LoginView1$Login1$LoginButton");
        if (btn){
          btn.click(); }
        }

function popUp(url) {
        sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
        self.name = "mainWin";
        }

function openPDF(file) {
        var win = open(file,'ahgPDFWindow','width=800,height=600,resizable=yes,locationbar=no,menubar=no,scrollbars=yes,toolbar=no');
        win.focus();
        }

function checkrequired(which) {
	var msg = ("The following fields must be completed before submitting this form:\n");
	var msg2 = ("You must complete all fields in order to submit this form.");

	var pass=true;
	var blank=0;					//counter for empty elements
	var tot=which.elements.length;	//total number of elements in the form

        if (document.images) {
         for (i=0;i<which.length;i++) {
           var tempobj=which.elements[i];
           tempobj.value= tempobj.value.replace(/^[\s]+/g,"");

           if (tempobj.type=="hidden"){
           tot --;
          }

          if (((tempobj.type=="text"||tempobj.type=="textarea")&& tempobj.value=='')) {
           pass=false;
           //alert (tempobj.name +" ..." + tempobj.value +" .. "+tempobj.type);
           blank++;
           shortFieldName=tempobj.name.replace('_', ' ').replace('whoknows', 'comments').toUpperCase();
           msg += "  - "+shortFieldName +"\n";
           }

          }
         }
	//alert ("there were " +blank +" blank elements");

	if (blank > 0) {
		//alert (msg);
		alert (msg2);
		return false;
	}
	else
		return true;
}
