making phonegap deferred object global among scripts