function CallApp() { 

  var MyURL = "http://www.sersol.com.au/cgi-bin/JTSXLive/login.r" 
  var Options = "status=yes,top=0,left=0"  // position to top left  
  var WinHdl  
  if (window.screen) {  
    var ah = screen.availHeight - 50; 
    var aw = screen.availWidth - 10;   
    Options += ",height=" + ah; 
    Options += ",innerHeight=" + ah; 
    Options += ",width=" + aw; 
    Options += ",innerWidth=" + aw;  
  } else { 
    Options += ",resizable"; // so the user can resize the window manually 
  }        
  // Open the new window.  
  WinHdl = window.open(MyURL, "", Options)       

  // Prepare the current one.
  window.opener=self

  // Destroy the current one.
  // window.close()  
}  


function ExitApp() { 
  setTimeout("parent.close()", 2000)
}  

function ErrorAlert() {
	
	// alert("here 0");
        
	// if (document.ErrorForm.ErrorFieldName.value == null || document.ErrorForm.ErrorFieldName.value == "" || document.ErrorForm.ErrorFieldName.value == "None")
        // {
	//       alert("here 1");
        //      // Focus to the first field
        //       FocusFirstField();     
        // }
        // else
        // {
        //       alert("here 2");
	//       FocusErrorFields(document.ErrorForm.ErrorFieldName.value,",");
        // }


	// alert(document.ErrorForm.ErrorField.value);
	if (document.ErrorForm.ErrorField.value == null || document.ErrorForm.ErrorField.value == "" || document.ErrorForm.ErrorField.value == "None")
	return;



	DisplayErrors(document.ErrorForm.ErrorField.value,"|");
  }

  function DisplayErrors(ErrorList,ListDelimiter){
  	var Errors=ErrorList.split(ListDelimiter);
	var Msg="";
	
	for (var i = 0; i < Errors.length; i++) {
		Msg += unescape(Errors[i])
		Msg += "\n"
    	}
 
        window.alert(Msg);   
   }


  function FocusErrorFields(ErrorList,ListDelimiter){
  	var Errors=ErrorList.split(ListDelimiter);

   	// test to see if target exists
   	for (var i = 0; i < document.MainForm.elements.length; i++) {
		for (var j = 0; j < Errors.length; j++) {
	   		if (unescape(Errors[j]) == document.MainForm.elements[i].name ) {
				ErrorField(i);
           		}
    		}

   	}
   }

  function FocusFirstField(){
	 for (var i = 0; i < document.MainForm.elements.length; i++) {
           if ( document.MainForm.elements[i].type != 'hidden' ) {
              FocusField(0);
              i = document.MainForm.elements.length
           }
        }
   }

 
   function ErrorField(FieldElement)
   {
       document.MainForm.elements[FieldElement].focus()
   }

   function FocusField(FieldElement)
   {
       document.MainForm.elements[FieldElement].focus()
   }
