function init() {
    console.log("accelerometer.init()");
    document.addEventListener("deviceready", function() {
            deviceReady = true;
            console.log("Device="+device.platform+" "+device.version);
        }, false);
    window.setTimeout(function() {
    	if (!deviceReady) {
    		alert("Error: Apache Cordova did not initialize.  Demo will not run correctly.");
    	}
    },1000);
}
Function called when page has finished loading.