\n';document.write(temp);var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;// Tiles storage datavar l1 = new Array(96); var l2 = new Array(96);var l3 = new Array(96);var l4 = new Array(96);var sp = new Array(4);var All = new Array(144);var result = new Array();// User Datavar thisPlayer = 1;var PlayerCount = 1;var UserNames = new Array(2);UserNames[0]="";UserNames[1]="";var UserTime;// Cookie Datavar CookieUserString = "";var CookieUserArray = new Array();var expdate;//Session Datavar HintsLeft = 7;var straftijd = 0;var NrBut = 0;var TempTile = new Array(4);var FirstTile = new Array(4);var SecondTile = new Array(4);var UndoOne = new Array(4);var UndoTwo = new Array(4);var LayerIndex = 0;var Clickable = new Array();var TilesLeftOnBoard = 144;var HintIndex = 0;var HintAr = new Array();var TileOne = false;var TileTwo = false;var NrLetter = 0;// Time Datavar timerID = null;var timerRunning = false;var thisDate;var hour;var sec;var min;function startClock() { thisDate = new Date(); stopClock(); timerID = setTimeout("timeRemaining()", 1000); timerRunning = true;}function stopClock() { clearTimeout(timerID); timerRunning = false;}function timeRemaining() { var map = InternetExplorer ? mj1 : document.embeds[0]; var now = new Date(); if (timerRunning){ //total seconds played! sec = parseInt(Math.round(now.getTime() - (thisDate.getTime()+1000)) / 1000); sec = sec + straftijd; hour = (sec - (sec % 3600))/3600; sec -= hour*3600; min = (sec - (sec % 60))/60; sec = sec%60; UserTime = ""+((hour-(hour%10))/10)+(hour%10)+((min-(min%10))/10)+(min%10)+((sec-(sec%10))/10)+(sec%10); //Show the time map.TGotoFrame("_flash0/secLow" ,(sec%10)); map.TGotoFrame("_flash0/secHi" ,((sec-(sec%10))/10)); map.TGotoFrame("_flash0/minLow" ,(min%10)); map.TGotoFrame("_flash0/minHi" ,((min-(min%10))/10)); map.TGotoFrame("_flash0/hourLow" ,(hour%10)); map.TGotoFrame("_flash0/hourHi" ,((hour-(hour%10))/10)); } timerID = setTimeout("timeRemaining()", 1000);}function SplitArg(what){ var ss; ss = what.split(","); ss[1] = parseInt(ss[1]); return(ss);}function WhichLayer(ButtonNr){ for(j=0;j<4;j++){ if (sp[j]==ButtonNr){ LayerIndex = j; return 5; } } c=l1.length; for(j=0;j 0 ){ HintsLeft--; straftijd += 30; map.TGotoFrame("_flash0/hintsleft",HintsLeft); map.TGotoFrame("_flash0/hintmovie",HintsLeft); map.TGotoFrame("_flash0/straf",1); map.TPlay("_flash0/straf"); if (HintAr.length>0){ if (HintIndex >= HintAr.length) HintIndex=0; a= HintAr[HintIndex++]; b= HintAr[HintIndex++]; for(q=0;q<2;q++){ l = WhichLayer(a); p = LayerIndex; if (l==5){//special tiles map.TGotoFrame("_flash0/s"+(p+1),1); map.TPlay("_flash0/s"+(p+1)); }else{ c= p % 12; r= (p - c)/12; map.TGotoFrame("_flash0/h"+(l)+"r"+(r+1)+"c"+(c+1),1); map.TPlay("_flash0/h"+(l)+"r"+(r+1)+"c"+(c+1)); } a=b; } } } } if (cmd=="undo"){ AddToLayer(UndoOne); AddToLayer(UndoTwo); map.TGotoFrame("_flash0/undomovie",0); TilesLeftOnBoard += 4; UpdateTotalTiles(); } if (cmd=="userletter"){ NrLetter++; map.TGotoLabel("_flash0/inp"+NrLetter,arg); //map.TGotoLabel("_flash0/inp"+NrLetter,arg); switch(arg){ case "space" : if (NrLetter<7) UserNames[PlayerCount-1] = UserNames[PlayerCount-1]+" "; break; case "return": UserNames[PlayerCount-1] = UserNames[PlayerCount-1]+" ".slice(0,6); NrLetter=7; break; default : if (NrLetter<7) UserNames[PlayerCount-1] = UserNames[PlayerCount-1]+arg; break; } if (NrLetter==7){ UserNames[PlayerCount-1]=UserNames[PlayerCount-1].slice(0,6); WriteUserCookies(); if (thisPlayer == 2){ if (PlayerCount==1){ PlayerCount = 2; ReadUserCoockies(); }else{ PlayerCount = 1; GoPlay("new"); } }else{ GoPlay("new"); } } } if (cmd=="user"){ if (thisPlayer == 1){ UserNames[PlayerCount-1] = CookieUserArray[parseInt(arg)]; if(UserNames[PlayerCount-1]!="empty") GoPlay("new"); }else{ if (PlayerCount==1){ UserNames[PlayerCount-1] = CookieUserArray[parseInt(arg)]; if(UserNames[PlayerCount-1]!="empty") { PlayerCount = 2; ReadUserCoockies(); } }else{ UserNames[PlayerCount-1] = CookieUserArray[parseInt(arg)]; if(UserNames[PlayerCount-1]!="empty") {PlayerCount=1;GoPlay("new");} } } } if (cmd=="player"){ thisPlayer = parseInt(arg); UserNames[0]=""; UserNames[1]=""; switch(arg){ case "new": map.TGotoFrame("_flash0/",652);break; case "1" : PlayerCount=1;ReadUserCoockies(); break; case "2" : PlayerCount=1;ReadUserCoockies(); break; } } if (cmd=="nextplayer"){ PlayerCount=2; GoPlay("replay"); }} function init(arg){ var map = InternetExplorer ? mj1 : document.embeds[0]; HintsLeft = 7; straftijd = 0; map.TGotoFrame("_flash0/",649); map.TGotoFrame("_flash0/hintsleft",HintsLeft); map.TGotoFrame("_flash0/hintmovie",HintsLeft); map.TGotoFrame("_flash0/undomovie",0); // Show UserName for(q=0;q<6;q++) map.TGotoLabel("_flash0/us"+(q+1),(UserNames[PlayerCount-1].charAt(q)==" "?"space":UserNames[PlayerCount-1].charAt(q))); HintIndex = 0; TilesLeftOnBoard = 146; UpdateTotalTiles(); var x; All=[ 10, 20, 30, 40, 50, 60, 70, 80,90, 12, 22, 32, 42, 52, 62, 72, 82,92, 14, 24, 34, 44, 54, 64, 74, 84,94, 16, 26, 36, 46, 56, 66, 76, 86,96, 100,110,120,130,140,150,160,170,180, 102,112,122,132,142,152,162,172,182, 104,114,124,134,144,154,164,174,184, 106,116,126,136,146,156,166,176,186, 190,200,210,220,230,240,250,260,270, 192,202,212,222,232,242,252,262,272, 194,204,214,224,234,244,254,264,274, 196,206,216,226,236,246,256,266,276, 280,290,300, 282,292,302, 284,294,304, 286,296,306, 310,312,314,316, 350,352,354,356, 390,400,410,420, 392,402,412,422, 394,404,414,424, 396,406,416,426]; if (arg=="new"){ result = []; teller = 144; for (teller = 144; teller > 0;teller--){ x = Math.round((Math.random()*teller)+0.5)-1; result = result.concat(All[x]); All = All.slice(0,x).concat(All.slice(x+1,teller)); } } teller = 0; // layer 1 var r = 0; var c = 0; for ( i=0 ; i<96 ; i++) l1[i]= -2; for ( r=0 ; r<8 ; r++){ for ( c=0 ; c<12 ; c++){ if (r==1 && c == 0) {l1[((r*12) + c)] = -1;} else if (r==1 && c == 1) { l1[((r*12) + c)] = -1;} else if (r==1 && c == 10) { l1[((r*12) + c)] = -1;} else if (r==1 && c == 11) { l1[((r*12) + c)] = -1;} else if (r==2 && c == 0) { l1[((r*12) + c)] = -1;} else if (r==2 && c == 11) { l1[((r*12) + c)] = -1;} else if (r==5 && c == 0) { l1[((r*12) + c)] = -1;} else if (r==5 && c == 11) { l1[((r*12) + c)] = -1;} else if (r==6 && c == 0) { l1[((r*12) + c)] = -1;} else if (r==6 && c == 1) { l1[((r*12) + c)] = -1;} else if (r==6 && c == 10) { l1[((r*12) + c)] = -1;} else if (r==6 && c == 11) { l1[((r*12) + c)] = -1;} else{ l1[((r*12) + c)] = result[teller]; map.TGotoFrame("_flash0/l1r"+(r+1)+"c" + (c+1), result[teller]-1 ); teller++; } } } // layer 2 for (i=0;i<96;i++)l2[i]= -1; for (r=1;r<7;r++){ for (c=3;c<9;c++){ l2[((r*12) + c)] = result[teller]; map.TGotoFrame("_flash0/l2r"+(r+1)+"c" + (c+1), result[teller]-1 ); teller++; } } // layer 3 for (i=0;i<96;i++)l3[i]= -1; for (r=2;r<6;r++){ for (c=4;c<8;c++){ l3[((r*12) + c)] = result[teller]; map.TGotoFrame("_flash0/l3r"+(r+1)+"c" + (c+1), result[teller]-1); teller++; } } // layer 4 for (i=0;i<96;i++)l4[i]=-1; for (r=3;r<5;r++){ for (c=5;c<7;c++){ l4[((r*12) + c)] = result[teller]; map.TGotoFrame("_flash0/l4r"+(r+1)+"c" + (c+1), result[teller]-1 ); teller++; } } //layer 5 + uiteinden for (i = 0 ; i < 4;i++){ sp[i] = result[teller]; map.TGotoFrame("_flash0/sp"+(i+1), result[teller]-1 ); teller++; } NrBut = 0; GetClickable(); GetMovesLeft(); SendMessage(0); startClock();}function GetMovesLeft(){ var map = InternetExplorer ? mj1 : document.embeds[0]; HintAr =[]; nr = 0; if (Clickable.length > 0){ for(x=1;x 0) // Except on the Mac - ahead of its time date.setTime (date.getTime() - skew);}function DeleteCookie (name,path,domain) { if (GetCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }}function SetCookie (name,value,expires,path,domain,secure) { value=value.slice(0,2000); document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");}function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null;}function WriteHighScoreCookies(){ var map = InternetExplorer ? mj1 : document.embeds[0]; // naar highscore frame map.TGotoFrame("_flash0/",651); if (TilesLeftOnBoard==0) {// We have a winner map.TGotoFrame("_flash0/winner",1); for(q=0;q<6;q++) map.TGotoLabel("_flash0/winner/w"+(q+1),(UserNames[PlayerCount-1].charAt(q)==" "?"space":UserNames[PlayerCount-1].charAt(q))); } if (thisPlayer==2){ if (PlayerCount==1){ map.TGotoFrame("_flash0/nextplayer",1); map.TGotoFrame("_flash0/replaymenu",2); map.TGotoFrame("_flash0/newgamemenu",2); map.TGotoFrame("_flash0/playersmenu",3); }else{ map.TGotoFrame("_flash0/nextplayer",2); map.TGotoFrame("_flash0/replaymenu",1); map.TGotoFrame("_flash0/newgamemenu",1); map.TGotoFrame("_flash0/playersmenu",1); } }else{ map.TGotoFrame("_flash0/nextplayer",2); map.TGotoFrame("_flash0/replaymenu",1); map.TGotoFrame("_flash0/newgamemenu",1); map.TGotoFrame("_flash0/playersmenu",1); } // Show UserName for(q=0;q<6;q++) map.TGotoLabel("_flash0/us"+(q+1),(UserNames[PlayerCount-1].charAt(q)==" "?"space":UserNames[PlayerCount-1].charAt(q))); //Show TielesLeft on board map.TGotoFrame("_flash0/scoretiles",(TilesLeftOnBoard/2)); // Show Winning Time timeRemaining(); stopClock(); //Read HighscoreCookie if (GetCookie("HighScores")==null){ // coockie isn't there! // create dummy coockie with 'empty' values CookieHighScoreString = UserNames[PlayerCount-1]+","+TilesLeftOnBoard+","+UserTime+",empty,144,999999,empty,144,999999,empty,144,999999,empty,144,999999,empty,144,999999,empty,144,999999,empty,144,999999"; SetCookie ("HighScores", CookieHighScoreString, expdate); CookieHighScoreString=GetCookie("HighScores"); }else{ // we have a coockie! CookieHighScoreString=GetCookie("HighScores"); CookieHighScoreArray = CookieHighScoreString.split(","); CookieHighScoreString=""; index = 9; for (x=7;x>-1;x--){ if (TilesLeftOnBoard<(parseInt(CookieHighScoreArray[(x*3)+1]))) index=x; } thisTime = parseInt(parseFloat(UserTime)); for (x=index;x>-1;x--){ if ((TilesLeftOnBoard==(parseInt(CookieHighScoreArray[(x*3)+1]))) && (thisTime=index;x--){ // shift high score items. CookieHighScoreArray[((x+1)*3)] = CookieHighScoreArray[((x)*3)]; CookieHighScoreArray[((x+1)*3)+1] = CookieHighScoreArray[((x)*3)+1]; CookieHighScoreArray[((x+1)*3)+2] = CookieHighScoreArray[((x)*3)+2]; } CookieHighScoreArray[((index)*3)] = UserNames[PlayerCount-1]; CookieHighScoreArray[((index)*3)+1] = TilesLeftOnBoard; CookieHighScoreArray[((index)*3)+2] = UserTime; CookieHighScoreString = CookieHighScoreArray.join(","); SetCookie ("HighScores", CookieHighScoreString, expdate); } } CookieHighScoreString = GetCookie("HighScores"); CookieHighScoreArray = CookieHighScoreString.split(","); NrHighScores = CookieHighScoreArray.length/3; for(q=0;q8)NrNames=8; for(q=0;q