/*

Copyright (c) 2005, Daniel Juliano
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this 
      list of conditions and the following disclaimer.
    * The names of contributors to this source code may not be used to endorse 
      or promote products derived from this software without specific prior 
      written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

/*

Script Summary:

*/

function saveSubmit() {
	var xml = "<root>\n";
	var record = "";
	
	xml += "<list_prefs>\n";
	/*
	xml += "\t<record>\n";
	xml += "\t\t<key/>\n";
	xml += "\t\t<value/>\n";
	xml += "\t</record>\n";
	*/
	xml += "</list_prefs>\n";
	
	xml += "<list_titles>\n";
	for (var i = 0; i < mainTitles.length; i++) {
		xml += "\t<record>" + mainTitles[i] + "</record>\n";
	}
	xml += "</list_titles>\n";
	
	xml += "<list_contacts>\n";
	for (var i = 0; i < mainContacts.length; i++) {
		record = "\t<record>\n";
		for (var j = 0; j < mainContacts[i].length; j++) {
			record += "\t\t<a" + j + ">" + mainContacts[i][j] + "</a" + j +">\n";
		}
		record += "\t</record>\n";
		xml += record;
	}
	xml += "</list_contacts>\n";
	
	xml += "</root>\n";
	document.getElementById("save_field").value = xml;
	document.save_form.submit();
}

function saveSetFlag() {
	document.getElementById("save_div").style.visibility = "visible";
}

