document.write("<div class=\"hsb2\">")
<?php
/* example of $basehref usage to make development easier
<h4><a href="http://<?php echo ("$basehref"); ?>/links.html">Links</a></h4>
*/  
$basehref = (getenv("SERVER_NAME"));
    if ($basehref != "www.homeschoolbuzz.com")  { 
        $basehref .= "/~homescho"; //if host, OK if not add account path
        }
/* end $basehref */
//define the target window for the link to open
if (!$TARGET) {$TARGET = "_self";} //default is _self
// Get a file into an array.  
$lines = file ('index.html');
//define what to search for
$str = "<h3>(.*)</h3>"; //for healines
$href = "<span class=\"byline\">p.*<a href=\"(http.*)\">.*</a> </span>"; //for their Urls

// Loop through our array, extract 6 headlines with URIs.
$count = 0;
if (!$num) {$num = 6;}
foreach ($lines as $line) {
  if ($count < $num) { //when count reaches $num, stop
    if (eregi($str, $line, $out)){
    $head = "$out[1]";
    $count = ($count + 1);
    } else {
    	continue; //if there isn't an h3, dont get a url
    }
    if (eregi($href, $line, $a)){
    $url = strtok("$a[1]", " |>|\"");
    echo "document.write(\"<p><small>\")\n";
    $readmore = "<a href=\"$url\" TARGET=\"$TARGET\">$head</a>";
    echo "document.write(\"";
    echo AddSlashes(chop($readmore));
    echo "\")\ndocument.write(\"</a></small></p>\")\n";
    continue; 
    }
  }
}
//document.write("Compare prices: <a href='http://www.homeschoolbuzz.com/books.html'>homeschool books</a> at HomeSchoolBuzz.com</small><br>")
//document.write("More <a href='http://www.homeschoolbuzz.com/'>homeschool news</a> at HomeSchoolBuzz.com</small><br>")
//document.write("More <a href='http://www.homeschoolbuzz.com/'>homeschool news</a> and compare <a href='http://www.homeschoolbuzz.com/books.html'>homeschool books prices</a> at HomeSchoolBuzz.com</small><br>")
$news_ad = "document.write(\"More <a href='http://www.homeschoolbuzz.com/'>homeschool news</a> at HomeSchoolBuzz.com</small><br>\")\n";
$book_ad = "document.write(\"Compare prices: <a href='http://homeschoolbuzz.com/books.html?k=Klutz+Kwiz'>Klutz Kwiz</a> at HomeSchoolBuzz.com</small><br>\")\n"; 
//alternate ads every 30 minutes
$localtime = localtime();
if ($localtime[1] >= 30) {
	$ad = "$news_ad";
}else{$ad = "$book_ad";}
?>
document.write("</div>")
document.write("<div class=\"hsb1\">")
document.write("      <small>") 
<?php echo "$ad"; ?>
document.write("</div>")


