function hidePrefs() { unselected('menu_prefs'); unhilite('prefs_close'); hideElem('prefs'); } function showPrefs() { if (!isDraggable()) hideAll(); else raiseWindow('prefs'); showElem('prefs'); selected('menu_prefs'); } function togglePrefs() { if (document.getElementById('prefs').style.display!='block') showPrefs(); else hidePrefs(); } function initPrefs() { defaultPrefs(); placeElem('prefs'); if (isDraggable()) getFile('prefs_menu_drag.html','prefs_top_drag','switchPrefs()'); else getFile('prefs_menu_dock.html','prefs_top_drag','switchPrefs()'); } function switchPrefs() { showPrefsGeneral(); } // Set defaults for the preference cookies function defaultPrefs() { // General if (getCookie('showsats')=='') setCookie('showsats',1); if (getCookie('showcolor')=='') setCookie('showcolor',1); if (getCookie('showpreview')=='') setCookie('showpreview',1); if (getCookie('autohide')=='') setCookie('autohide',1); if (getCookie('keyboard')=='') setCookie('keyboard',1); // Fields if (getCookie('latlon')=='') setCookie('latlon',2); if (getCookie('linele')=='') setCookie('linele',2); if (getCookie('index')=='') setCookie('index',2); if (getCookie('tape')=='') setCookie('tape',2); if (getCookie('comments')=='') setCookie('comments',1); // Alls if (getCookie('ALL_type')=='') setCookie('ALL_type',0); if (getCookie('ALL_coverage')=='') setCookie('ALL_coverage',0); if (getCookie('ALL_schedule')=='') setCookie('ALL_schedule',0); // Collapsed if (getCookie('collapsed')=='') setCookie('collapsed',0); } // General functions function showPrefsGeneral() { unselected('prefs_fields'); selected('prefs_general'); if (isAdmin()) getFile('prefs_general.php?admin=1','prefs_body','updatePrefsGeneral()'); else getFile('prefs_general.php','prefs_body','updatePrefsGeneral()'); } function updatePrefsGeneral() { setOption('RAD_sats',getCookie('showsats'),3); setOption('RAD_color',getCookie('showcolor'),3); setOption('RAD_preview',getCookie('showpreview'),2); // setOption('RAD_tz',getCookie('showtz'),2); setOption('RAD_autohide',getCookie('autohide'),2); setOption('RAD_kbd',getCookie('keyboard'),2); // setOption('RAD_draggable',getCookie('draggable'),2); getTZ(); fixShadow(); } // Results functions function showPrefsFields() { unselected('prefs_general'); selected('prefs_fields'); getFile('prefs_fields.html','prefs_body','updatePrefsFields()'); } function updatePrefsFields() { setOption('RAD_latlon',getCookie('latlon'),2); setOption('RAD_linele',getCookie('linele'),2); setOption('RAD_index',getCookie('index'),2); setOption('RAD_tape',getCookie('tape'),2); setOption('RAD_comments',getCookie('comments'),3); fixShadow(); } // Set radio button-like elements to cookie values // Must be ID'd: , ie: <1> // Cookies must have numeric values // Blank cookies will default to a value of 1 function setOption(prefix,value,count) { if (value==null || value=='') { value=1; } for (i=1; i<=count; i++) { unselected(prefix+i); } for (i=1; i<=count; i++) { if (i==value) { selected(prefix+i); } } } function getFieldsPrefs() { var vars=new Array(); if (getCookie('latlon')==1) { vars.push('d_latlon=1'); } else { vars.push('d_latlon=0'); } if (getCookie('linele')==1) { vars.push('d_linele=1'); } else { vars.push('d_linele=0'); } if (getCookie('index')==1) { vars.push('d_index=1'); } else { vars.push('d_index=0'); } if (getCookie('tape')==1) { vars.push('d_tape=1'); } else { vars.push('d_tape=0'); } if (getCookie('comments')==2) { vars.push('d_comments=2'); } else if (getCookie('comments')==3) { vars.push('d_comments=0'); } else { vars.push('d_comments=1'); } return(vars); } // Deal with 'all' option function updatePrefsAlls() { if (getCookie('ALL_type')==0) document.getElementById('CHK_type').checked=0; else document.getElementById('CHK_type').checked=1; if (getCookie('ALL_coverage')==0) document.getElementById('CHK_coverage').checked=0; else document.getElementById('CHK_coverage').checked=1; if (getCookie('ALL_schedule')==0) document.getElementById('CHK_schedule').checked=0; else document.getElementById('CHK_schedule').checked=1; } // Deal with 'collapsed' option function updatePrefsCollapsed() { if (getCookie('collapsed')==0) document.getElementById('CHK_collapsed').checked=0; else document.getElementById('CHK_collapsed').checked=1; } function getCollapsedPref() { var theElem=document.getElementById('CHK_collapsed'); if (theElem==null) return 0; else return theElem.checked?1:0; }