var isIE = ((navigator.userAgent.indexOf("MSIE") > 0)&&(parseInt(navigator.appVersion) >= 4)) ? 1 : 0;
var isIE4 = (navigator.userAgent.indexOf("MSIE 4") > 0) ? 1 : 0;
var isIE5 = (navigator.userAgent.indexOf("MSIE 5") > 0) ? 1 : 0;
var isIE55 = (navigator.userAgent.indexOf("MSIE 5.5") > 0) ? 1 : 0;
var isIE6 = (navigator.userAgent.indexOf("MSIE 6") > 0) ? 1 : 0;
var isDT = (document.compatMode == "CSS1Compat") ? 1 : 0;
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var isNS4 = ((parseInt(navigator.appVersion) == 4)&&(isNS)) ? 1 : 0;
var isNS6 = (navigator.userAgent.indexOf("Gecko") > 0) ? 1 : 0;
var isDOM = (document.getElementById) ? 1 : 0;
var isOP = (navigator.userAgent.indexOf("Opera") > 0) ? 1 : 0;
var isOP4 = ((parseInt(navigator.appVersion) >= 4)&&(isOP)) ? 1 : 0;
if (isOP){
  var isIE4 = 0;
  var isIE5 = 0;
  var isIE55 = 0;
  var isIE6 = 0;
  var isNS6 = 0;
  var isNS4 = 0;
}

function getobject(obj){
  // Find the object
  var tempdiv;
  if (isNS4) { tempdiv = eval('document.' + obj); }
  else if (isDOM) { tempdiv = document.getElementById(obj); }
  else if (isIE) { tempdiv = document.all[obj]; }
  return tempdiv;
}

function hideobject(obj){
  if (isNS4){ obj.visibility = "hide"; }
  else if (isDOM) { obj.style.visibility = "hidden"; }
  else if (isIE) { obj.style.visibility = "hidden"; }
  return;
}

function showobject(obj){
  if (isNS4) { obj.visibility = "show"; }
  else if (isDOM) { obj.style.visibility = "visible"; }
  else if (isIE) { obj.style.visibility = "visible"; }
  return;
}

function getcenterX(){
  if (isIE){
    var bodyobject = (isDT) ? document.documentElement : document.body;
    var myscreenWidth = bodyobject.clientWidth;
    var myscrollX = bodyobject.scrollLeft;
  }
  else {
    var myscreenWidth = window.innerWidth;
    var myscrollX = window.pageXOffset;
  }
  var xBase = parseInt(myscreenWidth)/2 + parseInt(myscrollX);
  return xBase;
}

function getcenterY(){
  if (isIE){
    var bodyobject = (isDT) ? document.documentElement : document.body;
    var myscreenHeight = bodyobject.clientHeight;
    var myscrollY = bodyobject.scrollTop;
  }
  else {
    var myscreenHeight = window.innerHeight;
    var myscrollY = window.pageYOffset;
  }
  var yBase = parseInt(myscreenHeight)/2 + parseInt(myscrollY);
  return yBase;
}


function getobjectWidth(obj){
  if (isNS4) { return obj.clip.width; }
  else if (isDOM) { return obj.offsetWidth; }
  else if (isIE4) { return obj.style.pixelWidth; }
  return;
}

function getobjectHeight(obj){
  if (isNS4) { return obj.clip.height; }
  else if (isDOM) { return obj.offsetHeight; }
  else if (isIE4) { return obj.style.pixelHeight; }
  return;
}

function centerobject(obj, voff, hoff) {
  var yBase = getcenterY() - (getobjectHeight(obj)/2) + voff;
  var xBase = getcenterX() - (getobjectWidth(obj)/2) + hoff;
  moveobjectTo(obj, xBase, yBase);
  return;
}

function moveobjectTo(obj, x, y){
  if (isNS4) {
    obj.top = y;
    obj.Left = x;
  }
  else if (isDOM) {
    obj.style.top = y + "px";
    obj.style.left = x + "px";
  }
  else if (isIE) {
    obj.style.pixelTop = y;
    obj.style.pixelLeft = x;
  }
  return;
}

function getimgWidth(img){
  if ((isDOM)||(isIE))
    return document.images[img].width;
  return;
}

function getimgHeight(img){
  if ((isDOM)||(isIE))
    return document.images[img].height; 
  return; 
}

function setimgWidth(img, newwidth){
  if (isIE)
    document.images[img].width = newwidth;
  return;
}

function setimgHeight(img, newheight){
  if (isIE)
    document.images[img].height = newheight;
  return;
}

function setimgSize(img, newwidth, newheight){
  if (isIE){
    setimgWidth(img, newwidth);
    setimgHeight(img, newheight);
  }
  return;
}



var step = 1;
var currStep = 0;
var multcount = 0;
var imgsize = 1;
var countup;
var startimerID = null, startimerRunning = false;

var startxt = "BodyText";
var imgsrc = "starsImg";

// Pre-Load Flare Image
eval("flareImg = new Image(352,352);");
eval("flareImg.src = 'flare.jpg';");

function starloop() {
  var starimg = getobject("starsImg");
  var starobj = getobject("starsDiv");
  showobject(starobj); 
  imgsize = multcount/2;
  setimgSize("starsImg",imgsize,imgsize);
  if (countup == "true") {
    multcount += 10; 
    if (multcount >= 200) { countup = "false"; }
  }
  else {
    multcount -= 10; 
    if (multcount <= 0) { countup = "true"; }
  }
  var xBase = getcenterX() - (getimgWidth("starsImg")/2) + multcount*(Math.sin(currStep));
  var yBase = getcenterY() - (getimgHeight("starsImg")/2) + multcount*(Math.cos(currStep));
  moveobjectTo(starobj, xBase, yBase);
  currStep -= step;
  if (isNS6){ startimerID = setTimeout("starloop()", 100); }
  else { startimerID = setTimeout("starloop()", 100); }
  startimerRunning = true;
  return;
}

function starpulse() {
  var starimg = getobject("starsImg");
  var starobj = getobject("starsDiv");
  showobject(starobj);  
  setimgSize("starsImg",imgsize,imgsize);
  if (countup == "true") {
    imgsize += 16; 
    if (imgsize >= 352) { countup = "false"; }
  }
  else {
    imgsize -= 16; 
    if (imgsize <= 32) { countup = "true"; }
  }
  var xBase = getcenterX() - (getimgWidth("starsImg")/2);
  var yBase = getcenterY() - (getimgHeight("starsImg")/2);
  moveobjectTo(starobj, xBase, yBase);
  if (isNS6){ startimerID = setTimeout("starpulse()", 50); }
  else { startimerID = setTimeout("starpulse()", 50); }
  startimerRunning = true;
  return;
}

function stopstareffects(){
  var starimg = getobject("starsImg");
  var starobj = getobject("starsDiv");
  hideobject(starobj);  
  if(startimerRunning){ clearTimeout(startimerID) }; 
  startimerRunning = false;
  return;
}

