var click_seq = [];
var click_itr = 0;
var disolved_seq = [];
var disolved_itr = 0;
var disp_seq= [];
var disp_seq_inc= [];
var disp_itr = 0;
var tabColEIs=[];
var blink=false;
var timeNumDisplay = 500;
var timeInterval =timeNumDisplay+0;
var mem_step=0;
var boxcount=4;
var temp = [];
var temp_order = [];
var lost_game=false;
/*
   red blue green orange yellow pink violet grey 
   red blue
   blue green
   red green
   red orange
   blue orange
   green orange
   red yellow
   blue orange
 */
var cg_color_group=[['red','blue','green'],['#66CC99','red','blue'],['#993366','red','green'],['#99FFCC','blue','orange'], ['orange','red','orange'],['pink','green','orange'],['grey','red','yellow'],['violet','blue','orange'],['#CC6600','green','blue'],['green','blue','red'],['#99CC66','green','red'],['yellow','orange','blue'],['#9999FF','orange','red'],['#FFCC99','orange','blue'],['#00CC00','yellow','red'],['blue','orange','green']];
var cg_prev_click=-1;
var cg_rows=2;
var cg_cols=2;
function change_center_div_width()

{
	var wid_left = document.getElementById("floatleft").offsetWidth;
	//var wid_right= document.getElementById("floatright").offsetWidth; //use this only if you call this function after loading right div
	//var wid_right = wid_left + 40; // change this if you floatright and floatleft dont have equal widht (200-160=40)
	var wid_right = wid_left; // change this if you floatright and floatleft dont have equal widht (200-160=40)
	var middle_padding = 5; // assign this to whatever you set in CSS
	var new_width = document.body.offsetWidth - wid_left - wid_right - 2*middle_padding;
	document.getElementById("floatmiddle").style.width = new_width+"px";
}
function equalize_div_heights()

{
	var  left_ht = document.getElementById("floatleft").offsetHeight;
	var  right_ht = document.getElementById("floatright").offsetHeight;
	var  middle_ht = document.getElementById("floatmiddle").offsetHeight;
	var max_ht = 0 ;
	if(left_ht>right_ht)

	{
		if(left_ht>middle_ht)

		{
			max_ht = left_ht;
		}
		else

		{
			max_ht = middle_ht;
		}
	}
	else

	{
		if(right_ht>middle_ht)

		{
			max_ht = right_ht;
		}
		else

		{
			max_ht = middle_ht;
		}
	}
	var middle_padding = 5; // assign this to whatever you set in CSS
	document.getElementById("floatleft").style.height= max_ht + "px";
	document.getElementById("floatright").style.height= max_ht + "px";
	document.getElementById("floatmiddle").style.height= max_ht+ "px";


}
function afterloading()

{
	change_center_div_width();
	equalize_div_heights();
}
var timerID = 0;
var tStart  = null;







function pop_display_order()

{
	for(i=0;i<boxcount;i++)

	{
		temp_order[i]=i;
	}
	for(i=0;i<boxcount;i++)

	{
		swap_pos=range_rand(boxcount-i);
		swap_val=temp_order[swap_pos];
		temp_order[swap_pos]=temp_order[boxcount-1-i];
		temp_order[boxcount-1-i]=swap_val;
	}
	disp_seq_order=temp_order;

}
function pop_display()

{
	for(i=0;i<boxcount;i++)

	{
		//temp[i]=i;
		if(i!=0)

		{
			temp[i]=i+range_rand(4)+temp[i-1];
		}
		else

		{
			temp[i]=i+range_rand(4);
		}
	}
	for(i=0;i<boxcount;i++)

	{
		disp_seq_inc[i]=temp[i];
	}
	for(i=0;i<boxcount;i++)

	{
		swap_pos=range_rand(boxcount-i);
		swap_val=temp[swap_pos];
		temp[swap_pos]=temp[boxcount-1-i];
		temp[boxcount-1-i]=swap_val;
	}
	disp_seq=temp;
	return temp;

}
function range_rand(max)

{
	if(max==0)

	{
		return 0;
	}
	random_num = Math.random()*100;
	random_num = Math.ceil(random_num);
	random_num = random_num%max;
	return random_num;
}
function startcolorboxgame()

