<!--
// Make sure no one can reference this file from another website (stealing bandwidth)
var accepted_domains = new Array("easy-designs.net","burzenski.com");
var domaincheck = document.location.href; // retrieve the current URL of user browser
var accepted_ok = false; // set acess to false by default

if (domaincheck.indexOf("http")!=-1) //if this is a http request
{
  for (r = 0; r < accepted_domains.length; r++)
  {
    if (domaincheck.indexOf(accepted_domains[r]) != -1) // if a match is found
    {
      accepted_ok = true; // set access to true, and break out of loop
      break;
    }
  }
} else {
  accepted_ok = true
}
if (!accepted_ok)
{
  alert("You\'re not allowed to directly link to this .js file on our server!");
  history.back(-1);
}

document.write('<script type="text/javascript" src="/scripts/PieNG.js"></script>');
document.write('<script type="text/javascript" src="/scripts/browserdetect_lite.js"></script>');
document.write('<script type="text/javascript" src="/scripts/formValidation.js"></script>');

// accessibilizeLinks
// added 9-8-03
// copy mouse events to keyboard events if no keyboard event exists
// Author: Ryan Carver | fivesevensix.com
function accessibilizeLinks(){
  if (!document.getElementsByTagName) return;
 
  var events = {
  'onmousedown':  'onkeydown',
  'onmouseup':  'onkeyup',
  'onclick':   'onkeypress',
  'onmouseover':  'onfocus',
  'onmouseout':  'onblur'
  }
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i < anchors.length; i++)
  {
    var a = anchors[i];
    for (var e in events)
    {
      if (a[e] && !a[events[e]])
      a[events[e]] = a[e];
    }
  }
}

// fix inputs for IE
// fixes error where IE displays random colored backgrounds for inputs
// we'll just make 'em white as it doesn't support :focus for inputs
// and textareas anyway
function fixInputs()
{
  // grab all selectboxes
  var selects = document.getElementsByTagName("select");
  for(var i=0; i < selects.length; i++)
  {
    var s = selects[i];
    s.style.backgroundColor = "#fff";
  }
  // grab all textareas
  var textareas = document.getElementsByTagName("textarea");
  for(var i=0; i < textareas.length; i++)
  {
    var t = textareas[i];
    t.style.backgroundColor = "#fff";
  }
  // grab all inputs
  var inputs = document.getElementsByTagName("input");
  for(var x=0; x < inputs.length; x++)
  {
    var input = inputs[x];
    if (input.type == "text") // make sure it is one which is type="text"
    {
      input.style.backgroundColor = "#fff";
    }
  }
}

// added 12-12-03
// used to open outside links in a new window
// Author: Travis Beckham | squidfingers.com
// Modified by Aaron Gustafson
function handleExternalLinks(){
  if (!document.getElementsByTagName) return null;
  var server = document.location.hostname;
  var anchors = document.getElementsByTagName("a");
  var i, href;
  for(i=0; i < anchors.length; i++){
    if(!anchors[i].href) continue;
    href = anchors[i].href;
    if(href.indexOf("http://" + 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");
            }
          }
        }
      }
    }
  }
  return null;
}

// enlarge & reduce
function enlarge()
{
  var images = document.getElementById("map").getElementsByTagName("img");
  var mapImage = images[0];
  var imagePath = mapImage.src;
  var imageNumber = imagePath.replace(".gif","");
  imageNumber = imagePath.substr(imagePath.indexOf("maps/map") + 8,2);
  imageNumber = parseInt(imageNumber);
  if (imageNumber < 10) {
    imageNumber = imageNumber + 1;
  }
  var newImagePath = "/images/maps/map" + imageNumber + ".gif";
  mapImage.setAttribute("src",newImagePath);
}
function reduce()
{
  var images = document.getElementById("map").getElementsByTagName("img");
  var mapImage = images[0];
  var imagePath = mapImage.src;
  var imageNumber = imagePath.replace(".gif","");
  imageNumber = imagePath.substr(imagePath.indexOf("maps/map") + 8,2);
  imageNumber = parseInt(imageNumber);
  if (imageNumber > 1) {
    imageNumber = imageNumber - 1;
  }
  var newImagePath = "/images/maps/map" + imageNumber + ".gif";
  mapImage.setAttribute("src",newImagePath);
}

//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth;
  if (WhichMonth == "04" || WhichMonth == "06" || WhichMonth == "09" || WhichMonth == "11")
  {
    DaysInMonth = 30;
  } else if (WhichMonth == "02" && (WhichYear/4) != Math.floor(WhichYear/4)) {
    DaysInMonth = 28; 
  } else if (WhichMonth == "02" && (WhichYear/4) == Math.floor(WhichYear/4)) {
    DaysInMonth = 29;
  } else {
    DaysInMonth = 31;
  }
  return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays()
{
  DaysObject = document.getElementById("day");
  MonthObject = document.getElementById("month");
  YearObject = document.getElementById("year");

  Month = MonthObject[MonthObject.selectedIndex].value;
  Year = YearObject[YearObject.selectedIndex].value;
  
  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null;
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    var newOption, text;
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      newOption = document.createElement("option");
      newOption.setAttribute("value",DaysObject.options.length + 1);
      text = document.createTextNode(DaysObject.options.length + 1);
      newOption.appendChild(text);
      DaysObject.appendChild(newOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//function to set options to today
function SetToToday()
{
  DaysObject = document.getElementById("day");
  MonthObject = document.getElementById("month");
  YearObject = document.getElementById("year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays();

  DaysObject[NowDay-1].selected = true;
}


// onload
window.onload = function() {
  accessibilizeLinks();
  handleExternalLinks();
  if (browser.isIE && !browser.isIEMac)
  {
    fixInputs();
    fixPng();
  }
}