// anime_api.js - Animation API Scripts
// Requires JavaScript 1.2 and the
// Practical Browser Sniffer API (ua.js)
/*
The contents of this file began from the example animation API
given in "Dynamic HTML:  The Definitive Reference"
by Danny Goodman.
It has been modified from that basis to what you see here.
*/
var isNav, isGecko, isIE, intervalID, objString;
var styleObj = "";
if (navigator.family == 'nn4') {
  isNav = true;
}
else if (navigator.family == 'ie4' && navigator.version >=4) {
  isIE = true;
}
else if (navigator.DOMHTML && navigator.DOMCSS2) {
  isGecko = true;
}
//Navigator 4.x resize handler
function handleResize() {
  location.reload()
  return false
}
if (isNav || isGecko) {
  window.captureEvents(Event.RESIZE)
  window.onresize = handleResize
}


// Utility function returns height of object in pixels
function getObjHeight(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    return objString.clip.height;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    return objString.pixelHeight;
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj);
	return objString.offsetHeight;
  }
}

// Utility function returns width of object in pixels
function getObjWidth(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    return objString.clip.width;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    return objString.pixelWidth;
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj);
	return objString.offsetWidth;
  }
}

// Utility function returns the x coordinate of a positionable object
function getObjLeft(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    return objString.left;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    return objString.pixelLeft;
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj);
	return objString.offsetLeft;
  }
}

// Utility function returns the y coordinate of a positionable object
function getObjTop(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    return objString.top;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    return objString.pixelTop;
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj);
	return objString.offsetTop;
  }
}

// Utility function returns returns the available content width space in browser window
function getInsideWindowWidth(obj) {
  if (isNav) {
    //objString=eval("document." + obj);
    return window.innerWidth;
  }
  else if (isIE) {
    //objString=eval("document.all." + obj + ".style");
    return document.body.clientWidth;
  }
  else if (isGecko) {
    // Don't know if this works
    //objString="document.getElementById(obj).style";
	return window.innerWidth;
  }
}

// Utility function returns returns the available content height space in browser window
function getInsideWindowHeight(obj) {
  if (isNav) {
    //objString=eval("document." + obj);
    return window.innerHeight;
  }
  else if (isIE) {
    //objString=eval("document.all." + obj + ".style");
    return document.body.clientHeight;
  }
  else if (isGecko) {
    // Don't know if this works
    //objString=document.getElementById(obj).style;
	return window.innerHeight;
  }
}

// Utility function sets the visibility of an object to visible
function show(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.visibility = "visible";
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.visibility = "visible";
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj).style;
    objString.visibility = "visible";
  }
}

// Utility function sets the visibility of an object to hidden
function hide(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.visibility = "hidden";
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.visibility = "hidden";
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj).style;
    objString.visibility = "hidden";
  }
}

// Utility function sets an object to take up space
function uncollapse(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.display = "block";
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.display = "block";
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj).style;
    objString.display = "block";
  }
}

// Utility function sets an object to not take up space
function collapse(obj) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.display = "none";
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.display = "none";
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj).style;
    objString.display = "none";
  }
}


// Utility function to position an element at a specific x,y location
function shiftTo(obj, x, y) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.left = x;
    objString.top = y;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.pixelLeft = x;
    objString.pixelTop = y;
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(obj).style;
    objString.left=x+"px";
    objString.top=y+"px";
  }
}

// Utility function to move an object by x and/or y pixels
function shiftBy(obj, deltaX, deltaY) {
  if (isNav) {
    objString=eval("document." + obj);
    objString.left += deltaX;
    objString.top += deltaY;
  }
  else if (isIE) {
    objString=eval("document.all." + obj + ".style");
    objString.pixelLeft += deltaX;
    objString.pixelTop += deltaY;
  }
  else if (isGecko) {
    objString=document.getElementById(obj).style;
    objString2=document.getElementById(obj);
    x=objString2.offsetLeft + deltaX
    y=objString2.offsetTop + deltaY
    objString.left=x+"px";
    objString.top=y+"px";
  }
}

// Utility function to 'blink' some text using color
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
// Modified by Bob Curtis
<!-- Begin
function initArray() {
  this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
    this[i] = initArray.arguments[i];
  }
}

var x = 0;
blinkCount = 0;

function blinkText(blinkTimes,obj){
  obj="c";
  if (isNav) {
    objString=eval("document." + obj);
    objString.document.write('<font color="'+color[x]);
    objString.document.write('"><b>'+ctext+'</font></b>');
    objString.document.close();
  }
  else if (isIE) {
    objString=eval("document.all.c.style");
    objString.color = color[x];
  }
  else if (isGecko) {
    objString=document.getElementById(obj).style;
    objString.color = color[x];
  }

  (x < color.length-1) ? x++ : x = 0;

  if (blinkCount > 5) {
    clearTimeout(blinkID);
  }
  else {
    blinkID = setTimeout("chcolor()",1000);
  }
  blinkCount++
}


// ***End Animation API Library Code***