{
	boxcount = document.getElementById("totalboxes").value;
	pop_display();
	document.getElementById("instdiv").innerHTML="Now watch the boxes carefully:) Good Luck!";
	showtime=0;
	for(i=0;i<boxcount;i++)

	{
		bid="boxid"+disp_seq[i];
		func_str= "blinkboxcolor('"+bid+"','"+disp_seq[i]+"')";
		setTimeout(func_str,showtime);
		showtime=showtime+timeInterval;
	}
	func_str="colormemquestion()";
	setTimeout(func_str,showtime);
}
function startboxgame()

{
	boxcount = document.getElementById("totalboxes").value;
	pop_display();
	pop_display_order();
	document.getElementById("instdiv").innerHTML="Now watch the boxes carefully:) Good Luck!";
	showtime=0;
	for(i=0;i<boxcount;i++)

	{
		bid="boxid"+disp_seq_order[i];
		//bid="boxid"+i;
		func_str= "blinkbox('"+bid+"','"+disp_seq[i]+"')";
		setTimeout(func_str,showtime);
		showtime=showtime+timeInterval;
	}
	func_str="memquestion()";
	setTimeout(func_str,showtime);
}
function memquestion()

{
	var inc_vs_dec = range_rand(2);
	if(inc_vs_dec==0)

	{
		document.getElementById("instdiv").innerHTML="Now click on the colored boxes in the <font color='green' size='6'> increasing </font>order of the numbers shown before.";
	}
	else

	{
		var temp_seq=[];
		for(i=0;i<boxcount;i++)

		{
			temp_seq[boxcount-i-1]=disp_seq_inc[i];
		}
		for(i=0;i<boxcount;i++)

		{
			disp_seq_inc[i]=temp_seq[i];
		}
		document.getElementById("instdiv").innerHTML="Now click on the colored boxes in the <font color='blue' size='6'> decreasing </font>order of the numbers shown before.";
	}
}
function noteclick(crow,ccol)

{
	boxval = crow*boxcount/2+ccol;
	boxid="boxid"+boxval;
	for(i=0;i<boxcount;i++)

	{
		if(disp_seq_order[i]==boxval)

		{
			current_val = i;
		}
	}
	document.getElementById(boxid).innerHTML=disp_seq[current_val];
	if(click_itr==0)

	{
		lost_game=false;
	}
	click_seq[click_itr]= disp_seq[current_val];
	if(click_seq[click_itr]!=disp_seq_inc[click_itr])

	{
		lost_game=true;
		document.getElementById("instdiv").innerHTML="<font color='red'>You lost!!</font> Click here to try again. <br><input class='buttonclass' name='startgame' onclick='javascript:startsamestep();' id='startgame' type='button' value='Start' />";
	}
	click_itr++;
	if((click_itr==boxcount)&&(lost_game==false))

	{
		document.getElementById("instdiv").innerHTML="Congrats! Click to start to try a faster one.<br><input class='buttonclass' name='startgame' onclick='javascript:startnextstep();' id='startgame' type='button' value='Start' />";
	}
}
function blinkboxcolor(boxid,blinkchar)

{
	document.getElementById(boxid).innerHTML=blinkchar;
	func_str= "blinkboxcolor('"+boxid+"','&nbsp;')";
	if(blinkchar!="&nbsp;")

	{
		setTimeout(func_str,timeNumDisplay);
	}
}
function blinkbox(boxid,blinkchar)

{
	document.getElementById(boxid).innerHTML=blinkchar;
	func_str= "blinkbox('"+boxid+"','&nbsp;')";
	if(blinkchar!="&nbsp;")

	{
		setTimeout(func_str,timeNumDisplay);
	}
}
function startsamestep()

{
	click_itr=0;
	reset_box();
	startboxgame();

}
function reset_box()

{
	for(i=0;i<boxcount;i++)

	{
		boxid="boxid"+i;
		document.getElementById(boxid).innerHTML="";
	}
	click_itr=0;
	disp_seq=[];
	disp_seq_inc=[];
	click_seq=[];
	temp = [];
	for(i=0;i<boxcount;i++)

	{
		temp[i]=i;
	}
}
function startnextstep()

