
function Square_Root_Progression(){
sqrtT.innerHTML="";
sqrT.innerHTML="";
difT.innerHTML="";
sqrt.innerHTML="";
sqr.innerHTML="";
dif.innerHTML="";
line1.innerHTML="";
line.innerHTML="";
var initsquare=parseInt(SRProgress.startSquare.value);
if (initsquare<1 || initsquare==""){alert("This number should be greater than zero!");SRProgress.startSquare.focus();return false}
var finalsquare=SRProgress.finalSquare.value;
if (initsquare>=finalsquare){alert("The second number should be greater than the first!");SRProgress.finalSquare.focus();SRProgress.finalSquare.select();return false}
var diff=finalsquare-initsquare;
var amtAdd=((initsquare*2)+diff)*diff;
initSquare.innerHTML="Initial Square ["+initsquare+"&sup2"+"]";
initSquareR.innerHTML=Comma(Math.pow(initsquare,2));
dblInit.innerHTML="Next: double initial square root";
dblInitR.innerHTML="["+initsquare+"x2="+initsquare*2+"]";
addDiff.innerHTML="Next: add difference to above"; 
addDiffR.innerHTML="["+diff+"+"+initsquare*2+"="+parseInt((initsquare*2)+diff)+"]"; 

amountToAdd.innerHTML="Next: multiply this by difference ["+Comma(parseInt((initsquare*2)+diff))+"x"+diff+"]";
amountToAddR.innerHTML=Comma(((initsquare*2)+diff)*diff);
finalSquare.innerHTML="Final Square ["+finalsquare+"&sup2"+"] = ["+Comma(initsquare)+"&sup2"+"+"+Comma(((initsquare*2)+diff)*diff)+"]";
finalSquareR.innerHTML=Comma(Math.pow(finalsquare,2));

if (SRProgress.choice[0].checked==true)
{line1.innerHTML="<hr>";
line.innerHTML="<hr>";
sqrtT.innerHTML="<u>Square Root</u>";
difT.innerHTML="<u>Make-up of Square</u>";
sqrT.innerHTML="<u>Square</u>";

for (x=initsquare; x<=finalsquare; x++)
{sqrt.innerHTML=sqrt.innerHTML+x+"<br>";
dif.innerHTML=dif.innerHTML+Comma(Math.pow((x-1),2))+"+"+parseInt(((x-1)*2+1))+" =["+(x-1)+"&sup2"+"+("+(x-1)+"x2)+1]"+"<br>";
sqr.innerHTML=sqr.innerHTML+Comma(Math.pow(x,2))+"<br>"}
	}
}

function CheckAll(){
if (SRProgress.startSquare.value=="" && SRProgress.finalSquare.value=="")
{alert("Please input a number!");SRProgress.startSquare.focus();return false}
else
{SRProgress.difference.value=SRProgress.finalSquare.value-SRProgress.startSquare.value}
}

function Comma(number) {
number = '' + number;
if (number.length > 3) {
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++) {
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}

function addbookmark(){
if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}

var clockID=0
function UpdateClock(){
if (clockID)
{clearTimeout(clockID);
clockID = 0;}

var H,M,S,Mth,Day,AMPM,Yr
var tDate = new Date();
Day=tDate.getDate()
if (Day<10)
{Day="0"+Day;}

Mth=tDate.getMonth()+1
if (Mth==1){Mth="Jan"}
if (Mth==2){Mth="Feb"}
if (Mth==3){Mth="Mar"}
if (Mth==4){Mth="Apr"}
if (Mth==5){Mth="May"}
if (Mth==6){Mth="Jun"}
if (Mth==7){Mth="Jul"}
if (Mth==8){Mth="Aug"}
if (Mth==9){Mth="Sep"}
if (Mth==10){Mth="Oct"}
if (Mth==11){Mth="Nov"}
if (Mth==12){Mth="Dec"}

Yr=tDate.getFullYear()

H=tDate.getHours();
if (H>11)
{AMPM="pm";}
else
{AMPM="am";}

if (H>12)
{H=H-12;}

if (H<10)
{H="0"+H;}

M=tDate.getMinutes()
if (M<10)
{M="0"+M;}

S=tDate.getSeconds()
if (S<10)
{S="0"+S;}

theTime.innerHTML = Day + " " + Mth + " " + Yr + "::"
+ H + ":" + M + ":" + S + AMPM;
clockID = setTimeout("UpdateClock()",1000);
}

function StartClock() {
clockID = setTimeout("UpdateClock()",1000);
}

function KillClock() {
if (clockID)
 {clearTimeout(clockID);
 clockID = 0;}
}
