	//MarkHealey.net
	//Inspiration from Scott Mitchell: http://www.4guysfromrolla.com/webtech/100604-1.shtml
	
	var f = $$('div#myform input');
	var needToConfirm = true;
	
	//Get all form field values
	var formDBVals = '';
	for(var i=0; i<f.length; i++){
		formDBVals += "'" + escape(f[i].value) + "', ";
	}
	formDBVals += "''";
	//New arrary to hold DB vals, before changes
	var the_values = new Array(formDBVals);

	//http://www.breakingpar.com/bkp/home.nsf/Doc%21OpenNavigator&87256B280015193F87256BFB0077DFFD
	function areArraysEqual(array1, array2) {
	   var temp = new Array();
	   if ( (!array1[0]) || (!array2[0]) ) { // If either is not an array
		  return false;
	   }
	   if (array1.length != array2.length) {
		  return false;
	   }
	   // Put all the elements from array1 into a "tagged" array
	   for (var i=0; i<array1.length; i++) {
		  key = (typeof array1[i]) + "~" + array1[i];
	   // Use "typeof" so a number 1 isn't equal to a string "1".
		  if (temp[key]) { temp[key]++; } else { temp[key] = 1; }
	   // temp[key] = # of occurrences of the value (so an element could appear multiple times)
	   }
	   // Go through array2 - if same tag missing in "tagged" array, not equal
	   for (var i=0; i<array2.length; i++) {
		  key = (typeof array2[i]) + "~" + array2[i];
		  if (temp[key]) {
			 if (temp[key] == 0) { return false; } else { temp[key]--; }
		  // Subtract to keep track of # of appearances in array2
		  } else { // Key didn't appear in array1, arrays are not equal.
			 return false;
		  }
	   }
	   // If we get to this point, then every generated key in array1 showed up the exact same
	   // number of times in array2, so the arrays are equal.
	   return true;
	}
	
	
	function confirmExitAccountInfo() {
		
		var formChangedVals = '';
		for(var i=0; i<f.length; i++){
			formChangedVals += "'" + escape(f[i].value) + "', ";
		}
		formChangedVals += "''";
	
		var the_changed_values = new Array(formChangedVals);

		if(needToConfirm) {
			if(!areArraysEqual(the_values,the_changed_values) ) {
				return "It appears you changed some info. Did you mean to leave without saving it?";
			}
		}
	}
	
	window.onbeforeunload = confirmExitAccountInfo;
