document.onmouseover = function ( e ) { if ( !e ) e = window.event; var el = e.target ? e.target : e.srcElement; while ( el != null && el.tagName != "A" ) el = el.parentNode; if ( el == null ) return; if ( e.preventDefault ) e.preventDefault(); else e.returnValue = true; }; document.onmousedown = function ( omd ) { if ( !omd ) omd = window.event; var el = omd.target ? omd.target : omd.srcElement; while ( el != null && el.tagName != "A" ) el = el.parentNode; if ( el == null ) return; if ( omd.preventDefault ) omd.preventDefault(); else omd.returnValue = true; }; var url_prefix=''; var pause_colour='#DAFF59'; var bg_shaded_colour='#B1E6FF';var gamerunning=false; var d;// only used once as difference between now and pausedtime var nu;// current time for comparison var timer_time;// current time for the timer var old; var lo=0;//rename var m=0;//rename solved_count? var oh='';// most recent square mouseovered? var selected_area='';//os renamed selected_area var given=[];//g renamed given, given numbers and dots var pm_num=[];//n renamed pm_num var c=[];//id used by each unsolved square, indexed by row and column for (var i=0;i<9;i++) {c[i]=[]} var gl=[];//used by left/right etc functions, read-only //var rc_map=[];// row column map, to replace gl, use later when re-numbered //var counter = 0; //for (var y=0; y<9; y=y+3) { // for (var x=0; x<9; x=x+3) { // for (var j=y; j'; var guab = ' ';//var no_test = true; var flash_top='287'; // vars that used to be at bottom var pm_html_1 = "'; //var guab1 = ''; //var guab2 = ' '; var guac = ''; onerror = ec; function ec(e,u,l) { //alert(e+';'+u+';'+l); return false; } function docRef(element) { if (element) { if (document.getElementById) { if (document.getElementById(element)) { var ref = document.getElementById(element).style; } } else { } return ref } else {return null;} } function htmlRef(element) { if (element) { if (document.getElementById) { if (document.getElementById(element)) { var ref = document.getElementById(element); } } else { } return ref } else {return null;} } // make into something useful later function gb(s) { var a=[];//moved into function a=s.split(''); var k=0; var la=[0,9,18,3,12,21,6,15,24,27,36,45,30,39,48,33,42,51,54,63,72,57,66,75,60,69,78]; for (var i=0;i<27;i++) { for (var j=0;j<3;j++) { //g[la[i]+j]=a[k++]; } } // debug array //var test_string = ''; //for (i=0; i= '0')&&(d.charAt(1) <= '5')) { mode = 'no'; } } // new, bodge else if ( elementtype == 'no' ) { mode = 'no'; } // mouseclick if ( elementtype=='no' || elementtype=='gu' ) { selected(elementtype+elementid, pm_id); } else { selected('no'+d.substring(2), pm_id); } } // onmouseover/onmouseout else { if ( mb[1] ) { mb[0]=mb[1];//can probably remove all mb mb[1]=[t,d]; } //else if ( sb[0] ) { else if ( last_mousedown ) { mb[1]=[t,d]; } else { mb[0]=[t,d]; } // mouse move if ( t==0 ) { //onmouseover //if ( (d.substring(0,2)=='no') || (d.substring(0,2)=='gu') ) { if ( elementtype=='no' || elementtype=='gu' ) { he(d); } else { hidehighlight(); } } else { //onmouseout hidehighlight(); } } } } } } // new function to handle just keydowns, called on useful onkeydowns function on_keydown(keycode) { if (started && !gamepaused) { if ( (keycode>48) && (keycode<58) && (mode!='') ) { var nmt=(keycode-48); num(nmt); } else if ( (keycode>96) && (keycode<106) && (mode!='') ) { var nmt=(keycode-96); num(nmt); } else if (keycode==9) { tab() } else if (keycode==-9) { shifttab() } else if (keycode==37) { left() } else if (keycode==39) { right() } else if (keycode==38) { up() } else if (keycode==40) { down() } else if (keycode==8) { del(-1) } else if (keycode==46) { del(1) } else if (keycode==32) { del(0) } } } // new, for ipad keypad presses function ipad_keydown(n) { if (started && !gamepaused) { if ( (n>=0) && (n<=9) && (mode!='') ) { num(n); } else if (n==-1) { del(-1); } } } function updateTime() { if ( isNaN(timer_time.getUTCSeconds()) ) { d = new Date(); nu = new Date(); timer_time = new Date(nu.getTime()-d.getTime()); } if (timer_time.getUTCSeconds()<10) {secs='0'+timer_time.getUTCSeconds()} else {secs=timer_time.getUTCSeconds()} if (timer_time.getUTCMinutes()<10) {mins='0'+timer_time.getUTCMinutes()} else {mins=timer_time.getUTCMinutes()} if (timer_time.getUTCHours()>0) { if (timer_time.getUTCHours()<10) {hours='0'+timer_time.getUTCHours()} else {hours=timer_time.getUTCHours()} } if (hours) { htmlRef('clock').innerHTML=""+hours+":"+mins+"<"+"/span>"; } else if (timer_time.getUTCMinutes()) { htmlRef('clock').innerHTML=""+mins+":"+secs+"<"+"/span>"; } else { htmlRef('clock').innerHTML="00:"+secs+"<"+"/span>"; } } // new function function assemble_pm_html(square_id, hidden) { var inner_html = ''; // assemble html for all pms for (var k=0; k<=5; k++) { if ( mouseovers ) { //inner_html += pm_html_1+pm_html_2+k+square_id+pm_html_3+k+square_id+pm_html_4+pm_html_5+square_id+pm_html_6a+k+pm_html_6b+k+square_id+pm_html_7; if ( eh_in_href ) { inner_html += pm_html_1_1 + square_id + pm_html_1_2 + square_id + pm_html_1_3 + k + pm_html_1_4 + pm_html_2 + k + square_id + pm_html_3 + k + square_id + pm_html_4 + pm_html_5 + square_id + pm_html_6a + k + pm_html_6b + k + square_id + pm_html_7; } else { inner_html += pm_html_1 + pm_html_2 + k + square_id + pm_html_3 + k + square_id + pm_html_4 + pm_html_5 + square_id + pm_html_6a + k + pm_html_6b + k + square_id + pm_html_7; } } else { //inner_html += pm_html_1+pm_html_5+square_id+pm_html_6a+k+pm_html_6b+k+square_id+pm_html_7; if ( eh_in_href ) { inner_html += pm_html_1_1 + square_id + pm_html_1_2 + square_id + pm_html_1_3 + k + pm_html_1_4 + pm_html_5 + square_id + pm_html_6a + k + pm_html_6b + k + square_id + pm_html_7; } else { inner_html += pm_html_1 + pm_html_5 + square_id + pm_html_6a + k + pm_html_6b + k + square_id + pm_html_7; } } if ( pm_num[square_id][k]==O || hidden ) { inner_html += pmspace; } else { inner_html += pm_num[square_id][k]; } inner_html += pm_html_8; } return inner_html; } // new function function pause() { var innerhtml_string; if ( !gamepaused ) { gamepaused=true; nu = new Date(); pausedtime=new Date(nu.getTime()-d.getTime()); var i; htmlRef('colon').className='blink_1'; docRef('grid').backgroundColor=pause_colour; for (i=0; i<81; i++) { htmlRef('bl'+i).className='pause'; if ( htmlRef('fi'+i) ) { htmlRef('fi'+i).innerHTML=''; } } for (i=0; i'; } if ( htmlRef('print_span') ) { htmlRef('print_span').innerHTML = print_span_grey_html; } if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } } else { var k; for (i=0; i<81; i++) { htmlRef('bl'+i).className='standard'; if ( docRef('no'+i) ) { if ( bg_shaded[i] ) { htmlRef('no'+i).className='notesNumber shaded'; } else { htmlRef('no'+i).className='notesNumber standard'; } } if ( docRef('gu'+i) ) { if ( bg_shaded[i] ) { htmlRef('gu'+i).className='shaded'; } else { htmlRef('gu'+i).className='standard'; } } if ( htmlRef('fi'+i) ) { if ( given[i] ) { htmlRef('fi'+i).innerHTML=given[i]; } } if ( htmlRef('no'+i) ) { if ( ed[i]!='' ) { // assemble html for all pms innerhtml_string = ''; innerhtml_string = assemble_pm_html(i,true); htmlRef('no'+i).innerHTML = innerhtml_string; } else { // assemble html for all pms innerhtml_string = ''; innerhtml_string = assemble_pm_html(i,false); htmlRef('no'+i).innerHTML = innerhtml_string; } } if ( htmlRef('gu'+i) ) { if ( ed[i]!='' ) { if ( eh_in_href ) { htmlRef('gu'+i).innerHTML = gu_ahref_1 + i + gu_ahref_2 + i + gu_ahref_3 + '' + ed[i] + '' + guac; } else { htmlRef('gu'+i).innerHTML = gu_ahref + '' + ed[i] + '' + guac; } //htmlRef('gu'+i).innerHTML = guaa+'' + ed[i] + ''+guac; } else { //htmlRef('gu'+i).innerHTML = guaa + guab + guac; if ( eh_in_href ) { htmlRef('gu'+i).innerHTML = gu_ahref_1 + i + gu_ahref_2 + i + gu_ahref_3 + guab + guac; } else { htmlRef('gu'+i).innerHTML = gu_ahref + guab + guac; } } } } if ( htmlRef('play') ) { htmlRef('play').innerHTML=''; } if ( htmlRef('print_span') ) { htmlRef('print_span').innerHTML = print_span_html; } if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } gamepaused=false; nu = new Date(); d = new Date(nu.getTime()-pausedtime.getTime()); pb(); } } // new function function clear_grid(flash_text) { nu = new Date(); pausedtime=new Date(nu.getTime()-d.getTime()); gamepaused=true; var i; htmlRef('colon').className='blink_1'; for (i=0; i<81; i++) { if ( htmlRef('fi'+i) ) { htmlRef('fi'+i).innerHTML=''; } if ( htmlRef('no'+i) ) { htmlRef('no'+i).innerHTML=''; } if ( htmlRef('gu'+i) ) { htmlRef('gu'+i).innerHTML=''; } if ( bg_shaded[i]==1 ) { htmlRef('no'+i).className='notesNumber standard'; htmlRef('gu'+i).className='notesNumber standard'; } } if ( selected_area ) { i=selected_area.substring(2); if ( docRef('no'+i) ) { htmlRef('no'+i).className='notesNumber standard'; } if ( docRef('gu'+i) ) { htmlRef('gu'+i).className='standard'; } } if ( flash_text ) { docRef('flash').top=flash_top + 'px'; htmlRef('flash').innerHTML='' + flash_text + ''; } } function pb() { if ( !gamepaused ) { //timer tick handling nu = new Date(); if (timer_time) { old = timer_time.getUTCSeconds();colon_old = Math.floor(timer_time.getUTCMilliseconds()/500); } else { colon_old = 0; } timer_time = new Date(nu.getTime()-d.getTime()); var sec = timer_time.getUTCSeconds(); colon = Math.floor(timer_time.getUTCMilliseconds()/500); if (old!=sec) { updateTime(); } if (colon_old!=colon) { if ( colon==0 ) { htmlRef('colon').className='blink_1'; } else { htmlRef('colon').className='blink_2'; } } setTimeout("pb()",50); } } // new function function get_selection() { var text = ''; if (window.getSelection) { text = window.getSelection(); } else if (document.getSelection) { text = document.getSelection(); } else if (document.selection) { text = document.selection.createRange().text; } else return false; return text; } function del(d) { var l=selected_area.substring(2)-0;// && d!=0 var innerhtml_string = ''; var i=0; var k=0; if (mode=='no') { var selected_text=false; if ( selected_text ) { var j; var moving_numbers; var selected_array=selected_text.split(''); for (j in selected_array) { moving_numbers=false; for (i=0;i<=5;i++) { if ( pm_num[l][i]==selected_array[j] ) { selnote=i; if ( pm_num[l][i]!=O ) { pm--; } moving_numbers=true; } if ( moving_numbers ) { if ( pm_num[l][i+1] ) { pm_num[l][i]=pm_num[l][i+1]; } else { pm_num[l][i]=O; } } } } if ( need_operafix ) { document.sudoku.operafix.focus(); } } else { if ((d==-1)&&(selnote>0)) {selnote--} if ( pm_num[l][selnote]!=O ) { pm--; }//alert('Deleting a pencil mark'); while (((selnote+i)<6)&&(selnote>-1)) { if (pm_num[l][selnote+(i+1)]) { pm_num[l][selnote+(i++)]=pm_num[l][selnote+i]; } else { pm_num[l][selnote+i]=O; i++; } } } // assemble html for all pms for (k=0; k<=5; k++) { innerhtml_string = assemble_pm_html(l, false); } htmlRef(selected_area).innerHTML = innerhtml_string; notesel(selnote); if ( pm==0 && m==0 ) { if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } } } else if (mode=='gu') { if (ed[l]!='') {--m;ed[l]='';} if ( lo==m+1) { complete=false; if ( htmlRef('submit_span') ) { htmlRef('submit_span').innerHTML = submit_span_grey_html; } else if ( htmlRef('check_span') ) { htmlRef('check_span').innerHTML = check_span_grey_html; } } innerhtml_string = assemble_pm_html(l, false); htmlRef('no'+l).innerHTML = innerhtml_string; if (docRef('no'+l)!=null) {htmlRef('no'+l).className='notesNumber selected';} //htmlRef(selected_area).innerHTML = gu_ahref + guab + guac; if ( eh_in_href ) { htmlRef(selected_area).innerHTML = gu_ahref_1 + l + gu_ahref_2 + l + gu_ahref_3 + guab + guac; } else { htmlRef(selected_area).innerHTML = gu_ahref + guab + guac; } if (d == -1 && autotab ) shifttab(); if (d == 1 && autotab ) tab(); if ( pm==0 && m==0 ) { if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } } } } function left() { var l = selected_area.substring(2)-0; if (mode=='no') { if (selnote) { notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb selnote--; notesel(selnote)} else { var tmpx=gl[l][0]; var tmpy=gl[l][1]; if (tmpx>0) { var otmpx=tmpx;tmpx--;selnote=0; while (c[tmpx][tmpy]=='.') { if (tmpx<1) { rtmp=false;tmpx=otmpx;break} tmpx--; } if (tmpx!=otmpx) { notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb while ((pm_num[l-1][selnote]!=O)&&(selnote<5)) {selnote++} } eh(2,mode+c[tmpx][tmpy],mode,c[tmpx][tmpy],null); } } } else { var tmpx=gl[l][0]; var tmpy=gl[l][1]; if (tmpx>0) { var otmpx=tmpx; tmpx--; while (c[tmpx][tmpy]=='.') { if (tmpx<1) { tmpx=otmpx;break; } tmpx--; } if (c[tmpx][tmpy]) { eh(2,mode+c[tmpx][tmpy],mode,c[tmpx][tmpy],null); } } } } function right() { var l = selected_area.substring(2)-0; if (mode=='no') { if ((pm_num[l][selnote]!=O)&&(selnote<5)) { notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb selnote++; notesel(selnote)} else { var tmpx=gl[l][0]; var tmpy=gl[l][1]; if (tmpx<8) { var otmpx=tmpx;tmpx++; while (c[tmpx][tmpy]=='.') { if (tmpx>7) {tmpx=otmpx;break}tmpx++} if (tmpx!=otmpx) { notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb selnote=0} rtmp=false; eh(2,mode+c[tmpx][tmpy],mode,c[tmpx][tmpy],null) } } } else { var tmpx=gl[l][0]; var tmpy=gl[l][1]; if (tmpx<8) {var otmpx=tmpx;tmpx++; while (c[tmpx][tmpy]=='.') { if (tmpx>7) {tmpx=otmpx;break} tmpx++ } //if (c[tmpx][tmpy]+1) { if (c[tmpx][tmpy]) { eh(2,mode+c[tmpx][tmpy],mode,c[tmpx][tmpy],null); } } } } function up() { var l = selected_area.substring(2)-0; var tmpx=gl[l][0]; var tmpy=gl[l][1]; if(mode=='gu') {while ((pm_num[l][selnote]!=O)&&(selnote<5)) {selnote++} eh(2,'no'+(l),'no',(l),null)} else { while (c[tmpx][tmpy-1]=='.') {tmpy--} if (c[tmpx][tmpy-1]) { eh(2,'gu'+c[tmpx][tmpy-1],'gu',c[tmpx][tmpy-1],null); } } } function down() { var l = selected_area.substring(2)-0; var tmpx=gl[l][0]; var tmpy=gl[l][1]; if(mode=='no') {eh(2,'gu'+(l),'gu',(l),null)} else { while ((pm_num[l][selnote]!=O)&&(selnote<5)) {selnote++} while (c[tmpx][tmpy+1]=='.') {tmpy++} if (c[tmpx][tmpy+1]) { eh(2,'no'+c[tmpx][tmpy+1],'no',c[tmpx][tmpy+1],null); } } } function tab() { var l = selected_area.substring(2)-0; notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb if (l<(ed.length-1)) eh(2,mode+((l)+1),mode,((l)+1),null); } function shifttab() { var l = selected_area.substring(2)-0; notedsel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 6th Feb if (l > 0) eh(2,mode+((l)-1),mode,((l)-1),null); } // when number key down, stores entered number and adds it to display function num(nmt) { var l=selected_area.substring(2)-0; var innerhtml_string = ''; var k = 0; if (mode=='no') { if ((nmt!=pm_num[l][0]) && (nmt!=pm_num[l][1]) && (nmt!=pm_num[l][2]) && (nmt!=pm_num[l][3]) && (nmt!=pm_num[l][4]) && (nmt!=pm_num[l][5]) ) { if ( pm_num[l][selnote]==O ) { pm++; } pm_num[l][selnote] = nmt; innerhtml_string = assemble_pm_html(l, false); htmlRef(selected_area).innerHTML = innerhtml_string; selnote++; if (selnote>5) {selnote=5} notesel(selnote); if ( pm==1 && m==0 ) { if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } } } } else if (mode=='gu') { innerhtml_string = assemble_pm_html(l, true); htmlRef('no'+l).innerHTML = innerhtml_string; if (ed[l]=='') { ++m; ed[l]=nmt; } else {ed[l]=nmt; } if ( eh_in_href ) { htmlRef(selected_area).innerHTML = gu_ahref_1 + l + gu_ahref_2 + l + gu_ahref_3 + '' + nmt + '<'+'/span>' + guac; } else { htmlRef(selected_area).innerHTML = gu_ahref + '' + nmt + '<'+'/span>' + guac; } //htmlRef(selected_area).innerHTML = guaa+''+nmt+'<'+'/span>'+guac; if ( autotab ) { tab(); } if ( pm==0 && m==1 ) { if ( htmlRef('save_span') ) { htmlRef('save_span').innerHTML=''; } } } if (m==lo) {complete=true; playMOver();} } // displays pencil marks in current cell function notesel(n) { if (selected_area) { var l = selected_area.substring(2)-0; if (docRef('n'+n+l)!=null) { htmlRef('n'+n+l).className='noted keycursor'; } } } // move focus to pencil marks in new cell function notedsel(n) { if (selected_area) { var l = selected_area.substring(2)-0; if (docRef('n'+n+l)!=null) { htmlRef('n'+n+l).className='noted'; //if ( need_operafix ) { document.sudoku.operafix.focus(); }// removed 6th Feb } } } // called on mousedown over 'gu', 'no' elements of the grid function selected(e, pm_id) { // e is either 'gu' or 'no' type string // selected_area is either 'gu' or 'no' type string var innerhtml_string = ''; var k = 0; if (selected_area) { // set some class highlights var l = selected_area.substring(2)-0; if (docRef('no'+l)!=null) { if ( bg_shaded[l] ) { if ( 'no'+l==selected_area ) { htmlRef('no'+l).className='notesNumber shaded'; } else { htmlRef('no'+l).className='notesNumber shaded'; } } else { if ( 'no'+l==selected_area ) { htmlRef('no'+l).className='notesNumber standard'; } else { htmlRef('no'+l).className='notesNumber standard'; } } } if (docRef('gu'+l)!=null) { if ( bg_shaded[l] ) { if ( 'gu'+l==selected_area ) { htmlRef('gu'+l).className='shaded'; } else { htmlRef('gu'+l).className='shaded'; } } else { if ( 'gu'+l==selected_area ) { htmlRef('gu'+l).className='standard'; } else { htmlRef('gu'+l).className='standard'; } } } } // set stuff to select an area if (e.substring(0,2)=='gu') { notedsel(selnote); mode='gu'; if (docRef(e)!=null) {htmlRef(e).className='selected'; } var l = (e.substring(2)-0); if (docRef('no'+l)!=null) { htmlRef('no'+l).className='selected'; } selected_area = e; if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 19th //if ( need_operafix ) { document.forms.sudoku.elements.operafix.focus(); }// testing 6th Feb } else if (e.substring(0,2)=='no') { var l = (e.substring(2)-0); if ( ed[l]!='' ) { innerhtml_string = assemble_pm_html(l, false); htmlRef('no'+l).innerHTML = innerhtml_string; } notedsel(selnote); mode='no'; if (docRef('gu'+l)!=null) {htmlRef('gu'+l).className='mouseover';} if (docRef('no'+l)!=null) {htmlRef('no'+l).className='notesNumber selected';} selected_area = e; if (rtmp) { while ((pm_num[selected_area.substring(2)-0][selnote]==O)&&(selnote>0)) { selnote--; } while ((pm_num[selected_area.substring(2)-0][selnote]!=O)&&(selnote<5)) { selnote++; } } else { rtmp=true; } notesel(selnote); if ( need_operafix ) { document.sudoku.operafix.focus(); }// added 19th } } // called sometimes on mouseover and mouseout function hidehighlight() { // oh is 'gu' or 'no' if (oh == '') return; var l = oh.substring(2); var sb_element = new String(last_mousedown); if ( sb_element.substring(4)!=oh.substring(2) ) { if (docRef('no'+l)!=null) blank(l); oh = ''; } } // called sometimes on mouseover and mouseout // for square e... // sets classNames function he(e) { // e is 'gu' or 'no' if (e) { var l = oh.substring(2); if (selected_area.substring(2)!=l) { if (docRef('no'+l)!=null) blank(l); } if (selected_area.substring(2)!=e.substring(2)) { if (e.substring(0,2)=='no') { // set pm area and rest of square to colours for mouseover pm area if (docRef(e)!=null) {htmlRef(e).className='notesNumber mouseover';} if (docRef('no'+e.substring(2))!=null) {htmlRef('no'+e.substring(2)).className='notesNumber mouseover';} if (docRef('gu'+e.substring(2))!=null) {htmlRef('gu'+e.substring(2)).className='lighter_selected';} } else if (e.substring(0,2)=='gu') { // set pm area and rest of square to mouseover colour if (docRef(e)!=null) {htmlRef(e).className='mouseover';} if (docRef('no'+e.substring(2))!=null) {htmlRef('no'+e.substring(2)).className='notesNumber mouseover';} } oh = e; } } } // called sometimes on mouseover and mouseout // sets set pm area and rest of square colour for square number l function blank(l) { if ( bg_shaded[l] ) { // set pm area and rest of square to shaded square colour htmlRef('no'+l).className='notesNumber shaded'; htmlRef('gu'+l).className='shaded'; } else if ( !gamepaused ) { // set pm area and rest of square to white htmlRef('no'+l).className='notesNumber standard'; htmlRef('gu'+l).className='standard'; } } var iskeydown=0; function kl(e){ if(!e) e = window.event; if ( e.target.id === "full_name" || e.target.id === "email") { return; } var res = e.keyCode; if(res==9) { if (e.shiftKey) res=-9; } if ((iskeydown == 1) && ((res > 48) && (res < 59))) return false; iskeydown = 1; on_keydown(res); return false } function KeyUp(e){ iskeydown = 0; return false; } document.onkeydown = kl; document.onkeyup = KeyUp; function pl() { if ( saved_sudoku ) {// or gamefrozen } else if (flagreset != true) { d = new Date() } else { m==lo; complete=true; playMOver(); } if ( !gamesolution ) { gamerunning=true;flagreset = false; started=true; pb(); } } function na(a,b,c,d) {} function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i3 || pm>19 ) { if ( confirm('Are you sure that you want to reset the current puzzle?') ) { clear_grid(); return true; } else { return false; } } else { clear_grid(); return true; } } // new function function return_play() { document.sudoku.action.value = 'play'; document.sudoku.submit(); } // new function function create_print_display() { if ( m==0 && pm==0 && !gamefrozen) { docRef('clock').display="none"; } window.print(); if ( m==0 && pm==0 && !gamefrozen ) { setTimeout("remove_print_display()",1000); } } // new function function remove_print_display() { docRef('clock').display="block"; } // new function function display_check_message() { docRef('flash').top=flash_top + 'px'; htmlRef('flash').innerHTML='Press Check'; setTimeout("remove_flash()",1000); } // new function function display_submit_message() { docRef('flash').top=flash_top + 'px'; htmlRef('flash').innerHTML='Press Submit'; setTimeout("remove_flash()",1000); } // new function function show_keys() { htmlRef('ipad_keys').className='ipad_show'; htmlRef('ipad_keys_minimised').className='ipad_hide'; } // new function function hide_keys() { htmlRef('ipad_keys').className='ipad_hide'; htmlRef('ipad_keys_minimised').className='ipad_show'; } function ic_thing() { if ( document.location.search.match(/preview_mode/i) == null && ( (!window.opener && window.parent.frames.length == 0) || (window.opener && window.opener.parent.frames.length == 0) ) ) { gamepaused = true; document.body.innerHTML = '

Oops!

Sorry, you cannot view this page directly. Please go to the Sunday Times Brain Power page and click on “Sudoku”.

Continue

';//put back! } } function un_ic_thing() { if ( (!window.opener && window.parent.frames.length == 0) || (window.opener && window.opener.parent.frames.length == 0) ) { } else { //setcookie('ic', '', time()-3600, '/', '', FALSE); //document.cookie = "saved_sudoku="+cookie_string+";expires=" + expire_date.toGMTString() + ";path=/"; var expire_date = new Date(); expire_date.setTime(expire_date.getTime()-3600000); document.cookie = "ic="+""+";expires=" + expire_date.toGMTString() + ";path=/"; } } gb(''); // button html var check_span_html = ''; var check_span_grey_html = ''; var submit_span_html = ''; var submit_span_grey_html = ''; var print_span_html = ''; var print_span_grey_html = ''; var restore_span_html = ''; // Google Analytics var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-7308414-3']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();