{
	if(mem_step==3)

	{
		window.location = "index.php?level="+document.getElementById('nextlevel').value;
		return;
	}
	mem_step++;
	switch(mem_step)

	{
		case 1:
			document.getElementById("scoreid").innerHTML="Speed: Medium";
			break;
		case 2:
			document.getElementById("scoreid").innerHTML="Speed: Fast";
			break;
		case 3:
			document.getElementById("scoreid").innerHTML="Speed: SuperFast";
			break;
		default:

	}
	reset_box();
	timeNumDisplay=timeNumDisplay-120;
	timeInterval =timeNumDisplay+0;
	startboxgame();
}
function show_color_text()

{
	for(row=0;row<4;row++)

	{
		for(col=0;col<4;col++)

		{
			boxid='#box'+row+col;
			boxitr=row*4+col;
			html_code = '<font color='+cg_color_group[boxitr][1]+'>'+cg_color_group[boxitr][2]+'</font>';
			$(boxid).html(html_code);
			//func_str='remove_content('+row+','+col+');';
			//setTimeout(func_str,1000);
		}
	}
}
function reset_col_game()

{
	click_seq = [];
	click_itr = 0;
}
function is_dissolved(bid)

{
	var i;
	for(i=0;i<disolved_itr;i++)

	{	
		if(bid==disolved_seq[i])

		{
			return true;
		}	
	}
	return false;
}
function disolve_boxes(boxid1,boxid2)

{
	$(boxid1).html("");
	$(boxid2).html("");
	$(boxid1).css("background","white");
	$(boxid2).css("background","white");
	$(boxid1).css('border-style',"none");
	$(boxid2).css('border-style',"none");
}
function cg_noteclick(row,col)

{
	var boxid;
	var boxitr;
	var preboxid;
	var preboxrow;
	var preboxcol;
	boxid='#box'+row+col;
	boxitr=row*cg_rows+col;
	if(is_dissolved(boxitr))

	{
		return;
	}
	html_code = '<font color='+cg_color_group[boxitr][1]+'>'+cg_color_group[boxitr][2]+'</font>';
	$(boxid).html(html_code);
	if(cg_prev_click==-1)

	{
		cg_prev_click=boxitr;
	}
	else

	{
		if((cg_color_group[cg_prev_click][1]==cg_color_group[boxitr][2])&&(cg_color_group[cg_prev_click][2]==cg_color_group[boxitr][1]))

		{	
			preboxrow=Math.floor(cg_prev_click/cg_rows);
			preboxcol=Math.floor(cg_prev_click%cg_cols);
			preboxid='#box'+preboxrow+preboxcol;
			var func_str='disolve_boxes("'+preboxid+'","'+boxid+'")';
			//disolve_boxes(preboxid,boxid);
			setTimeout(func_str,1000);	
			disolved_seq[disolved_itr++]=cg_prev_click;
			disolved_seq[disolved_itr++]=boxitr;
		}
		else

		{
			cg_prev_click=boxitr;
		}
	}
	set_border(row,col);
	func_str='remove_border('+row+','+col+');';
	setTimeout(func_str,2000);
}
function remove_border(row,col)

{
	boxid='#box'+row+col;
	$(boxid).css('border-style',"none");
	cg_prev_click=-1;
}
function set_border(row,col)

{
	boxid='#box'+row+col;
	$(boxid).css('border-style',"solid");
}
function remove_content(row,col)

{
	boxid='#box'+row+col;
	$(boxid).html('');
}
function shuffle_colors()

{
	var i;
	for(i=0;i<16;i++)

	{
		swap_pos=range_rand(boxcount-i);
		swap_val=cg_color_group[swap_pos];
		cg_color_group[swap_pos]=cg_color_group[16-1-i];
		cg_color_group[16-1-i]=swap_val;
	}
}




/***********************************************
 * Tower of Hanoi- by Glenn G. Vergara (glenngv@REMOVETHISyahoo.com)
 * This notice must stay intact for use
 * Visit Dynamic Drive (http://www.dynamicdrive.com/) for full source code
 ***********************************************/

var delay = 500; //in milliseconds

var	drag=false;
var objDisk=null;
var x = 0;
var y = 0;
var disksOnTower1 = new Array(null,null,null,null,null,null,null,null);
var disksOnTower2 = new Array(null,null,null,null,null,null,null,null);
var disksOnTower3 = new Array(null,null,null,null,null,null,null,null);
var disksOnTowers = new Array(disksOnTower1,disksOnTower2,disksOnTower3);
var offsetleft = 30;
var offsettop = 30;
var offsettower = 20;
var adheight = 20;
var offsethoriz = 30 + adheight;
var basetop = 0;
var diskheight = 0;
var midhoriztower = 0;
var indexTo=1;
var indexFr=1;
var movectr=0;
var gameOver=false;
var prevIndex=0;
var zindex = 0;
var currTower=1;
var prevTower=1;
var demo=false;
var arrFr = new Array(255);
var arrTo = new Array(255);
var idx = 0;
var pos = 0;
var t=null;
var stop=false;


