// JScript source code

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



//////////////////////////////////////////////////////////////
function SubmitContact(){

var tmpValid = "0"

    if (isWhitespace(document.form1.Name.value)){
	alert("Please enter your name.")
	document.form1.Name.focus();
	tmpValid++
	}

    else if (isWhitespace(document.form1.Email.value)){
	alert("Please enter your email address.")
	document.form1.Email.focus();
	tmpValid++
	}

    else if ((!(isEmail(document.form1.Email.value))) && (!(isWhitespace(document.form1.Email.value)))){
	alert("The email address you entered is not valid.  Please try again.")
	document.form1.Email.focus();
	tmpValid++
	}
	

if (tmpValid == "0")
{
document.form1.submit();
}

}



function CheckSection()
	{
	var tmpValid = "0"
		if (isWhitespace(document.form1.SectionName.value))
				{
				alert("Please Enter A Section Name")
				document.form1.SectionName.focus();
				tmpValid++
				}
				
		else if (document.form1.SectionType.selectedIndex <= 0)
				{
				alert("Please Select a Section Type")
				
				tmpValid++
				}
				
		else if (document.form1.SectionType.selectedIndex == 2 && document.form1.link.value == '' )
				{
				alert("Please Supply a link")
				
				tmpValid++
				}
		
			if (tmpValid == "0") {
				//document.getElementById("inpContent").value = oEdit1.getHTMLBody();
				return (true);
			}
			
			else {
				
				return (false)
				}
		}

/////////////////////////////////////////////////

function WeatherpopUp() {
day = new Date();
id = day.getTime();
vURL = 'http://newstribune.cmititestbank.com/weather/forecast.asp';
eval("page" + id + " = window.open(vURL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=625,height=575');");
}

/////////////////////////////////////////////////

function ClearField(WhatForm,WhatField){
	var ClearWhat = "document." + WhatForm +"." + WhatField
	
	
	alert("Sorry.  You are not allowed to paste values into this field.\nPlease type in your entry again to ensure its validity.")
	window.event.returnValue=false;
	ClearWhat.value = "";
	//ClearWhat.focus();
	//document.WhatForm.WhatField.value = "";
	//document.WhatForm.WhatField.focus();

}

/////////////////////////////////////////////////

function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('your input has been truncated!');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
}


//////////////////CHecks form on reg page /register/default.asp///////////////////////////

