! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*-
!
! The contents of this file are subject to the Netscape Public License
! Version 1.0 (the "NPL"); you may not use this file except in
! compliance with the NPL.  You may obtain a copy of the NPL at
! http://www.mozilla.org/NPL/
!
! Software distributed under the NPL is distributed on an "AS IS" basis,
! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
! for the specific language governing rights and limitations under the
! NPL.
!
! The Initial Developer of this code under the NPL is Netscape
! Communications Corporation.  Portions created by Netscape are
! Copyright (C) 1998 Netscape Communications Corporation.  All Rights
! Reserved.


init_prefs RCDATA
BEGIN
"function isNumber(inputVal) {",
"   oneDecimal = false;",
"   inputStr = """" + inputVal;",
"   for (var i=0; i < inputStr.length; i++) {",
"       var oneChar = inputStr.charAt(i);",
"       if (i == 0 && oneChar == ""-"") {",
"           continue;",
"       };",
"       if (oneChar == ""."" && !oneDecimal) {",
"           oneDecimal = true; ",
"           continue;",
"       };",
"       if (oneChar < ""0"" || oneChar > ""9"") {",
"           return false;",
"       };",
"   };",
"   return true;",
"}",
"function isBoolean(inputVal) {",
"   inputStr = """" + inputVal;",
"	if ((inputStr == ""true"") || (inputStr == ""false""))",
"		return true;",
"    return false;",
"}",
"function preference(default_value) {",
"   this.default_value = default_value;",
"   this.user_value = null;",
"   this.locked = false;",
"};",
"",
"function pref_array(parent) {",
"    this.parent = parent;",
"};",
"",
"prefs = new pref_array(null);", 
"prefs.browser = new pref_array(""prefs"");",
"prefs.browser.startup = new pref_array(""prefs.browser"");",
"prefs.browser.startup.homepage = new preference(""http://home.netscape.com"");",
"prefs.browser.startup.autoload_homepage = new preference(true);",
"prefs.browser.cache = new pref_array(""prefs.browser"");",
"prefs.browser.cache.disk_cache_size = new preference(5000);",
"prefs.browser.cache.memory_cache_size = new preference(1024);",
"prefs.browser.cache.disk_cache_ssl = new preference(false);",
"prefs.browser.cache.wfe = new pref_array(""prefs.browser.cache"");",
"prefs.browser.cache.wfe.directory = new preference(null);",
"prefs.browser.main_window = new pref_array(""prefs.browser"");",
"prefs.browser.main_window.bottom = new preference(-1);",
"prefs.browser.main_window.left = new preference(-1);",
"prefs.browser.main_window.right = new preference(-1);",
"prefs.browser.main_window.top = new preference(-1);",
"prefs.browser.main_window.show = new preference(1);",
"prefs.network = new pref_array(""prefs"");",
"prefs.network.tcpbufsize = new preference(32768);",
"prefs.network.tcpbufsize2 = new preference(true);",
"prefs.network.tcpbufsize2.user_value = true;",
"prefs.network.use_async_dns = new preference(true);",
"prefs.network.max_connections = new preference(4);",
"prefs.network.speed_over_ui = new preference(true);",
"prefs.network.hosts = new pref_array(""prefs.network"");",
"prefs.network.hosts.smtp_server = new preference(""mail"");",
"prefs.network.hosts.pop_server = new preference(""mail"");",
"prefs.network.hosts.nntp_server = new preference(""news"");",
"prefs.network.hosts.socks_server = new preference(null);",
"prefs.network.hosts.socks_serverport = new preference(1080);",
"prefs.network.hosts.socks_conf = new preference(null);",
"prefs.security = new pref_array(""prefs"");",
"prefs.security.enable_java = new preference(true);",
"prefs.security.enable_javascript = new preference(true);",
"prefs.security.password_lifetime = new preference(10);",
"prefs.security.ask_for_password = new preference(false);",
"prefs.security.use_password = new preference(true);",
"prefs.security.enable_ssl2 = new preference(true);",
"prefs.security.enable_ssl3 = new preference(true);",
"prefs.mail = new pref_array(""prefs"");",
"prefs.mail.use_imap = new preference(false);",
"prefs.mail.use_exchange = new preference(false);",
"prefs.mail.thread_mail = new preference(false);",
"prefs.mail.sort_mail = new preference(false);",
"prefs.mail.ascend_mail = new preference(false);",
"prefs.mail.leave_on_server = new preference(false);",
"prefs.mail.default_cc = new preference(null);",
"prefs.mail.show_headers = new preference(false);",
"prefs.mail.max_size = new preference(-1);",
"prefs.mail.check_time = new preference(10);",
"prefs.mail.pop_name = new preference(null);",
"prefs.mail.remember_password = new preference(false);",
"prefs.mail.pop_password = new preference(null);",
"prefs.mail.auto_quote = new preference(true);",
"prefs.mail.fixed_width_messages = new preference(true);",
"prefs.mail.quoted_style = new preference(2);",
"prefs.mail.quoted_size = new preference(0);",
"",
"function str_escape(inputVal) {",
"	strRet = """";",
"	for (i = 0 ; i < inputVal.length; i++) {",
"		if (inputVal.charAt(i) == '\\\\') {",
"			strRet = strRet + ""\\\\\\\\"";",
"		}",
"		else strRet = strRet + inputVal.charAt(i);",
"	}",
"    return strRet;",
"}",
"function save_uservals(obj, obj_name) { ",
"    var result = """"; ",
"    var bGroup = false; ",
"    for (var i in obj) {",
"       if (i == ""parent"") bGroup = true; ",
"		if (i != ""parent"") {",
"           if ((i == ""user_value"")) {",
"				if ((isNumber(obj[i])) || (isBoolean(obj[i])))",
"					result += obj_name + ""."" + i + "" = "" + obj[i] + "";\\n"";",
"				else if (obj[i])",
"					result += obj_name + ""."" + i + "" = \\"""" + str_escape(obj[i]) + ""\\"";\\n"";",
"			}",
"			if (bGroup) result += save_uservals(obj[i],obj_name + ""."" + i); ",
"		}",
"	}",
"   return result; ",
"}"
END