var test_deepan=0;


function init()
{
	if (document.getElementById)
	{
		var diskno = document.hanoi.diskno;

		diskno.options.selectedIndex = 0;
		drawTowers();
		drawDisks(parseInt(diskno.options[diskno.options.selectedIndex].text,10));		
	}
}

function initVars()
{
	for (var i=0;i<disksOnTower1.length;i++)
	{
		disksOnTower1[i]=null;
		disksOnTower2[i]=null;
		disksOnTower3[i]=null;
	}
	drag = false;
	indexTo = 1;
	indexFr = 1;
	movectr = 0;
	zindex = 0;
	idx = 0;
	pos = 0;
	t = null;
	gameOver=false;
	stop=false;
	demo=false;
	document.hanoi.btnUndo.disabled=true;
}

function drawTowers()
{
	var title=document.getElementById("title");
	var tower1=document.getElementById("tower1");
	var tower2=document.getElementById("tower2");
	var tower3=document.getElementById("tower3");
	var settings=document.getElementById("settings");
	var titlewidth = parseInt(title.style.width);
	var titleheight = parseInt(title.style.height);        
	var towerwidth = parseInt(tower1.style.width);
	var towerheight = parseInt(tower1.style.height);
	var settingswidth = parseInt(settings.style.width);
	midhoriztower = parseInt(document.getElementById("horiztower1").style.width)/2;
	diskheight = parseInt(document.getElementById("disk1").style.height);

	title.style.left=offsetleft+(1.5*towerwidth)+offsettower-(titlewidth/2)+"px";
	title.style.top=offsettop+"px";
	tower1.style.left=offsetleft+"px";
	tower1.style.top=offsettop+titleheight+offsethoriz+"px";
	tower2.style.left=offsetleft+towerwidth+offsettower+"px";
	tower2.style.top=offsettop+titleheight+offsethoriz+"px";
	tower3.style.left=offsetleft+(towerwidth+offsettower)*2+"px";
	tower3.style.top=offsettop+titleheight+offsethoriz+"px";
	settings.style.left=offsetleft+(1.5*towerwidth)+offsettower-(settingswidth/2)+"px";
	settings.style.top=parseInt(tower1.style.top)+towerheight+offsethoriz+"px";
}

function drawDisks(disknum)
{
	var tower1=document.getElementById("tower1");
	var disktop = parseInt(tower1.style.top)+parseInt(document.getElementById("horiztower1").style.top);
	var lefttower1 = parseInt(tower1.style.left);
	var disk;
	var f=document.hanoi;
	basetop = disktop;
	for (var i=disksOnTower1.length;i>=1;i--)
	{
		disk = document.getElementById("disk"+i);
		disk.style.zIndex=++zindex;	
		if (i<=disknum)
		{
			disk.style.left=lefttower1+midhoriztower-parseInt(disk.style.width)/2+"px";
			disk.style.top=disktop-diskheight-1+"px";
			disktop = parseInt(disk.style.top);
			disksOnTowers[0][i-1]=disk;
		}            
		else 
		{
			disk.style.left="-250px";
			disk.style.top="-250px";
			disksOnTowers[0][i-1]=null;
		}
	}       
	f.minmove.value=f.diskno.options[f.diskno.options.selectedIndex].value;
	f.yourmove.value=0;
}

function newGame(obj)
{
	reset_titlediv();
	if (movectr>0 && !gameOver && !stop)
	{
		if (confirm("Current game will be aborted, would you like to continue?"))
		{
			initVars();
			drawDisks(parseInt(obj.options[obj.options.selectedIndex].text));
		}
		else document.hanoi.diskno.options.selectedIndex=prevIndex;
	}
	else 
	{
		initVars();
		drawDisks(parseInt(obj.options[obj.options.selectedIndex].text));
	}
}