function CheckReg(){


var tmpValid = "0"

	if ((isWhitespace(document.FrontPage_Form1.FirstName.value)))
	{
	alert("First Name is required.")
	document.FrontPage_Form1.FirstName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.LastName.value)))
	{
	alert("Last Name is required.")
	document.FrontPage_Form1.LastName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.Email.value)))
	{
	alert("Email is required.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.Email.value)))
	{
	alert("The Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("Please confirm your Email Address is correct by typing it in again.")
	document.FrontPage_Form1.ConfirmEmail.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("The confirmation Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.ConfirmEmail.focus();
	tmpValid++
	}
	
	else if (!((document.FrontPage_Form1.Email.value) == (document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("The confirmation Email Address you specified is  not the same as the Email Address entered above.\nPlease check this values and try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	

	else if ((isWhitespace(document.FrontPage_Form1.Password.value)))
	{
	alert("Password is required.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("Please confirm your Password is correct by typing it in again.")
	document.FrontPage_Form1.ConfirmPassword.focus();
	tmpValid++
	}	

	
	else if (!((document.FrontPage_Form1.Password.value) == (document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("The confirmation Password you specified is not the same as the Password entered above.\nPlease check this values and try again.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}

	
	else if (((!(isInteger(document.FrontPage_Form1.AreaCode.value))) || (!(document.FrontPage_Form1.AreaCode.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("Please enter your Area Code. (Must be three integer values)")
	document.FrontPage_Form1.AreaCode.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone1.value))) || (!(document.FrontPage_Form1.Phone1.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone1.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone2.value))) || (!(document.FrontPage_Form1.Phone2.value.length == 4))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone2.focus();
	tmpValid++
	}
	
	
	else if ((isWhitespace(document.FrontPage_Form1.Zip.value)) )
	{
	alert("Zip Code is required.")
	document.FrontPage_Form1.Zip.focus();
	tmpValid++
	}



	else if (((document.FrontPage_Form1.Question1.value) == 'none'))
	{
	alert("Question 1 is required.")
	document.FrontPage_Form1.Question1.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question2.value) == 'none'))
	{
	alert("Question 2 is required.")
	document.FrontPage_Form1.Question2.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question3.value) == 'none'))
	{
	alert("Question 3 is required.")
	document.FrontPage_Form1.Question3.focus();
	tmpValid++
	}	
	
	else if (((document.FrontPage_Form1.Question4.value) == 'none'))
	{
	alert("Question 4 is required.")
	document.FrontPage_Form1.Question4.focus();
	tmpValid++
	}	
	
	else if (((document.FrontPage_Form1.Question5.value) == 'none'))
	{
	alert("Question 5 is required.")
	document.FrontPage_Form1.Question5.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question6.value) == 'none'))
	{
	alert("Question 6 is required.")
	document.FrontPage_Form1.Question6.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question8.value) == 'none'))
	{
	alert("Question 8 is required.")
	document.FrontPage_Form1.Question8.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question9.value) == 'none'))
	{
	alert("Question 9 is required.")
	document.FrontPage_Form1.Question9.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question10.value) == 'none'))
	{
	alert("Question 10 is required.")
	document.FrontPage_Form1.Question10.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question11.value) == 'none'))
	{
	alert("Question 11 is required.")
	document.FrontPage_Form1.Question11.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question12.value) == 'none'))
	{
	alert("Question 12 is required.")
	document.FrontPage_Form1.Question12.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Hint.value) == 'none'))
	{
	alert("Hint is required.")
	document.FrontPage_Form1.Hint.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.HintAnswer.value)))
	{
	alert("Hint Answer is required.")
	document.FrontPage_Form1.HintAnswer.focus();
	tmpValid++
	}

	
	
	else if ((document.FrontPage_Form1.registertype[1].checked) && ((isWhitespace(document.FrontPage_Form1.City.value)) || (isWhitespace(document.FrontPage_Form1.Address1.value))))
	{
	alert("You have indicated you would also like to start a subscription to the paper. \n Please supply your mailing address before proceeding")
	tmpValid++
	}	
	
if (tmpValid == "0") {
				document.getElementById('regsubmit').disabled = true
				return (true);
			}
			
			else {
				
				return (false)
				}
}

//////////////////CHecks form on reg-subscribe page /register/subscribe.asp///////////////////////////

