/* IE6 background Flicker Fix */
try {
  document.execCommand("BackgroundImageCache", false, true);
}catch(err){}

// popup window
function openWin( windowURL, windowName, windowFeatures ) {
    return window.open( windowURL, windowName, windowFeatures ) ;
}

// searchText
// prepoulate the search form with "Search this Site"
// and blank it when someone clicks
function searchText()
{
  var srchFld = document.getElementById('headerQuery');
  srchFld.setAttribute('value','Search this Site');
  srchFld.onfocus = function() {
    srchFld.setAttribute('value','');
  };
  // don't allow anyone to submit a query with the default text in it
  var goBtn = document.getElementById('searchGo');
  goBtn.onclick = function() {
    if (srchFld.value == 'Search this Site') {
       srchFld.focus();
       return false;
     } else {
       return true;
     }
  }
}
/* window.onload.actions.push(searchText); */
window.onload = function() { searchText(); }

function statusBar()
{
  window.status = 'Expertise. Service. Integrity. We get it.';
}

/* If link has http or https, make it a popup window */
function fixLinks()
{
  if (!document.getElementsByTagName) return null;
  var server = document.location.hostname;
  var anchors = document.getElementsByTagName("a");
  var i, href, title;
  for(i=0; i < anchors.length; i++){
    if(!anchors[i].href) continue;
    href = anchors[i].href;
    title = anchors[i].title;
    if(href.indexOf(server) == -1){ // Href is not a file on my server
      if(href.indexOf("javascript:") == -1){ // Href is not a javascript call
        if(!anchors[i].onclick){ // Href does not have an onclick event
          if(href.indexOf("mailto:") == -1){ // Href is not a mailto:
            if((href.indexOf("http://") != -1) || (href.indexOf("https://") != -1)){ // Href is not relative (for Safari)
              anchors[i].setAttribute("target","_blank");
              anchors[i].setAttribute("title",title + " [This Link Will Open in a New Window] ");
            }
          }
        }
      }
    }
  }
  return null;
}

/* Use jQuery to load functions when the DOM is ready */
$(document).ready(function () {
	fixLinks();
	statusBar();
	searchText();
});
/*
window.onload = function() {
	fixLinks();
	statusBar();
	searchText();
	}*/