function initializeDrag(disk,e)
{
	if (!e) e=event;
	if (stop)
	{
		//alert("You cannot continue solving the puzzle after clicking the 'Stop' button.\nClick 'Restart' button or select no. of disks to continue playing.");
		document.getElementById('title').innerHTML="You cannot continue solving the puzzle after clicking the 'Stop' button.\nClick 'Restart' button or select no. of disks to continue playing.";
		return;
	}
	indexFr = indexTo;
	if (disk.id!=disksOnTowers[indexFr-1][0].id || gameOver || demo) return;
	objDisk=disk;
	x=e.clientX;
	y=e.clientY;
	tempx=parseInt(disk.style.left);
	tempy=parseInt(disk.style.top);
	document.onmousemove=dragDisk;
}
function test_deepan_fun()
{
	document.getElementById('title').innerHTML=test_deepan++;
	document.getElementById('title').innerHTML=test_deepan+document.onmousemove;
}

function dragDisk(e)
{
	if (!e) e=event;
	zindex++;
	drag=true;
	var posX = tempx+e.clientX-x;
	var posY = tempy+e.clientY-y;
	var objTower1 = document.getElementById("tower1");
	var objTower2 = document.getElementById("tower2");
	var objTower3 = document.getElementById("tower3");
	var tower1Left = parseInt(objTower1.style.left);
	var tower2Left = parseInt(objTower2.style.left);
	var tower3Left = parseInt(objTower3.style.left);
	var tower3Width = parseInt(objTower3.style.width);

	objDisk.style.zIndex=zindex;
	objDisk.style.left=posX+'px';
	objDisk.style.top=posY+'px';        

	//if (e.clientX>=document.body.clientWidth-10 || e.clientY>=document.body.clientHeight-5 || e.clientX==5 || e.clientY==5)
	if (e.clientX>=document.body.clientWidth-10 || e.clientY>=365|| e.clientX==5 || e.clientY==5)
	{ //outside available window
		indexTo=indexFr;
		dropDisk(objDisk);
	}
	else if ( //in the vicinity of tower 3
			(tower3Left<=posX) && 
			(tower3Left+tower3Width>=posX) && 
			(parseInt(objTower3.style.top)+parseInt(objTower3.style.height)>posY)
		)
	{
		indexTo=3;
	}
	else if ((tower2Left<=posX) && (tower2Left+tower3Width>=posX))
	{ //in the vicinity of tower 2
		indexTo=2;
	}
	else if ((tower1Left<=posX) && (tower1Left+parseInt(objTower1.style.width)>=posX))
	{ //in the vicinity of tower 1
		indexTo=1;
	}
	else indexTo = indexFr;
	return false;
}

function dropDisk(disk)
{
	var f=document.hanoi;
	document.onmousemove=new Function("return false");
	if (!drag) return;
	var gameStatus=false;
	var topDisk = disksOnTowers[indexTo-1][0];
	if (indexFr==indexTo)
	{
		getNewTop(indexFr,null);
		pushDisk(disk,indexFr);	//put disk back to original tower
		getNewTop(indexFr,disk);
	}
	else if (topDisk==null) 
	{
		pushDisk(disk,indexTo);
		getNewTop(indexFr,null);
		getNewTop(indexTo,disk);
		movectr++;
		currTower=indexTo;
		prevTower=indexFr;
		f.btnUndo.disabled=false;
	}
	else if (parseInt(disk.style.width)<parseInt(topDisk.style.width))
	{
		pushDisk(disk,indexTo);
		getNewTop(indexFr,null);
		getNewTop(indexTo,disk);
		movectr++;
		currTower=indexTo;
		prevTower=indexFr;
		if (indexTo==3) gameStatus=checkStatus();
		f.btnUndo.disabled=false;
	}
	else 
	{
		getNewTop(indexFr,null);
		pushDisk(disk,indexFr);	//put disk back to original tower
		getNewTop(indexFr,disk);
	}

	drag=false;
	f.yourmove.value=movectr;
	if (gameStatus) 
	{
		f.btnUndo.disabled=true;
		minmove = parseInt(f.minmove.value);
		if (movectr==minmove) msg="\nCongratulations! You got it in "+minmove+" moves."
		else if (movectr>minmove) msg="\nYou can do better than that."
		else msg="";
		//alert("Game Over !!!"+msg);
		//document.getElementById("title").innerHTML="Game Over !! "+msg;
		alert("Game Over !!"+msg);
		gameOver=true;
	}
	return;
}      

