<!--
function OpenTrayInfoPage() 
{
   if (navigator.appName == "Netscape")
   {
      window.open("RXET/Tray_Information/index.html", "TrayInfoPage",
                  "status=no,toolbar=no,menubar=no,scrollbars=yes,width=625,height=550,screenX=" + (screen.availWidth - 635) +
                  "screenY=0");
   }
   else
   {
      window.open("RXET/Tray_Information/index.html", "TrayInfoPage",
                  "status=no,toolbar=no,menubar=no,scrollbars=yes,width=625,height=550,left=" + (screen.availWidth - 635) +
                  "top=0");
   }
}

function ValidateForm()
{
	var sPatientName=document.order.Patient_Name.value;
	
   if (sPatientName == "")
   {
      alert("Patient Name can not be empty!");
      return false;
   }

   if (document.order.Type_Of_Lens.value == "")
   {
      alert("Lens Type can not be blank!");
      return false;
   }

   if (document.order.Tint.value == "")
   {
      alert("Tint can not be blank!!");
      return false;
   }

   if (!(((document.order.R_Base_Curve.value != "") &&
          (document.order.R_Power.value != "") &&
          (document.order.R_Diameter.value != "")) ||
         ((document.order.R_K_V.value != "") &&
          (document.order.R_K_H.value != "") &&
          (document.order.R_Spec.value != ""))))
   {
      alert("Either Base Curve, Power and Diameter or\n" +
            "K(V), K(H) and Spec can not be blank!!");
      return false;
   }
   return true;
}



function SubmitForm()
{
var SubmittingForm = false;
   if (SubmittingForm == false)
   {
      if (ValidateForm() == true)
      {
         document.order.submit();
         SubmittingForm = true;
      }
   }
}
function newWindow(){
window.open('/content/specialspop.asp','', 'location=no, width=400, height=400, scroll=auto')
}

function CancelOrder(){
	/***************************************************
	*bvb 06.17.2004
	*If the user is in the middle of building an order and decides to navigate
	*elsewhere in the application, the routine warns the user that he is about to
	*cancel his order.  If the user is simply viewing an existing order, this dialog
	*will not display.
	***************************************************/
	var sFormName=document.forms.item(0).id;
	var sMode=document.forms.item(0).txtMode.value;
	var bCancelOrder=true;
	
	if((sFormName=='SoftLensOrder' || sFormName== 'OrderReview' || sFormName== 'FinalProcessing') && sMode=='readwrite'){
		//var bCancelOrder = confirm('Press OK if you want to cancel your order.  Click Cancel to return to your order');
		bCancelOrder = confirm('Press OK if you want to cancel your order.  Click Cancel to return to your order');
	}
	
	return bCancelOrder;
}

function ActionValidates(sReqLogin){
	/***************************************************
	*bvb 06.17.2004
	*This routine is invoked by child menu items.  It first initiates the CancelOrder
	*function.  Next, if login is required, it looks to see if the user has logged in.
	*If not, it redirects the user to the login page.  If yes, it returns true and
	*allows the initial action to commence.
	***************************************************/
	var bCancelOrder = CancelOrder();	//do CancelOrder check first
	var bActionValidates=false;
	
	if(bCancelOrder==true){
		//if the user decides to cancel the order or if the CancelOrder is not
		//applicable, check to see if Login is required.
		if(sReqLogin.toString().toUpperCase()=='TRUE'){
			//if Login is required, check to see if the user has already logged in.
			//a hidden field called blnLoggedIn will contain "true" or "false" to
			//indicate whether the user has already logged in or not.
			if(document.forms.item(0).blnLoggedIn.value!='true'){
				//if the user has not already logged in to the application, redirect
				//him to the login page
				window.navigate('Login.aspx');
			}else{
				bActionValidates=true;
			}
		}else{
			bActionValidates=true;
		}
	}
	
	return bActionValidates;
}

function ViewProductInfoLinkValidated(){
	/***************************************************
	*bvb 06.21.2004
	*This routine validates that the user has chosen both a manufacturer and lens type
	*before he can view product information on the Soft Lens Order page.
	***************************************************/
	var oMfg=document.SoftLensOrder.ddlManufacturer;
	var oLensType=document.SoftLensOrder.ddlLensType;
	var bReturnVal=false;
	
	if(!oMfg.disabled && !oLensType.disabled){
		if(oMfg.options[0].selected==false && oLensType.options[0].selected==false){
			bReturnVal=true;
			//get selected values
			var sMfgId=oMfg.options[oMfg.selectedIndex].value;
			var sLensTypeId=oLensType.options[oLensType.selectedIndex].value;
			var sURL='ProductInfoDlg.aspx?MfgId=' + sMfgId + '&LensTypeId=' + sLensTypeId;
			
			window.open(sURL,'ProductInformation','width=450,height=600,scrollbars=yes,resizable=yes');
		}
	}
	
	if(bReturnVal==false){
		alert("You must select a Manufacturer and Lens Type before you can view Product Information.");
	}
	
	return bReturnVal;
}
//
// The below function will load today's date into the Rx_Date
// input which is used to specify the value that the RX was
// submitted.
//

var months = new Array();

months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";

function LoadTodaysDate()
{
   var date = new Date();

   document.order.Rx_Date.value =
      months[date.getMonth()] + " " + date.getDate() + ", " + " " + date.getFullYear();
}
-->