Help! I am trying to pass newsID into the final filename that is downloaded via phonegap in the below example.. The first alert reports that the newsID is working but then after that the variable is undefined? please can anyone suggest any advice?

Thanks for any help in advance!

Code:
 function downloadFileNews(newsID){
	  

	  alert ('downloading '+newsID);
	  
		  
		  				
								
						window.requestFileSystem(
									 LocalFileSystem.PERSISTENT, 0, 
									 function onFileSystemSuccess(fileSystem,newsID) {
									 fileSystem.root.getFile(
									 

																					
												 "dummy.html", {create: true, exclusive: false}, 
												 function gotFileEntry(fileEntry){
												 var sPath = fileEntry.fullPath.replace("dummy.html","");
												 var fileTransfer = new FileTransfer();
												 fileEntry.remove();
				 

				 
												 fileTransfer.download(
														    "http://gwc.dreamshock.com/newsImages/thumbs/"+newsID+"_1.jpg",
														   sPath + "22257_1.jpg",
														   function(theFile) {
														   console.log("download complete: " + theFile.toURI());
														   showLink(theFile.toURI());
														   },
														   function(error) {
														   console.log("download error source " + error.source);
														   console.log("download error target " + error.target);
														   console.log("upload error code: " + error.code);
														   }
														   );
												 }, 
												 fail);
									 }, 
									 fail);
									 
			
					  
			
 
    }