function checkStatus()
{
	var gameStat = false;
	var disks=0;
	for (var i=0;i<disksOnTower3.length;i++)
	{
		if (disksOnTowers[2][i]!=null) disks++;
	}
	if (disks==parseInt(document.hanoi.diskno.options[document.hanoi.diskno.options.selectedIndex].text)) gameStat=true;
	return gameStat;
}

function pushDisk(disk,index)
{
	var diskWidth = parseInt(disk.style.width);
	var towerLeft = parseInt(document.getElementById("tower"+index).style.left);
	var topDisk = disksOnTowers[index-1][0];
	if (topDisk!=null)
	{
		topDiskWidth = parseInt(topDisk.style.width);
		topDiskTop = parseInt(topDisk.style.top);
		disk.style.left=towerLeft+midhoriztower-diskWidth/2+"px";
		disk.style.top=topDiskTop-diskheight-1+"px";
	}
	else 
	{
		disk.style.left=towerLeft+midhoriztower-diskWidth/2+"px";
		disk.style.top=basetop-diskheight-1+"px";
	}	
}

function getNewTop(index,disk)
{
	if (disk==null)
	{		//pop
		for (var i=0;i<disksOnTower1.length-1;i++)
		{
			disksOnTowers[index-1][i]=disksOnTowers[index-1][i+1];
		}
		disksOnTowers[index-1][disksOnTower1.length-1]=null;
	}
	else 
	{		//push
		for (var i=disksOnTower1.length-1;i>=1;i--)
		{
			disksOnTowers[index-1][i]=disksOnTowers[index-1][i-1];
		}
		disksOnTowers[index-1][0]=disk;
	}
}

function solve(btn)
{
	if (btn.value=="Solve")
	{
		if (movectr>0 && !gameOver && !stop)
			if (!confirm("Current game will be aborted, would you like to continue?")) return;
		btn.value="Stop";
		initVars();
		stop=false;
		demo=true;
		var f=document.hanoi;
		f.btnIns.disabled=true;
		f.btnRes.disabled=true;
		f.btnUndo.disabled=true;
		disknum = parseInt(f.diskno.options[f.diskno.options.selectedIndex].text);
		drawDisks(disknum);
		getMoves(0, 2, 1, disknum); 
		t=window.setTimeout("moveDisk()",delay);
	}
	else 
	{
		if (t) 
		{
			window.clearTimeout(t);
			btn.value="Solve";
			frm.btnIns.disabled=false;
			frm.btnRes.disabled=false;
			t = null;
			stop=true;
			demo=false;
		}

	}
}

function moveDisk()
{
	frm = document.hanoi;
	disk=disksOnTowers[arrFr[pos]][0];
	pushDisk(disk,arrTo[pos]+1);
	getNewTop(arrFr[pos]+1,null);
	getNewTop(arrTo[pos]+1,disk);
	movectr++;
	frm.yourmove.value=movectr;
	pos++;
	if (movectr<parseInt(frm.minmove.value)) t=window.setTimeout("moveDisk()",delay);
	else 
	{
		alert("Can you do that in "+movectr+" moves?");
		gameOver=true;
		stop=false;
		frm.btnSolve.value="Solve";
		frm.btnIns.disabled=false;
		frm.btnRes.disabled=false;
	}
}

function getMoves(from,to,empty,numDisk)
{
	if (numDisk > 1) 
	{
		getMoves(from, empty, to, numDisk - 1);
		arrFr[idx] = from;
		arrTo[idx++] = to;
		getMoves(empty, to, from, numDisk - 1);
	}
	else 
	{
		arrFr[idx] = from;
		arrTo[idx++] = to;
	}
}


function unDo(btn)
{
	disk=disksOnTowers[currTower-1][0];
	pushDisk(disk,prevTower);
	getNewTop(currTower,null);
	getNewTop(prevTower,disk);
	movectr--;
	document.hanoi.yourmove.value=movectr;
	btn.disabled=true;
}

function displayIns()
{
	var msg="Try to move all the disks from TOWER 1 to TOWER 3.\n";
	msg+="You may only move one disk at a time.\n";
	msg+="You must never allow a bigger disk to go on top of a smaller disk.";
	//alert(msg);
	document.getElementById('title').innerHTML=msg;
} 
function reset_titlediv()
{
	document.getElementById('title').innerHTML="";
}

