/*
 * Create an object to handle all of the Connection Manager custom events.
 *
 * NOTE: You can also choose to represent your event handlers as global
 * functions instead of object members, and omit the scope argument from
 * subscribe().
 */
(function(){
    var handleEvents = {
            start:function(eventType, args){
                var loading_indicator = YAHOO.util.Dom.get('indicator');
                loading_indicator.style.display = "block";
//                alert("ya!");
            // do something when startEvent fires.
            // Argument eventType will have a string value of: startEvent
            // Argument args is an array, and the response object will be the
            // first element in the array.  The response object will have one
            // property: tId (the transaction ID).
            },
            complete:function(eventType, args){
                var loading_indicator = YAHOO.util.Dom.get('indicator');
                loading_indicator.style.display = "none";
//                alert("ay!");
            // do something when completeEvent fires.
            }
    //
    //	success:function(eventType, args){
    //	// do something when successEvent fires.
    //	},
    //
    //	failure:function(eventType, args){
    //	// do something when failureEvent fires.
    //	},
    //
    //	// Define this event handler for file upload transactions *only*.
    //	// This handler will not be used for any other transaction cases.
    //	upload:function(eventType, args){
    //	// do something when uploadEvent fires.
    //	},
    //
    //	abort:function(eventType, args){
    //	// do something when abortEvent fires.
    //	}
    };

    // Subscribe to all custom events fired by Connection Manager.
    // Pass in the *globalEvents* object as the second argument to provide
    // the necessary scope correction for any usage of the *this* keyword
    // in any of the handler functions.
    YAHOO.util.Connect.startEvent.subscribe(handleEvents.start, handleEvents);
    YAHOO.util.Connect.completeEvent.subscribe(handleEvents.complete, handleEvents);
})();


