//<![CDATA[
// Default.js -- Standard javascript routines...

//------------------------------------------------------------------------------------
// This bit of code forces the page out of any frame it might have been loaded into.
//------------------------------------------------------------------------------------
    if (self != top) {
        if (window.location.href.replace)
          top.location.replace(self.location.href);
        else
          top.location.href=self.document.href;
    }

//------------------------------------------------------------------------------------
function detect(){
  if(screen.width<1280){
     alert("The Digital Atlas is best viewed with a screen width of 1280 or greater.  Your current screen width is "+screen.width+".  If possible please change your resolution.")
     }
}

//------------------------------------------------------------------------------------
function beLite(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#800000";
   x.style.backgroundColor = "#F08080";
   x.style.borderTopColor = "#000000";
   x.style.borderBottomColor = "#AAAAAA";
   x.style.borderLeftColor = "#000000";
   x.style.borderRightColor = "#AAAAAA";
}

//------------------------------------------------------------------------------------
function beDim(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#F5F5DC";
   x.style.backgroundColor = "#800000";
   x.style.borderTopColor = "#AAAAAA";
   x.style.borderBottomColor = "#000000";
   x.style.borderLeftColor = "#AAAAAA";
   x.style.borderRightColor = "#000000";
}

//------------------------------------------------------------------------------------
function beDown(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#800000";
   x.style.backgroundColor = "#FFFFF0";
   x.style.borderTopColor = "#AAAAAA";
   x.style.borderBottomColor = "#000000";
   x.style.borderLeftColor = "#AAAAAA";
   x.style.borderRightColor = "#000000";
}

//------------------------------------------------------------------------------------
function bePFLite(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#000000";
   x.style.backgroundColor = "#DCDCDC";
   x.style.borderTopColor = "#000000";
   x.style.borderBottomColor = "#D3D3D3";
   x.style.borderLeftColor = "#000000";
   x.style.borderRightColor = "#D3D3D3";
}

//------------------------------------------------------------------------------------
function bePFDim(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#ffffff";
   x.style.backgroundColor = "#696969";
   x.style.borderTopColor = "#DCDCDC";
   x.style.borderBottomColor = "#000000";
   x.style.borderLeftColor = "#DCDCDC";
   x.style.borderRightColor = "#000000";
}

//------------------------------------------------------------------------------------
function bePFDown(BTN){
   x=document.getElementById(BTN);
   x.style.color = "#000000";
   x.style.backgroundColor = "#DCDCDC";
   x.style.borderTopColor = "#A9A9A9";
   x.style.borderBottomColor = "#000000";
   x.style.borderLeftColor = "#A9A9A9";
   x.style.borderRightColor = "#000000";
}

//------------------------------------------------------------------------------------
function LinkLite(BTN){
   x=document.getElementById(BTN);
   x.style.color = "red";
}

//------------------------------------------------------------------------------------
function LinkDim(BTN){
   x=document.getElementById(BTN);
   x.style.color = "blue";
}

//------------------------------------------------------------------------------------
function LinkDown(BTN){
   x=document.getElementById(BTN);
   x.style.color = "green";
}

//------------------------------------------------------------------------------------
function LinkUp(BTN){
   x=document.getElementById(BTN);
   x.style.color = "maroon";
}

//------------------------------------------------------------------------------------
// Get the blurb content for the right column.
//------------------------------------------------------------------------------------
function getBlurb(myBlurb, myDiv) {
   url="GetBlurb.php?b=" + myBlurb;
   handleMessages(url, myDiv);
}

//------------------------------------------------------------------------------------
// Get the page content for the right column.
//------------------------------------------------------------------------------------
function getPage(myURL, myDiv) {
   handleMessages(myURL, myDiv);
}

//------------------------------------------------------------------------------------
// processAjax - Processes Ajax calls.
//------------------------------------------------------------------------------------
function processAjax (url, resultID) {
  // Create xmlhttp request object
  var xmlhttp=false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } 
  catch (e) {
             try { xmlhtttp = new ActiveXObject("Microsoft.XMLHTTP"); } 
             catch (E) { xmlhttp = false; }
            }

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }

  if (xmlhttp) {
      var obj;
      xmlhttp.open("GET", url, true);
      xmlhttp.onreadystatechange=function() {
         if (xmlhttp.readyState==4) {
             obj = document.getElementById(resultID);
             obj.innerHTML = xmlhttp.responseText;
         }
      }
      xmlhttp.send(""); 
      return 0;
  }
}
//]]>