function CheckSubscribe(){


var tmpValid = "0"

	if ((isWhitespace(document.FrontPage_Form1.FirstName.value)))
	{
	alert("First Name is required.")
	document.FrontPage_Form1.FirstName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.LastName.value)))
	{
	alert("Last Name is required.")
	document.FrontPage_Form1.LastName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.Email.value)))
	{
	alert("Email is required.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.Email.value)))
	{
	alert("The Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}

	
	else if (((!(isInteger(document.FrontPage_Form1.AreaCode.value))) || (!(document.FrontPage_Form1.AreaCode.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("Please enter your Area Code. (Must be three integer values)")
	document.FrontPage_Form1.AreaCode.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone1.value))) || (!(document.FrontPage_Form1.Phone1.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone1.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone2.value))) || (!(document.FrontPage_Form1.Phone2.value.length == 4))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone2.focus();
	tmpValid++
	}
	
	
	else if ((isWhitespace(document.FrontPage_Form1.Zip.value)) )
	{
	alert("Zip Code is required.")
	document.FrontPage_Form1.Zip.focus();
	tmpValid++
	}
	
	var radioSelected1 = false;
		for (i = 0;  i < FrontPage_Form1.term.length;  i++)
		{
		if (FrontPage_Form1.term[i].checked)
		radioSelected1 = true;
		}
		if (!radioSelected1)
		{
		alert("Please Select a subscription term")
		tmpValid++
		}
	
	/*var radioSelected2 = false;
		for (i = 0;  i <= FrontPage_Form1.PaymentType.length;  i++)
		{
		if (FrontPage_Form1.PaymentType[i].checked)
		radioSelected2 = true;
		}
		if (!radioSelected2)
		{
		alert("Please Select a payment Type")
		tmpValid++
		}

*/
	
	
if (tmpValid == "0") {
				document.getElementById('regsubmit').disabled = true
				return (true);
			}
			
			else {
				
				return (false)
				}
}

//////////////////CHecks form on My account/default ///////////////////////////

function CheckInfo(){


var tmpValid = "0"

	if ((isWhitespace(document.FrontPage_Form1.FirstName.value)))
	{
	alert("First Name is required.")
	document.FrontPage_Form1.FirstName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.LastName.value)))
	{
	alert("Last Name is required.")
	document.FrontPage_Form1.LastName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.Email.value)))
	{
	alert("Email is required.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.Email.value)))
	{
	alert("The Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.Password.value)))
	{
	alert("Password is required.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("Please confirm your Password is correct by typing it in again.")
	document.FrontPage_Form1.ConfirmPassword.focus();
	tmpValid++
	}	

	
	else if (!((document.FrontPage_Form1.Password.value) == (document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("The confirmation Password you specified is not the same as the Password entered above.\nPlease check this values and try again.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}
		
	else if (((!(isInteger(document.FrontPage_Form1.AreaCode.value))) || (!(document.FrontPage_Form1.AreaCode.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("Please enter your Area Code. (Must be three integer values)")
	document.FrontPage_Form1.AreaCode.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone1.value))) || (!(document.FrontPage_Form1.Phone1.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone1.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone2.value))) || (!(document.FrontPage_Form1.Phone2.value.length == 4))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone2.focus();
	tmpValid++
	}
	
	
	else if (((isWhitespace(document.FrontPage_Form1.Zip.value)) || (isWhitespace(document.FrontPage_Form1.City.value)) || (isWhitespace(document.FrontPage_Form1.Address1.value))))
	{
	alert("Please supply your full mailing address before proceeding")
	tmpValid++
	}	
	
		
	
if (tmpValid == "0") {
				document.getElementById('regsubmit').disabled = true
				return (true);
			}
			
			else {
				
				return (false)
				}
}

///////////////////////////////////////////////////////////////////////////////

function CheckContactForm()
	{
	var tmpValid = "0"
		if (isWhitespace(document.form1.Name.value))
				{
				alert("Please Enter Your Name")
				document.form1.Name.focus();
				tmpValid++
				}
				
		else if (!(isEmail(document.form1.email.value)))
				{
				alert("Please Enter a valid Email Address")
				document.form1.email.focus();
				tmpValid++
				}
				
				
			if (tmpValid == "0") {
				//document.getElementById("inpContent").value = oEdit1.getHTMLBody();
				return (true);
			}
			
			else {
				
				return (false)
				}
		}
		
//////////////////CHecks form on subscription page /subscriptions/default.asp///////////////////////////

function CheckSubscription(){


var tmpValid = "0"

	if ((isWhitespace(document.FrontPage_Form1.FirstName.value)))
	{
	alert("First Name is required.")
	document.FrontPage_Form1.FirstName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.LastName.value)))
	{
	alert("Last Name is required.")
	document.FrontPage_Form1.LastName.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.Email.value)))
	{
	alert("Email is required.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.Email.value)))
	{
	alert("The Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("Please confirm your Email Address is correct by typing it in again.")
	document.FrontPage_Form1.ConfirmEmail.focus();
	tmpValid++
	}
	
	else if (!(isEmail(document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("The confirmation Email Address you specified is not valid.  Please try again.")
	document.FrontPage_Form1.ConfirmEmail.focus();
	tmpValid++
	}
	
	else if (!((document.FrontPage_Form1.Email.value) == (document.FrontPage_Form1.ConfirmEmail.value)))
	{
	alert("The confirmation Email Address you specified is  not the same as the Email Address entered above.\nPlease check this values and try again.")
	document.FrontPage_Form1.Email.focus();
	tmpValid++
	}
	

	else if ((isWhitespace(document.FrontPage_Form1.Password.value)))
	{
	alert("Password is required.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("Please confirm your Password is correct by typing it in again.")
	document.FrontPage_Form1.ConfirmPassword.focus();
	tmpValid++
	}	

	
	else if (!((document.FrontPage_Form1.Password.value) == (document.FrontPage_Form1.ConfirmPassword.value)))
	{
	alert("The confirmation Password you specified is not the same as the Password entered above.\nPlease check this values and try again.")
	document.FrontPage_Form1.Password.focus();
	tmpValid++
	}

	
	else if (((!(isInteger(document.FrontPage_Form1.AreaCode.value))) || (!(document.FrontPage_Form1.AreaCode.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("Please enter your Area Code. (Must be three integer values)")
	document.FrontPage_Form1.AreaCode.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone1.value))) || (!(document.FrontPage_Form1.Phone1.value.length == 3))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone1.focus();
	tmpValid++
	}
	
	else if (((!(isInteger(document.FrontPage_Form1.Phone2.value))) || (!(document.FrontPage_Form1.Phone2.value.length == 4))) && (isWhitespace(document.FrontPage_Form1.Other.value)))
	{
	alert("There was an error in how you entered your phone number.  Please try again.")
	document.FrontPage_Form1.Phone2.focus();
	tmpValid++
	}
	
	
	else if ((isWhitespace(document.FrontPage_Form1.Zip.value)) )
	{
	alert("Zip Code is required.")
	document.FrontPage_Form1.Zip.focus();
	tmpValid++
	}
	
	
	else if ((isWhitespace(document.FrontPage_Form1.City.value)) || (isWhitespace(document.FrontPage_Form1.Address1.value)))
	{
	alert("Please supply your mailing address ")
	tmpValid++
	}	



	else if (((document.FrontPage_Form1.Question1.value) == 'none'))
	{
	alert("Question 1 is required.")
	document.FrontPage_Form1.Question1.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question2.value) == 'none'))
	{
	alert("Question 2 is required.")
	document.FrontPage_Form1.Question2.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question3.value) == 'none'))
	{
	alert("Question 3 is required.")
	document.FrontPage_Form1.Question3.focus();
	tmpValid++
	}	
	
	else if (((document.FrontPage_Form1.Question4.value) == 'none'))
	{
	alert("Question 4 is required.")
	document.FrontPage_Form1.Question4.focus();
	tmpValid++
	}	
	
	else if (((document.FrontPage_Form1.Question5.value) == 'none'))
	{
	alert("Question 5 is required.")
	document.FrontPage_Form1.Question5.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question6.value) == 'none'))
	{
	alert("Question 6 is required.")
	document.FrontPage_Form1.Question6.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question8.value) == 'none'))
	{
	alert("Question 8 is required.")
	document.FrontPage_Form1.Question8.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question9.value) == 'none'))
	{
	alert("Question 9 is required.")
	document.FrontPage_Form1.Question9.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question10.value) == 'none'))
	{
	alert("Question 10 is required.")
	document.FrontPage_Form1.Question10.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question11.value) == 'none'))
	{
	alert("Question 11 is required.")
	document.FrontPage_Form1.Question11.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Question12.value) == 'none'))
	{
	alert("Question 12 is required.")
	document.FrontPage_Form1.Question12.focus();
	tmpValid++
	}
	
	else if (((document.FrontPage_Form1.Hint.value) == 'none'))
	{
	alert("Hint is required.")
	document.FrontPage_Form1.Hint.focus();
	tmpValid++
	}
	
	else if ((isWhitespace(document.FrontPage_Form1.HintAnswer.value)))
	{
	alert("Hint Answer is required.")
	document.FrontPage_Form1.HintAnswer.focus();
	tmpValid++
	}



	
if (tmpValid == "0") {
				document.getElementById('regsubmit').disabled = true
				return (true);
			}
			
			else {
				
				return (false)
				}
}

//////////////////////////////////////////////////////////////////////////
function findInPage(str) {

  var txt, i, found;

  if (str == "")
    return false;

  // Find next occurance of the given string on the page, wrap around to the
  // start of the page if necessary.

  if (NS4) {

    // Look for match starting at the current point. If not found, rewind
    // back to the first match.

    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;

    // If not found in either direction, give message.

    if (n == 0)
      alert("Not found.");
  }

  if (IE4) {
    txt = win.document.body.createTextRange();

    // Find the nth match from the top of the page.

    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
    }

    // If found, mark it and scroll it into view.

    if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    }

    // Otherwise, start over at the top of the page and find first match.

    else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }

      // Not found anywhere, give message.

      else
        alert("Not found.");
    }
  }

  return false;
}

