var max_league_games=10;function submit_league_settings_form(){max_league_games=gui_get_selected_option_value('max_league_games',10);var params=[];params.push('opt=league');params.push('mlg='+max_league_games);var txt=gk_request_remote_data('/settings-post.pl',0,null,params.join('&'));if(!txt)return;var b_success=0;var msg='';var data=txt.split('\n');if(data[0]!='settings-post.1.0'){msg='<b style="color: #ff0000;">ERROR:</b> unable to establish connection to the server!';}else{b_success=to_int(data[1]);msg=data[2];}var frame=gk_get_el('league_settings_form');if(!frame)frame=document.body;gui_pop_message(msg,frame,b_success?1000:3000);if(b_success)gui_pop_form_remove();}function open_league_settings_form(el){var all_max_league_games=[6,8,10,12,14,16,18,20];var max_league_games_options=[];var selected=0;for(var i=0;i<all_max_league_games.length;i++){var value=all_max_league_games[i];if(!selected&&value>=max_league_games)selected=1;max_league_games_options.push('<OPTION VALUE='+value+(selected==1?' SELECTED':'')+'>'+value);if(selected==1)selected++;}var txt='<table border=0 cellspacing=6 cellpadding=0 id="league_settings_form"><tr><td colspan=2>Max simultaneous League games: <SELECT id="max_league_games" class=ftx>'+max_league_games_options.join('')+'</SELECT><div class=dim>Other players will not be able to challenge you to a new League<br>match if you are already playing this number of League games.</div></td></tr><tr><td style="text-align: center; padding-top: 6px;" colspan=2><INPUT TYPE="button" VALUE="Submit" onClick="submit_league_settings_form();"> <INPUT TYPE="button" VALUE="Cancel" onClick="gui_pop_form_remove();"></td></tr></table>';gui_pop_form(txt,el,{'dir':1,'align':1,'header':'Chess League settings:'});}
