// JavaScript Documentfunction printArray(arr){

// The answer:  A bench in the woods

/*
 *	@author Clint
 *
 * 	Takes an array and forms an alert message which will display each entry
 *		in the array on separate lines
 */
function printArray(arr){
	var contents = "";

	for(i = 0; i < arr.length; i++){
		contents += arr[i] + "\n";
	}
	alert(contents);	
}

/*
 * @author Clint
 *
 * Returns an array of file names of all the jpg's in a folder
 *
 * @param dirName		directory to query
 * @return				array containing jpg file names in dirName
 */
function readDir(dirName){
	var picNameArray = new Array();
	var picresults = httpGetText(dirName);

	var re = /\">(\w+.jpg)<\/a>/;			// RegExp to parse out the pic name
											// Note: currently only gets the jpg's, I can change this when needed
											
	var matchResults = re.exec(picresults);		// exec() executes the regexp on the passed string (picresults)
												// http://www.regular-expressions.info/javascript.html for more info
	/*
		matchResults will only get the first match, while loop used to get all subsequent ones
		
		matchReults[0] = whole text which matched the RegExp re
		matchReults[1] = first capturing group, in the case the jpg file name 
	
		Note: Though there can be multiple regexp's, there is only one global RegExp object.
		
		RegExp.leftContext = text occuring before the match
		RegExp.rightContext = text occuring after the match 
	*/

	picNameArray[0] = matchResults[1];
	
	var toScan = RegExp.rightContext;		// Start the next search after the current match
	var index = 1;							// index to use in picNameArray
	
	while(matchResults != null) {
		matchResults = re.exec(toScan);
		if(matchResults != null){
			picNameArray[index] = matchResults[1];
			index++;
			toScan = RegExp.rightContext;
		}
	}

	return picNameArray;
}

/*
 * @author TheInternet
 *
 * @param aURL			URL to query
 * @return				http results of the url query		
 */
function httpGetText(aURL) {
  var req = new XMLHttpRequest();
  req.open('GET', aURL, false); 
  req.setRequestHeader("If-Modified-Since", new Date(0));
  req.send(null);
  return req.responseText;
}


/*
 * @author Clint
 *
 *
 */
function removeWhitespace(filePath){
	var code = httpGetText(filePath); 
	code = removeSingleLineComments(code);
	code = removeLongComments(code);
	
}
 
function removeSingleLineComments(string){}

function removeLongComments(string){}
