﻿    MyArray = new Array();
    //MyArray[MyArray.length] = new objFacility(...);

   
    function GetFields() {
       
        //Is timer passed?
        
        //window.status = "Saving..."

            PageMethods.GetFields(FillFields);
       
        //endAutoSave();
 
     }   
     
    function FillFields(result) {
    
        MyArray = result;
        
		for (var i = 0; i < MyArray.length; i++) {
        
            if (MyArray[i].isRequired) {           
                $get(MyArray[i].RequiredLabel).innerHTML = MyArray[i].RequiredValue;
            }
        
            MyArray[i].RequiredValue
		}
        
        
    }
   
    function SaveField() {
       
        //Is timer passed?
        
        //window.status = "Saving..."

            PageMethods.ValidateForm(FieldList, UpdateLabel);
       
        //endAutoSave();
 
     }
     
     function UpdateLabel(result)
    {
            $get(result.theLabel).innerHTML = result.theValue;
    }

    function OnSucceeded() {
       // Display "thank you."
       //$get("Success").innerHTML = "<p>Thank you!</p>";
    }

    function OnFailed(error) {
       // Alert user to the error.
       //alert(error.get_message());
    }


	function startAutoSave() {
	
		if (oInterval == null) {
            initAutoSaveTimer();
		}

	}
	
    window.onfocus =
    function window_onfocus ()
    {
    
        //startAutoSave();
        
    }
    
	function SetActiveField(thisLabel,thisObject, AssmtFormAssndPK, isAutoSave) {
	
	    AutoSaveActiveFieldLabel = thisLabel;
	    AutoSaveActiveFieldObject = thisObject;
	    AutoSaveAssmtFormAssndPK = AssmtFormAssndPK;
	    
	    if (isAutoSave) {
    	    startAutoSave();  
    	}
    	else {  
        	endAutoSave();
	    }
	    
	}