    function doHover(elem)
    {
        tPage.className = "pagOff";
        elem.className = "pagOn";
    }
    function doOut(elem)
    {
        elem.className = "pagOff";
        tPage.className = "pagOn";
    }



function replaceAll(oldStr,findStr,repStr) {
  var srchNdx = 0;  // srchNdx will keep track of where in the whole line
                    // of oldStr are we searching.
  var newStr = "";  // newStr will hold the altered version of oldStr.
  while (oldStr.indexOf(findStr,srchNdx) != -1)  
                    // As long as there are strings to replace, this loop
                    // will run. 
  {
    newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
                    // Put it all the unaltered text from one findStr to
                    // the next findStr into newStr.
    newStr += repStr;
                    // Instead of putting the old string, put in the
                    // new string instead. 
    srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
                    // Now jump to the next chunk of text till the next findStr.           
  }
  newStr += oldStr.substring(srchNdx,oldStr.length);
                    // Put whatever's left into newStr.             
  return newStr;
}


    function doComments(f)
    {
        var xmlHttp = false; 
        xmlHttp = GetXmlHttpObject(); 

        function DoAJAXResponse() 
        {
            if(xmlHttp.readyState == 4) 
            {
                if(xmlHttp.status == 200) 
                { 
//                    var ga = xmlHttp.responseText
//                    window.alert(ga);
                    window.location = window.location;
                }
            } 
/*            else if(xmlHttp.readyState == 3) 
            {
            }            
*/            else
            {
//                    window.alert(f + ' ' +xmlHttp.readyState);
            }
        } 

        var requestURL = f; 
//window.alert(requestURL);
        xmlHttp.onreadystatechange = DoAJAXResponse;  
        xmlHttp.open("GET", requestURL, true); 
        xmlHttp.send(null); 

//            window.alert('gotta do servlet call here');
    }


        function toggleComments(no)
        {
            var tempA = document.getElementById('ddd'+no);
            if(tempA.style.display=="block")
                tempA.style.display="none";
            else
                tempA.style.display="block";
        }

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function checkSubmit(rr)
{
    var tempCom = document.getElementsByName("commenter")[rr-1];
    var tempUrl = document.getElementsByName("url")[rr-1];
    var tempComment = document.getElementsByName("comment")[rr-1];
    var tempPost = document.getElementsByName("post")[rr-1];

//window.alert('!'+tempCom.value+'!');
    if(tempCom.value == "" || tempCom.value==" " || tempCom.value==null)
    {
        window.alert("We ain't no longer accepting nameless comments.  So make up a name if you want, but you can't leave it blank.  Thanks!");
        return false;
    }
    setTheCookie(rr);
    var tempSubmit = "comment.php?commenter=" +tempCom.value+"&url="+tempUrl.value+"&comment="+replaceAll(replaceAll(replaceAll(tempComment.value, "&", "%26"), "#", "%23"),"?", "%3F")+"&post="+tempPost.value;
//    window.alert(tempSubmit);
    doComments(tempSubmit);
//    document.getElementsByName("commentForm")[rr-1].submit();
}

function setTheCookie(wh)
{
//    window.alert("setting cookie "+wh); 
    setCookie("commenter", document.getElementsByName("commenter")[wh-1].value, "Thu, 01-Jan-11 00:00:01 GMT"); 
    var born = new Date("July 21, 2011 01:15:00");
    setCookie("curl", document.getElementsByName("url")[wh-1].value, born); 
}

function header()
{
    var bdw = new Array();
    bdw[0] = new Array("b", "B","<span style='position:relative;left:.1em;'>|</span>3");
    bdw[1] = new Array("l", "L","1");
    bdw[2] = new Array("&#210;","&#211;","&#212;","&#213;","&#214;","&#216;","&#242;","&#243;","&#244;","&#245;","&#246;","&#248;");
    bdw[3] = new Array("G", "g");
    bdw[4] = new Array(" ");
    bdw[5] = new Array("&#240;", "&#208;", "D", "d", "|&gt;");
    bdw[6] = new Array("&#249;", "&#250;","&#251;","&#252;","&#217;","&#218;","&#219;","&#220;");
    bdw[7] = new Array(" ");
    bdw[8] = new Array("W", "w", "\\/\\/", "VV", "vv", "\\^/");
    bdw[9] = new Array("R", "r");
    bdw[10] = new Array("&#200;","&#201;","&#202;","&#203;");
    bdw[11] = new Array("N", "n", "|\\|", "&#209;", "&#241;");

    var fonts = new Array("Helvetica", "Arial", "Courier", "Times New Roman", "Comic Sans Serif");
    var bdwTitle = "";
    bdwTitle+="<table height='160' width='980' style='background-position:50% 0%;background-image:url(stuff/header3.jpg);color:#FFFFFF;border-bottom:2px solid #000000'><tr><td valign='middle' style='padding-left:55px'><a href='/' style='text-decoration:none;color:#ffffff'>";
    for(i=0;i<bdw.length;i++)
    {
        fs = (Math.floor(Math.random()*19)+57);
        
        if(bdw[i][0]!=" ")
        {
            var bol="normal";
            if(Math.floor(Math.random()*15)%2==1)
                bol = "bold"; 
            
            bdwTitle+="<span style='font-size:"+fs+"px;border:0px solid #000000;margin:2px;font-weight:"+bol+"'>";
            bdwTitle+="<font face='"+fonts[Math.floor(Math.random()*fonts.length)]+"'>";
            bdwTitle+=bdw[i][Math.floor(Math.random()*bdw[i].length)];
            bdwTitle+="</font></span>";
        }
        else
        {    
            bdwTitle+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }
    bdwTitle+="</a></td></tr><tr>"+
        "<td style='color:#666666;font-weight:bold' valign='bottom'><a class='mainNav' href='?templateFile=http://www.blogduwren.com/archive.php'>Archive</a> | "+
        "<a class='mainNav' href='?templateFile=about.html'>About</a> | "+
        "<a class='mainNav' href='?templateFile=linkblog.txt'>Link Blog</a> | "+
        "<a class='mainNav' href='?templateFile=games.html'>Games</a> | "+
        "<a class='mainNav' href='comics.php'>Comics</a> | "+
        "<a class='mainNav' href='rss.php'>RSS <img src='rss.gif' hspace='1' style='padding:0px;margin:0px;' border='0'/></a> | "+
//        "<a class='mainNav' href='pgta/peoplesGuideToAna.html'>People's Guide To Anacortes</a> | "+
        "<a class='mainNav' href='test/sleepingAround.html'>Sleeping Around</a> | "+
        "<a class='mainNav' href='http://www.northsoundtransitguide.com'>North Sound Transit Guide</a> | "+
        "<a class='mainNav' href='?templateFile=http://www.blogduwren.com/test/sql.php'>Life Book List</a> | "+
        "<a class='mainNav' href='?templateFile=resume.html'>Portfolio</a> | "+
        "<a class='mainNav' href='?templateFile=contact_f.html'>Contact</a></td></tr></table>";
    document.write(bdwTitle);
}


if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}
