var remote_url = 'http://research.google.com/archive/bigtable-osdi06.pdf';
var result = M.plugin('viewer.doc').gview(remote_url);
if(result.status != 'SUCCESS') {
	// TODO : url이 유효하지 않은경우
	console.log(result.message);
}
var remote_url = 'http://research.google.com/archive/bigtable-osdi06.pdf';
M.net.http.download(remote_url, {
	finish : function(status, header, fileinfo, setting) {
		// TODO : upload finished code here.
		console.log(status, JSON.stringify(header, null, 4), JSON.stringify(fileinfo, null, 4), setting);
		if (status == 200) {
			// NOTICE : download 받은 pdf 파일을 viewer로 연다.
			var localpath = fileinfo.fullpath;
			var result = M.plugin('viewer.doc').open(localpath);
			if( result.status != 'SUCCESS' ) {
				// TODO : case1) 파일을 찾을 수 없는 경우
				// TODO : case2) 열수없는 확장자인 경우(iOS only)
			}
		}
		else if( status == -1 )  {
			// TODO : 데이터 통신을 못한경우
		}
		else {
			// TODO : 404, 500 error 등
		}
	},
	progress : function(total, current, setting) {
		// TODO : web download progress event code here.
		console.log(total, current);
	}
});