/* dof_academic.js (Cross-browser)
* Julia's code comments
*/
/*if the div is visible then hide or if it is hidden make visible
*/

function showorhide(id) { if (document.getElementById(id).style.display == "none") {



document.getElementById(id).style.display = "block";
document.getElementById(id).style.color = "black";
document.divs.style.visibility="visible";

} else {
document.getElementById(id).style.display = "none";
}
}

/*i wrote this because i have the text color of the divs set to white so that as they are being hidden onload, the user doesn't see them (they change to blue onclick when tagstyle is called prior to showorhide), but then the a:link was showing up so i wanted to make those tags with the class lightcolor(white) change to darkcolor(the blue linkcolor) with this function. */

function tagstyle() {
var D = document.getElementsByTagName('a');
for(var i=0;i<D.length;i++)
if(D[i].className=='lightcolor') D[i].className="darkcolor";
}

/*hides all divs the shows content div
*/

function hidedivs(id) { var divs = document.getElementsByTagName('div'); 
for(var k=0, div; k<divs.length; k++) { var div = divs[k]; 
div.style.display = (div.id==id)? 'block':'none';
document.getElementById('content').style.display="block";
document.getElementById('select').style.display="block";

} 
}



/*changing text size*/

function changeFontSize(inc)
{
  var p = document.getElementsByTagName('p');
  for(n=0; n<p.length; n++) {
    if(p[n].style.fontSize) {
       var size = parseInt(p[n].style.fontSize.replace("px", ""));
    } else {
       var size = 12;
    }
    p[n].style.fontSize = size+inc + 'px';
   }
}
/*loads external file into div
*/





function updateObjectIframe(which){
    document.getElementById('one').innerHTML = '<'+'object id="foo" name="foo" type="text/html" data="'+which.href+'"><\/object>';
}

/*i hope to show div based on google search term
modified highlightgoogle search script/ searches for query string from document.referrer and shows div

*/ 

function showGoogleSearchTerms(referrer)
{
  
  
 var referrer = document.referrer;
  if (!referrer) {
    return false;
  }
  
  var queryPrefix = "q=";
  var startPos = referrer.toLowerCase().indexOf(queryPrefix);
  if ((startPos < 0) || (startPos + queryPrefix.length == referrer.length)) {
    return false;
  }
  
  var endPos = referrer.indexOf("&", startPos);
  if (endPos < 0) {
    endPos = referrer.length;
  }
  
  var queryString = referrer.substring(startPos + queryPrefix.length, endPos);
  // fix the space characters
  queryString = queryString.replace(/%20/gi, " ");
  queryString = queryString.replace(/\+/gi, " ");
  // remove the quotes (if you're really creative, you could search for the
  // terms within the quotes as phrases, and everything else as single terms)
  queryString = queryString.replace(/%22/gi, "");
  queryString = queryString.replace(/\"/gi, "");
  
  var grandpa = queryString;
var divs = document.getElementsByTagName('div');

  for( var i = 0;i < divs.length ; i++ )

  {

var x = divs;

  }


}

function findString (str) {
 if (parseInt(navigator.appVersion)<4) return;
 var strFound;
 if (navigator.appName=="Netscape") {

  // NAVIGATOR-SPECIFIC CODE

  strFound=self.find(str);
  if (!strFound) {
   strFound=self.find(str,0,1)
   while (self.find(str,0,1)) continue
  }
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {

  // EXPLORER-SPECIFIC CODE

  if (TRange!=null) {
   TRange.collapse(false)
   strFound=TRange.findText(str)
   if (strFound) TRange.select()
  }
  if (TRange==null || strFound==0) {
   TRange=self.document.body.createTextRange()
   strFound=TRange.findText(str)
   if (strFound) TRange.select()
  }
 }
 if (!strFound) alert ("String '"+str+"' not found!")
}
//-->



