function ListOfPrimes(){
var fnum=parseInt(listprimenum.numone.value);
var snum=parseInt(listprimenum.numtwo.value);

if (snum==fnum && fnum==0 || snum==fnum && fnum==1){snum=2;listprimenum.getlist.value="Get Primes Between "+fnum+" and "+snum}

if (snum==fnum){alert ("Please choose a second number greater than "+fnum+"!");listprimenum.numtwo.focus();listprimenum.numtwo.select();return false}

if (fnum>snum)
{var temp=fnum;fnum=snum;snum=temp}

var strR=""; no=0;
for (m=fnum; m<=snum; m++)
{var y=0;
for (x=2; x<=snum; x++)
{if (m%x==0 && m!=x){y++}
if (m<10 && x==1){y++}
}	
if (y==0)
{no++;
if (no%15==0){strR=strR+m+"<br>"}
else
{strR=strR+m+","}}
}
results.innerHTML="";
thestring=strR.substring(strR.length-1,0);
if (thestring==""){}
else
{results.innerHTML="Prime Numbers ::>>::>>::>>"+"<br>"+thestring}
if (no==1){singpl=" is "}else{singpl=" are "}
if (no==1){nmbs=" number "}else{nmbs=" numbers "}
results1.innerHTML="There"+singpl+no+" prime"+nmbs+ "between "+fnum+" and "+snum+"."
}

function UpdateButton()
{listprimenum.getlist.value="Get Primes Between "+listprimenum.numone.value+" and "+listprimenum.numtwo.value}

 function putFocus(formInst, elementInst){
document.forms[0].elements[1].focus();document.forms[0].elements[1].select()}

function select_area()
{listprimenum.numone.select()}

function select_area1()
{listprimenum.numtwo.select()}

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;}
}

function addbookmark()
{if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}

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;
}

